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