src/work/deba/node_map_registry.h
changeset 356 b4dcbe3e3b8f
parent 337 6e1b7efa577f
child 377 33fe0ee01dc5
equal deleted inserted replaced
0:c961085a8651 1:3db709c48c70
     1 #ifndef NODE_MAP_REGISTRY_H
     1 #ifndef NODE_MAP_REGISTRY_H
     2 #define NODE_MAP_REGISTRY_H
     2 #define NODE_MAP_REGISTRY_H
     3 
     3 
     4 #include <vector>
     4 #include <vector>
       
     5 
       
     6 #include "node_map_base.h"
     5 
     7 
     6 template <typename G, typename E>
     8 template <typename G, typename E>
     7 class NodeMapRegistry {
     9 class NodeMapRegistry {
     8 public:
    10 public:
     9 	typedef G Graph;
    11 	typedef G Graph;
    31 		container[map_base.graph_index] = container.back();
    33 		container[map_base.graph_index] = container.back();
    32 		container.pop_back();
    34 		container.pop_back();
    33 		map_base.graph = 0;
    35 		map_base.graph = 0;
    34 	}
    36 	}
    35 	
    37 	
    36 	void addNode(Node& node) {
    38 	void add(Node& node) {
    37 		typename Container::iterator it;
    39 		typename Container::iterator it;
    38 		for (it = container.begin(); it != container.end(); ++it) {
    40 		for (it = container.begin(); it != container.end(); ++it) {
    39 			(*it)->add(node);
    41 			(*it)->add(node);
    40 		}
    42 		}
    41 	}
    43 	}
    42 	
    44 	
    43 	void eraseNode(Node& node) {
    45 	void erase(Node& node) {
    44 		typename Container::iterator it;
    46 		typename Container::iterator it;
    45 		for (it = container.begin(); it != container.end(); ++it) {
    47 		for (it = container.begin(); it != container.end(); ++it) {
    46 			(*it)->erase(node);
    48 			(*it)->erase(node);
    47 		}
    49 		}
    48 	}
    50 	}