src/work/alpar/list_graph.h moved to /src/hugo.
5 Template base class for implementing mapping on nodes.
6 \param The first template parameter is the Graph class. The Graph
7 must have an \emp node_maps member with \emp MapRegistry class.
8 \param The second template parameter is the type of the class.
14 template <typename G, typename K, typename KIt>
18 #include "map_registry.h"
22 template <typename G, typename K, typename KIt>
26 typedef MapRegistry<G, K, KIt> Registry;
30 friend class Registry;
36 MapBase() : registry(0) {}
39 Simple constructor to register into a graph registry.
42 MapBase(Graph& g, Registry& r) : graph(&g), registry(0) {
43 registry->attach(*this);
47 Copy constructor with registering into the map.
50 MapBase(const MapBase& copy) : registry(0), graph(copy.graph) {
52 copy.registry->attach(*this);
60 const MapBase& operator=(const MapBase& copy) {
62 registry->detach(*this);
66 copy.registry->attach(*this);
77 registry->detach(*this);
89 Helper function to implement the default constructor in the subclasses.
94 for (KeyIt it(*graph); graph->valid(it); graph->next(it)) {
100 Helper function to implement the destructor in the subclasses.
103 virtual void destroy() {
104 for (KeyIt it(*graph); graph->valid(it); graph->next(it)) {
110 The add member function should be overloaded in the subclasses.
111 \e Add extends the map with the new node.
114 virtual void add(const KeyType&) = 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 KeyType&) = 0;
124 Exception class to throw at unsupported operation.
127 class NotSupportedOperationException {};