lemon/graph_adaptor.h
changeset 2000 ebcc93ead7da
parent 1993 2115143eceea
child 2031 080d51024ac5
equal deleted inserted replaced
28:6670356e3434 29:b68e9139ddbe
    28 ///\author Marton Makai
    28 ///\author Marton Makai
    29 
    29 
    30 #include <lemon/bits/invalid.h>
    30 #include <lemon/bits/invalid.h>
    31 #include <lemon/maps.h>
    31 #include <lemon/maps.h>
    32 
    32 
       
    33 #include <lemon/bits/base_extender.h>
    33 #include <lemon/bits/graph_adaptor_extender.h>
    34 #include <lemon/bits/graph_adaptor_extender.h>
    34 #include <lemon/bits/graph_extender.h>
    35 #include <lemon/bits/graph_extender.h>
    35 
    36 
    36 #include <iostream>
    37 #include <iostream>
    37 
    38 
   935     typedef UGraphBaseExtender<GraphAdaptorBase<_Graph> > Parent;
   936     typedef UGraphBaseExtender<GraphAdaptorBase<_Graph> > Parent;
   936 
   937 
   937   protected:
   938   protected:
   938 
   939 
   939     UndirGraphAdaptorBase() 
   940     UndirGraphAdaptorBase() 
   940       : Parent(), edge_notifier(), edge_notifier_proxy(edge_notifier) {}
   941       : edge_notifier(*this), edge_notifier_proxy(edge_notifier) {}
   941 
   942 
   942     void setGraph(_Graph& graph) {
   943     void setGraph(_Graph& graph) {
   943       Parent::setGraph(graph);
   944       Parent::setGraph(graph);
   944       edge_notifier_proxy.setUEdgeNotifier(graph.getNotifier(UEdge()));
   945       edge_notifier_proxy.setUEdgeNotifier(graph.getNotifier(UEdge()));
   945     }
   946     }
   946 
   947 
   947   public:
   948   public:
   948 
   949 
   949     ~UndirGraphAdaptorBase() {
   950     ~UndirGraphAdaptorBase() {
   950       getNotifier(Edge()).clear();
   951       edge_notifier.clear();
       
   952     }
       
   953 
       
   954     int maxId(typename Parent::Edge) const {
       
   955       return Parent::maxEdgeId();
   951     }
   956     }
   952 
   957 
   953 
   958 
   954     typedef typename Parent::UEdge UEdge;
   959     typedef typename Parent::UEdge UEdge;
   955     typedef typename Parent::Edge Edge;
   960     typedef typename Parent::Edge Edge;
   956 
   961 
   957     typedef typename Parent::EdgeNotifier UEdgeNotifier;
   962     typedef typename Parent::EdgeNotifier UEdgeNotifier;
   958 
   963 
   959     using Parent::getNotifier;
   964     using Parent::getNotifier;
   960 
   965 
   961     typedef AlterationNotifier<Edge> EdgeNotifier;
   966     typedef AlterationNotifier<UndirGraphAdaptorBase, Edge> EdgeNotifier;
   962     EdgeNotifier& getNotifier(Edge) const { return edge_notifier; }
   967     EdgeNotifier& getNotifier(Edge) const { return edge_notifier; }
   963 
   968 
   964   protected:
   969   protected:
   965 
   970 
   966     class NotifierProxy : public UEdgeNotifier::ObserverBase {
   971     class NotifierProxy : public UEdgeNotifier::ObserverBase {