Minor changes: Section labels fixed.
7 Template base class for implementing mapping on nodes and edges.
8 \param The first template parameter is the Graph class.
9 \param The second template parameter is the key type.
10 \param The third template parameter is an iterator on
16 template <typename G, typename K, typename KIt>
20 #include "map_registry.h"
24 template <typename G, typename K, typename KIt>
28 typedef MapRegistry<G, K, KIt> Registry;
32 friend class Registry;
38 MapBase() : graph(0), registry(0) {}
41 Simple constructor to register into a graph registry.
44 MapBase(Graph& g, Registry& r) : graph(&g), registry(0) {
49 Copy constructor with registering into the map.
52 MapBase(const MapBase& copy) : registry(0), graph(copy.graph) {
54 copy.registry->attach(*this);
62 const MapBase& operator=(const MapBase& copy) {
64 registry->detach(*this);
68 copy.registry->attach(*this);
79 registry->detach(*this);
91 Helper function to implement constructors in the subclasses.
95 for (KeyIt it(*graph); graph->valid(it); graph->next(it)) {
101 Helper function to implement the destructor in the subclasses.
104 virtual void destroy() {
105 for (KeyIt it(*graph); graph->valid(it); graph->next(it)) {
111 The add member function should be overloaded in the subclasses.
112 \e Add extends the map with the new node.
115 virtual void add(const Key&) = 0;
117 The erase member function should be overloaded in the subclasses.
118 \e Erase removes the node from the map.
121 virtual void erase(const Key&) = 0;
124 Exception class to throw at unsupported operation.
127 class NotSupportedOperationException {};