diff -r 23a608ba40ab -r e10b5e9419ef src/work/deba/map_base.h --- a/src/work/deba/map_base.h Mon May 10 09:12:28 2004 +0000 +++ b/src/work/deba/map_base.h Mon May 10 13:49:35 2004 +0000 @@ -1,12 +1,14 @@ #ifndef MAP_BASE_H #define MAP_BASE_H +using namespace std; + /** - Template base class for implementing mapping on nodes. - \param The first template parameter is the Graph class. The Graph - must have an \emp node_maps member with \emp MapRegistry class. - \param The second template parameter is the type of the class. - + Template base class for implementing mapping on nodes and edges. + \param The first template parameter is the Graph class. + \param The second template parameter is the key type. + \param The third template parameter is an iterator on + the keys. */ @@ -24,7 +26,7 @@ public: typedef G Graph; typedef MapRegistry Registry; - typedef K KeyType; + typedef K Key; typedef KIt KeyIt; friend class Registry; @@ -33,14 +35,14 @@ Default constructor. */ - MapBase() : registry(0) {} + MapBase() : graph(0), registry(0) {} /** Simple constructor to register into a graph registry. */ MapBase(Graph& g, Registry& r) : graph(&g), registry(0) { - registry->attach(*this); + r.attach(*this); } /** @@ -80,17 +82,16 @@ protected: + Graph* graph; Registry* registry; - Graph* graph; int registry_index; /** - Helper function to implement the default constructor in the subclasses. + Helper function to implement constructors in the subclasses. */ virtual void init() { - for (KeyIt it(*graph); graph->valid(it); graph->next(it)) { add(it); } @@ -111,14 +112,13 @@ \e Add extends the map with the new node. */ - virtual void add(const KeyType&) = 0; - + virtual void add(const Key&) = 0; /** The erase member function should be overloaded in the subclasses. \e Erase removes the node from the map. */ - virtual void erase(const KeyType&) = 0; + virtual void erase(const Key&) = 0; /** Exception class to throw at unsupported operation.