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