Written hugo/ into includes.
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(Registry& r) : registry(0) {
47 Copy constructor with registering into the map.
50 MapBase(const MapBase& copy) : registry(0) {
60 const MapBase& operator=(const MapBase& copy) {
62 registry->erase(*this);
64 registry = copy.registry;
77 registry->erase(*this);
88 Helper function to implement the default constructor in the subclasses.
91 virtual void init(Graph& g) {
93 for (KeyIt it(g); g.valid(it); g.next(it)) {
99 Helper function to implement the destructor in the subclasses.
102 virtual void destroy(Graph& g) {
103 for (KeyIt it(g); g.valid(it); g.next(it)) {
109 The add member function should be overloaded in the subclasses.
110 \e Add extends the map with the new node.
113 virtual void add(const KeyType&) = 0;
116 The erase member function should be overloaded in the subclasses.
117 \e Erase removes the node from the map.
120 virtual void erase(const KeyType&) = 0;
123 Exception class to throw at unsupported operation.
126 class NotSupportedOperationException {};