src/lemon/erasable_graph_extender.h
changeset 971 643d3192ebc8
child 980 0f1044b7a3af
equal deleted inserted replaced
-1:000000000000 0:29afd62f3936
       
     1 // -*- c++ -*-
       
     2 
       
     3 #ifndef LEMON_ERASABLE_GRAPH_EXTENDER_H
       
     4 #define LEMON_ERASABLE_GRAPH_EXTENDER_H
       
     5 
       
     6 #include <lemon/invalid.h>
       
     7 
       
     8 
       
     9 namespace lemon {
       
    10 
       
    11   template <typename _Base> 
       
    12   class ErasableGraphExtender : public _Base {
       
    13   public:
       
    14 
       
    15     typedef ErasableGraphExtender Graph;
       
    16     typedef _Base Parent;
       
    17 
       
    18     typedef typename Parent::Node Node;
       
    19     typedef typename Parent::Edge Edge;
       
    20 
       
    21     void erase(const Node& node) {
       
    22       Edge edge;
       
    23       Parent::firstOut(edge, node);
       
    24       while (edge != INVALID ) {
       
    25 	erase(edge);
       
    26 	Parent::firstOut(edge, node);
       
    27       } 
       
    28 
       
    29       Parent::firstIn(edge, node);
       
    30       while (edge != INVALID ) {
       
    31 	erase(edge);
       
    32 	Parent::firstIn(edge, node);
       
    33       }
       
    34 
       
    35       Parent::getNodeObserverRegistry().erase(node);
       
    36       Parent::erase(node);
       
    37     }
       
    38     
       
    39     void erase(const Edge& edge) {
       
    40       Parent::getEdgeObserverRegistry().erase(edge);
       
    41       Parent::erase(edge);
       
    42     }
       
    43 
       
    44   };
       
    45 
       
    46 }
       
    47 
       
    48 #endif