No maps with the same name can be added.
1 #include <mapstorage.h>
3 MapStorage::MapStorage(Graph & graph):g(graph)
7 int MapStorage::addNodeMap(const std::string & name, Graph::NodeMap<double> *nodemap)
9 if( nodemap_storage.find(name) == nodemap_storage.end() )
11 nodemap_storage[name]=nodemap;
17 int MapStorage::addEdgeMap(const std::string & name, Graph::EdgeMap<double> *edgemap)
19 if( edgemap_storage.find(name) == edgemap_storage.end() )
21 edgemap_storage[name]=edgemap;
27 double MapStorage::maxOfNodeMap(const std::string & name)
30 for (NodeIt j(g); j!=INVALID; ++j)
32 if( (*nodemap_storage[name])[j]>max )
34 max=(*nodemap_storage[name])[j];
40 double MapStorage::maxOfEdgeMap(const std::string & name)
43 for (EdgeIt j(g); j!=INVALID; ++j)
45 if( (*edgemap_storage[name])[j]>max )
47 max=(*edgemap_storage[name])[j];
53 double MapStorage::minOfNodeMap(const std::string & name)
56 double min=(*nodemap_storage[name])[j];
57 for (; j!=INVALID; ++j)
59 if( (*nodemap_storage[name])[j]<min )
61 min=(*nodemap_storage[name])[j];
67 double MapStorage::minOfEdgeMap(const std::string & name)
70 double min=(*edgemap_storage[name])[j];
71 for (EdgeIt j(g); j!=INVALID; ++j)
73 if( (*edgemap_storage[name])[j]<min )
75 min=(*edgemap_storage[name])[j];
81 void MapStorage::initMapsForEdge(Graph::Edge e)
83 std::map< std::string,Graph::EdgeMap<double> * >::iterator ems_it;
84 for(ems_it=edgemap_storage.begin();ems_it!=edgemap_storage.end();ems_it++)
86 (*((*ems_it).second))[e]=5;