deba@261: #ifndef MAPBASE_H deba@261: #define MAPBASE_H deba@261: deba@261: template deba@261: class MapBase { deba@261: public: deba@261: typedef GB GraphBase; deba@261: typedef MappedGraph Graph; deba@261: deba@261: typedef K KeyType; deba@261: deba@261: deba@261: MapBase() : graph(0) {} deba@261: MapBase(Graph& g) : graph(&g) {graph.add(*this);} deba@261: deba@261: virtual ~MapBase() {graph.erase(*this);} deba@261: deba@261: protected: deba@261: deba@261: Graph* graph; deba@261: deba@261: int graph_index; deba@261: deba@261: deba@261: virtual void add(const KeyType&) = 0; deba@261: virtual void erase(const KeyType&) = 0; deba@261: deba@261: friend class Graph; deba@261: }; deba@261: deba@261: #endif