src/work/deba/mapbase.h
changeset 299 54e8905344ba
equal deleted inserted replaced
-1:000000000000 0:f4e54a6a5cc5
       
     1 #ifndef MAPBASE_H
       
     2 #define MAPBASE_H
       
     3 
       
     4 template <class GB, class K>
       
     5 class MapBase {
       
     6 public:
       
     7 	typedef GB GraphBase;
       
     8 	typedef MappedGraph<GraphBase> Graph;
       
     9 
       
    10 	typedef K KeyType;
       
    11 	
       
    12 
       
    13 	MapBase() : graph(0) {}
       
    14 	MapBase(Graph& g) : graph(&g) {graph.add(*this);}
       
    15 
       
    16 	virtual ~MapBase() {graph.erase(*this);}	
       
    17 
       
    18 protected:
       
    19 	
       
    20 	Graph* graph;
       
    21 
       
    22 	int graph_index;
       
    23 	
       
    24 	
       
    25 	virtual void add(const KeyType&) = 0;
       
    26 	virtual void erase(const KeyType&) = 0;
       
    27 
       
    28 	friend class Graph;
       
    29 };
       
    30 
       
    31 #endif