A bool Edge Map with iterators that goes through the true or the false edges.
1 #ifndef NODE_MAP_BASE_H
2 #define NODE_MAP_BASE_H
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 NodeMapRegistry class.
8 \param The second template parameter is the Node type of the class.
12 template <typename G, typename K>
23 NodeMapBase() : graph(0) {}
26 Simple constructor to register into a graph.
29 NodeMapBase(Graph& g) : graph(&g) {
30 graph->node_maps.add(*this);
34 Copy constructor with registering into the map.
37 NodeMapBase(const NodeMapBase& copy) : graph(copy.graph) {
39 graph->node_maps.add(*this);
47 const NodeMapBase& operator=(const NodeMapBase& copy) {
49 graph.node_maps.erase(*this);
53 graph->node_maps.add(*this);
63 virtual ~NodeMapBase() {
65 graph.node_maps.erase(*this);
76 Helper function to implement the default constructor in the subclasses.
80 for (Graph::NodeIt it(g); g.valid(it); g.next(it)) {
86 Helper function to implement the destructor in the subclasses.
90 for (Graph::NodeIt it(g); g.valid(it); g.next(it)) {
96 The add member function should be overloaded in the subclasses.
97 \e Add extends the map with the new node.
100 virtual void add(const KeyType&) = 0;
103 The erase member function should be overloaded in the subclasses.
104 \e Erase removes the node from the map.
107 virtual void erase(const KeyType&) = 0;
110 Exception class to throw at unsupported operation.
113 class NotSupportedOperationException {};