src/work/deba/node_map_base.h
author athos
Fri, 02 Apr 2004 15:59:17 +0000
changeset 277 044f5898b769
child 336 8ff3b3e05478
permissions -rw-r--r--
Munkaido
deba@262
     1
#ifndef NODE_MAP_BASE_H
deba@262
     2
#define NODE_MAP_BASE_H
deba@262
     3
deba@262
     4
template <class G, class K>
deba@262
     5
class NodeMapBase {
deba@262
     6
public:
deba@262
     7
	typedef G Graph;
deba@262
     8
deba@262
     9
	typedef K KeyType;
deba@262
    10
	
deba@262
    11
deba@262
    12
	MapBase() : graph(0) {}
deba@262
    13
	MapBase(Graph& g) : graph(&g) {graph.node_maps.add(*this);}
deba@262
    14
deba@262
    15
	virtual ~MapBase() {graph.node_maps.erase(*this);}	
deba@262
    16
deba@262
    17
protected:
deba@262
    18
	
deba@262
    19
	Graph* graph;
deba@262
    20
deba@262
    21
	int graph_index;
deba@262
    22
	
deba@262
    23
	
deba@262
    24
	virtual void add(const KeyType&) = 0;
deba@262
    25
	virtual void erase(const KeyType&) = 0;
deba@262
    26
deba@262
    27
	friend class Graph;
deba@262
    28
};
deba@262
    29
deba@262
    30
#endif