[1412] | 1 | // -*- C++ -*- //
|
---|
| 2 |
|
---|
| 3 | #ifndef MAPSTORAGE_H
|
---|
| 4 | #define MAPSTORAGE_H
|
---|
| 5 |
|
---|
| 6 | #include <all_include.h>
|
---|
| 7 |
|
---|
[1440] | 8 | ///Class MapStorage is responsible for storing
|
---|
| 9 | ///NodeMaps and EdgeMaps that can be shown later
|
---|
| 10 | ///on GUI. Therefore maps can be added to it,
|
---|
| 11 | ///and datas over the added maps can be queried.
|
---|
| 12 | ///The maps will be stored in an std::map,
|
---|
| 13 | ///referenced with their names. Unfortunately at
|
---|
| 14 | ///the moment it works only with double type maps
|
---|
| 15 | ///
|
---|
| 16 | ///\todo too many things are public!!
|
---|
[1412] | 17 | class MapStorage
|
---|
| 18 | {
|
---|
[1440] | 19 | public:
|
---|
[1412] | 20 |
|
---|
| 21 | Graph g;
|
---|
[1440] | 22 |
|
---|
| 23 | ///Stores double type NodeMaps
|
---|
[1412] | 24 | std::map< std::string,Graph::NodeMap<double> * > nodemap_storage;
|
---|
[1440] | 25 |
|
---|
| 26 | ///Stores double type EdgeMaps
|
---|
[1412] | 27 | std::map< std::string,Graph::EdgeMap<double> * > edgemap_storage;
|
---|
| 28 |
|
---|
[1440] | 29 | //Stores the default values for the different visualization node attributes
|
---|
[1412] | 30 | std::vector<Graph::NodeMap<double> > default_nodemaps;
|
---|
[1440] | 31 |
|
---|
| 32 | //Stores the default values for the different visualization edge attributes
|
---|
[1412] | 33 | std::vector<Graph::EdgeMap<double> > default_edgemaps;
|
---|
| 34 |
|
---|
| 35 | public:
|
---|
[1440] | 36 | ///Constructor of MapStorage. Expects the Graph of
|
---|
| 37 | ///which maps will be stored in it.
|
---|
| 38 | ///Its all activity is initializing default values
|
---|
| 39 | ///for different visualization attributes
|
---|
| 40 | ///
|
---|
| 41 | ///\param graph is the graph for which the maps are stored in this object.
|
---|
[1412] | 42 | MapStorage(Graph &);
|
---|
[1440] | 43 |
|
---|
| 44 | ///Adds given map to storage. A name and the map itself has to be provided.
|
---|
| 45 | ///\param name is the name of map
|
---|
| 46 | ///\nodemap is the pointer of the given nodemap
|
---|
| 47 | ///\todo map should be given by reference!
|
---|
[1412] | 48 | int addNodeMap(const std::string &,Graph::NodeMap<double> *);
|
---|
[1440] | 49 |
|
---|
| 50 | ///Adds given map to storage. A name and the map itself has to be provided.
|
---|
| 51 | ///\param name is the name of map
|
---|
| 52 | ///\edgemap is the pointer of the given edgemap
|
---|
| 53 | ///\todo map should be given by reference!
|
---|
[1412] | 54 | int addEdgeMap(const std::string &,Graph::EdgeMap<double> *);
|
---|
| 55 |
|
---|
[1440] | 56 | ///Returns how much nodemaps is stored in \ref MapStorage
|
---|
[1412] | 57 | int numOfNodeMaps() {return nodemap_storage.size();};
|
---|
[1440] | 58 |
|
---|
| 59 | ///Returns how much edgemaps is stored in \ref MapStorage
|
---|
[1412] | 60 | int numOfEdgeMaps() {return edgemap_storage.size();};
|
---|
| 61 |
|
---|
[1440] | 62 | ///Returns the maximum value of the given NodeMap. NodeMap has to be given by its name.
|
---|
| 63 | ///\param name is the name of map of which maximum is searched
|
---|
[1412] | 64 | double maxOfNodeMap(const std::string &);
|
---|
[1440] | 65 |
|
---|
| 66 | ///Returns the maximum value of the given EdgeMap. EdgeMap has to be given by its name.
|
---|
| 67 | ///\param name is the name of map of which maximum is searched
|
---|
[1412] | 68 | double maxOfEdgeMap(const std::string &);
|
---|
| 69 |
|
---|
[1440] | 70 | ///Returns the minimum value of the given NodeMap. NodeMap has to be given by its name.
|
---|
| 71 | ///\param name is the name of map of which minimum is searched
|
---|
[1412] | 72 | double minOfNodeMap(const std::string &);
|
---|
[1440] | 73 |
|
---|
| 74 | ///Returns the minimum value of the given EdgeMap. EdgeMap has to be given by its name.
|
---|
| 75 | ///\param name is the name of map of which minimum is searched
|
---|
[1412] | 76 | double minOfEdgeMap(const std::string &);
|
---|
| 77 |
|
---|
[1440] | 78 | ///To be able to iterate through each maps this function returns an iterator pointing to the first nodemap in the storage.
|
---|
[1412] | 79 | std::map< std::string,Graph::NodeMap<double> * >::iterator beginOfNodeMaps(){return nodemap_storage.begin();};
|
---|
[1440] | 80 |
|
---|
| 81 | ///To be able to iterate through each maps this function returns an iterator pointing to the first edgemap in the storage.
|
---|
[1412] | 82 | std::map< std::string,Graph::EdgeMap<double> * >::iterator beginOfEdgeMaps(){return edgemap_storage.begin();};
|
---|
| 83 | };
|
---|
| 84 |
|
---|
| 85 | #endif //MAPSTORAGE_H
|
---|