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