author | alpar |
Sat, 17 Apr 2004 13:15:53 +0000 | |
changeset 348 | b63ea19e502e |
permissions | -rw-r--r-- |
deba@261 | 1 |
#ifndef MAPBASE_H |
deba@261 | 2 |
#define MAPBASE_H |
deba@261 | 3 |
|
deba@261 | 4 |
template <class GB, class K> |
deba@261 | 5 |
class MapBase { |
deba@261 | 6 |
public: |
deba@261 | 7 |
typedef GB GraphBase; |
deba@261 | 8 |
typedef MappedGraph<GraphBase> Graph; |
deba@261 | 9 |
|
deba@261 | 10 |
typedef K KeyType; |
deba@261 | 11 |
|
deba@261 | 12 |
|
deba@261 | 13 |
MapBase() : graph(0) {} |
deba@261 | 14 |
MapBase(Graph& g) : graph(&g) {graph.add(*this);} |
deba@261 | 15 |
|
deba@261 | 16 |
virtual ~MapBase() {graph.erase(*this);} |
deba@261 | 17 |
|
deba@261 | 18 |
protected: |
deba@261 | 19 |
|
deba@261 | 20 |
Graph* graph; |
deba@261 | 21 |
|
deba@261 | 22 |
int graph_index; |
deba@261 | 23 |
|
deba@261 | 24 |
|
deba@261 | 25 |
virtual void add(const KeyType&) = 0; |
deba@261 | 26 |
virtual void erase(const KeyType&) = 0; |
deba@261 | 27 |
|
deba@261 | 28 |
friend class Graph; |
deba@261 | 29 |
}; |
deba@261 | 30 |
|
deba@261 | 31 |
#endif |