1.1 --- a/src/work/deba/map_base.h Mon May 10 09:12:28 2004 +0000
1.2 +++ b/src/work/deba/map_base.h Mon May 10 13:49:35 2004 +0000
1.3 @@ -1,12 +1,14 @@
1.4 #ifndef MAP_BASE_H
1.5 #define MAP_BASE_H
1.6
1.7 +using namespace std;
1.8 +
1.9 /**
1.10 - Template base class for implementing mapping on nodes.
1.11 - \param The first template parameter is the Graph class. The Graph
1.12 - must have an \emp node_maps member with \emp MapRegistry class.
1.13 - \param The second template parameter is the type of the class.
1.14 -
1.15 + Template base class for implementing mapping on nodes and edges.
1.16 + \param The first template parameter is the Graph class.
1.17 + \param The second template parameter is the key type.
1.18 + \param The third template parameter is an iterator on
1.19 + the keys.
1.20 */
1.21
1.22
1.23 @@ -24,7 +26,7 @@
1.24 public:
1.25 typedef G Graph;
1.26 typedef MapRegistry<G, K, KIt> Registry;
1.27 - typedef K KeyType;
1.28 + typedef K Key;
1.29 typedef KIt KeyIt;
1.30
1.31 friend class Registry;
1.32 @@ -33,14 +35,14 @@
1.33 Default constructor.
1.34 */
1.35
1.36 - MapBase() : registry(0) {}
1.37 + MapBase() : graph(0), registry(0) {}
1.38
1.39 /**
1.40 Simple constructor to register into a graph registry.
1.41 */
1.42
1.43 MapBase(Graph& g, Registry& r) : graph(&g), registry(0) {
1.44 - registry->attach(*this);
1.45 + r.attach(*this);
1.46 }
1.47
1.48 /**
1.49 @@ -80,17 +82,16 @@
1.50
1.51 protected:
1.52
1.53 + Graph* graph;
1.54 Registry* registry;
1.55 - Graph* graph;
1.56
1.57 int registry_index;
1.58
1.59 /**
1.60 - Helper function to implement the default constructor in the subclasses.
1.61 + Helper function to implement constructors in the subclasses.
1.62 */
1.63
1.64 virtual void init() {
1.65 -
1.66 for (KeyIt it(*graph); graph->valid(it); graph->next(it)) {
1.67 add(it);
1.68 }
1.69 @@ -111,14 +112,13 @@
1.70 \e Add extends the map with the new node.
1.71 */
1.72
1.73 - virtual void add(const KeyType&) = 0;
1.74 -
1.75 + virtual void add(const Key&) = 0;
1.76 /**
1.77 The erase member function should be overloaded in the subclasses.
1.78 \e Erase removes the node from the map.
1.79 */
1.80
1.81 - virtual void erase(const KeyType&) = 0;
1.82 + virtual void erase(const Key&) = 0;
1.83
1.84 /**
1.85 Exception class to throw at unsupported operation.