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