11     Registry class to register edge or node maps in the graph. The
 
    12     registry helps you to implement an observer pattern. If you add
 
    13     or erase an edge or node you must notify all the maps about the
 
    16   template <typename G, typename K, typename KIt>
 
    32       typedef MapRegistry<G, K, KIt> Registry;
 
    36       friend class Registry;
 
    42       MapBase() : graph(0), registry(0) {}
 
    45 	  Simple constructor to register into a graph registry.
 
    48       MapBase(Graph& g, Registry& r) : graph(&g), registry(0) {
 
    53 	  Copy constructor with registering into the map.
 
    56       MapBase(const MapBase& copy) : registry(0), graph(copy.graph) {
 
    58 	  copy.registry->attach(*this);
 
    66       const MapBase& operator=(const MapBase& copy) {
 
    68 	  registry->detach(*this);
 
    72 	  copy.registry->attach(*this);
 
    83 	  registry->detach(*this);
 
    95 	 Helper function to implement constructors in the subclasses.
 
    99 	for (KeyIt it(*graph); graph->valid(it); graph->next(it)) {
 
   105 	 Helper function to implement the destructor in the subclasses.
 
   108       virtual void destroy() {
 
   109 	for (KeyIt it(*graph); graph->valid(it); graph->next(it)) {
 
   115 	  The add member function should be overloaded in the subclasses.
 
   116 	  \e Add extends the map with the new node.
 
   119       virtual void add(const Key&) = 0;	
 
   121 	  The erase member function should be overloaded in the subclasses.
 
   122 	  \e Erase removes the node from the map.
 
   125       virtual void erase(const Key&) = 0;
 
   128 	 Exception class to throw at unsupported operation.
 
   131       class NotSupportedOperationException {};
 
   137     typedef std::vector<MapBase*> Container; 
 
   147     MapRegistry(const MapRegistry&) {}
 
   150     MapRegistry& operator=(const MapRegistry&) {
 
   151       for (it = container.begin(); it != container.end(); ++it) {
 
   160       typename Container::iterator it;
 
   161       for (it = container.begin(); it != container.end(); ++it) {
 
   172     void attach(MapBase& map) {
 
   174 	map.registry->detach(map);
 
   176       container.push_back(&map);
 
   178       map.registry_index = container.size()-1;
 
   182     void detach(MapBase& map) {
 
   183       container.back()->registry_index = map.registry_index; 
 
   184       container[map.registry_index] = container.back();
 
   185       container.pop_back();
 
   192     virtual void add(Key& key) {
 
   193       typename Container::iterator it;
 
   194       for (it = container.begin(); it != container.end(); ++it) {
 
   200     virtual void erase(Key& key) {
 
   201       typename Container::iterator it;
 
   202       for (it = container.begin(); it != container.end(); ++it) {