ladanyi@6: // -*- C++ -*- // ladanyi@6: ladanyi@6: #ifndef MAPSTORAGE_H ladanyi@6: #define MAPSTORAGE_H ladanyi@6: ladanyi@6: #include ladanyi@6: ladanyi@6: ///Class MapStorage is responsible for storing ladanyi@6: ///NodeMaps and EdgeMaps that can be shown later ladanyi@6: ///on GUI. Therefore maps can be added to it, ladanyi@6: ///and datas over the added maps can be queried. ladanyi@6: ///The maps will be stored in an std::map, ladanyi@6: ///referenced with their names. Unfortunately at ladanyi@6: ///the moment it works only with double type maps ladanyi@6: /// ladanyi@6: ///\todo too many things are public!! ladanyi@6: class MapStorage ladanyi@6: { ladanyi@6: public: ladanyi@6: ladanyi@6: Graph g; ladanyi@6: ladanyi@6: ///Stores double type NodeMaps ladanyi@6: std::map< std::string,Graph::NodeMap * > nodemap_storage; ladanyi@6: ladanyi@6: ///Stores double type EdgeMaps ladanyi@6: std::map< std::string,Graph::EdgeMap * > edgemap_storage; ladanyi@6: ladanyi@6: //Stores the default values for the different visualization node attributes ladanyi@6: std::vector > default_nodemaps; ladanyi@6: ladanyi@6: //Stores the default values for the different visualization edge attributes ladanyi@6: std::vector > default_edgemaps; ladanyi@6: ladanyi@6: public: ladanyi@6: ///Constructor of MapStorage. Expects the Graph of ladanyi@6: ///which maps will be stored in it. ladanyi@6: ///Its all activity is initializing default values ladanyi@6: ///for different visualization attributes ladanyi@6: /// ladanyi@6: ///\param graph is the graph for which the maps are stored in this object. ladanyi@6: MapStorage(Graph &); ladanyi@6: ladanyi@6: ///Adds given map to storage. A name and the map itself has to be provided. ladanyi@6: ///\param name is the name of map ladanyi@6: ///\nodemap is the pointer of the given nodemap ladanyi@6: ///\todo map should be given by reference! ladanyi@6: int addNodeMap(const std::string &,Graph::NodeMap *); ladanyi@6: ladanyi@6: ///Adds given map to storage. A name and the map itself has to be provided. ladanyi@6: ///\param name is the name of map ladanyi@6: ///\edgemap is the pointer of the given edgemap ladanyi@6: ///\todo map should be given by reference! ladanyi@6: int addEdgeMap(const std::string &,Graph::EdgeMap *); ladanyi@6: ladanyi@6: ///Returns how much nodemaps is stored in \ref MapStorage ladanyi@6: int numOfNodeMaps() {return nodemap_storage.size();}; ladanyi@6: ladanyi@6: ///Returns how much edgemaps is stored in \ref MapStorage ladanyi@6: int numOfEdgeMaps() {return edgemap_storage.size();}; ladanyi@6: ladanyi@6: ///Returns the maximum value of the given NodeMap. NodeMap has to be given by its name. ladanyi@6: ///\param name is the name of map of which maximum is searched ladanyi@6: double maxOfNodeMap(const std::string &); ladanyi@6: ladanyi@6: ///Returns the maximum value of the given EdgeMap. EdgeMap has to be given by its name. ladanyi@6: ///\param name is the name of map of which maximum is searched ladanyi@6: double maxOfEdgeMap(const std::string &); ladanyi@6: ladanyi@6: ///Returns the minimum value of the given NodeMap. NodeMap has to be given by its name. ladanyi@6: ///\param name is the name of map of which minimum is searched ladanyi@6: double minOfNodeMap(const std::string &); ladanyi@6: ladanyi@6: ///Returns the minimum value of the given EdgeMap. EdgeMap has to be given by its name. ladanyi@6: ///\param name is the name of map of which minimum is searched ladanyi@6: double minOfEdgeMap(const std::string &); ladanyi@6: ladanyi@6: ///To be able to iterate through each maps this function returns an iterator pointing to the first nodemap in the storage. ladanyi@6: std::map< std::string,Graph::NodeMap * >::iterator beginOfNodeMaps(){return nodemap_storage.begin();}; ladanyi@6: ladanyi@6: ///To be able to iterate through each maps this function returns an iterator pointing to the first edgemap in the storage. ladanyi@6: std::map< std::string,Graph::EdgeMap * >::iterator beginOfEdgeMaps(){return edgemap_storage.begin();}; ladanyi@6: }; ladanyi@6: ladanyi@6: #endif //MAPSTORAGE_H