src/lemon/extendable_graph_extender.h
changeset 1038 ca63ec3424d8
parent 980 0f1044b7a3af
child 1039 bd01c5a3f989
equal deleted inserted replaced
1:74f73b02b2c8 2:827750583197
    27       return edge;
    27       return edge;
    28     }
    28     }
    29 
    29 
    30   };
    30   };
    31 
    31 
       
    32   template <typename _Base> 
       
    33   class ExtendableUndirGraphExtender : public _Base {
       
    34   public:
       
    35 
       
    36     typedef ExtendableUndirGraphExtender Graph;
       
    37     typedef _Base Parent;
       
    38 
       
    39     typedef typename Parent::Node Node;
       
    40     typedef typename Parent::Edge Edge;
       
    41     typedef typename Parent::UndirEdge UndirEdge;
       
    42 
       
    43     Node addNode() {
       
    44       Node node = Parent::addNode();
       
    45       Parent::getObserverRegistry(Node()).add(node);
       
    46       return node;
       
    47     }
       
    48 
       
    49     UndirEdge addEdge(const Node& from, const Node& to) {
       
    50       UndirEdge uedge = Parent::addEdge(from, to);
       
    51       Parent::getObserverRegistry(UndirEdge()).add(uedge);
       
    52 
       
    53       Edge edge_forward(uedge, true);
       
    54       Edge edge_backward(uedge, false);
       
    55       Parent::getObserverRegistry(Edge()).add(edge_forward);
       
    56       Parent::getObserverRegistry(Edge()).add(edge_backward);
       
    57 
       
    58       return uedge;
       
    59     }
       
    60 
       
    61   };
       
    62 
    32 }
    63 }
    33 
    64 
    34 #endif
    65 #endif