lemon/bits/extendable_graph_extender.h
changeset 1870 b9c9b52f839e
parent 1820 22099ef840d7
child 1909 2d806130e700
equal deleted inserted replaced
2:6b95b36854e8 3:e7ec3e2d85bc
    28     }
    28     }
    29 
    29 
    30   };
    30   };
    31 
    31 
    32   template <typename _Base> 
    32   template <typename _Base> 
       
    33   class ExtendableEdgeSetExtender : public _Base {
       
    34   public:
       
    35 
       
    36     typedef ExtendableEdgeSetExtender Graph;
       
    37     typedef _Base Parent;
       
    38 
       
    39     typedef typename Parent::Edge Edge;
       
    40     typedef typename Parent::Node Node;
       
    41 
       
    42     Edge addEdge(const Node& from, const Node& to) {
       
    43       Edge edge = Parent::addEdge(from, to);
       
    44       Parent::getNotifier(Edge()).add(edge);
       
    45       return edge;
       
    46     }
       
    47 
       
    48   };
       
    49 
       
    50   template <typename _Base> 
    33   class ExtendableUndirGraphExtender : public _Base {
    51   class ExtendableUndirGraphExtender : public _Base {
    34   public:
    52   public:
    35 
    53 
    36     typedef ExtendableUndirGraphExtender Graph;
    54     typedef ExtendableUndirGraphExtender Graph;
    37     typedef _Base Parent;
    55     typedef _Base Parent;
    43     Node addNode() {
    61     Node addNode() {
    44       Node node = Parent::addNode();
    62       Node node = Parent::addNode();
    45       Parent::getNotifier(Node()).add(node);
    63       Parent::getNotifier(Node()).add(node);
    46       return node;
    64       return node;
    47     }
    65     }
       
    66 
       
    67     UndirEdge addEdge(const Node& from, const Node& to) {
       
    68       UndirEdge uedge = Parent::addEdge(from, to);
       
    69       Parent::getNotifier(UndirEdge()).add(uedge);
       
    70 
       
    71       std::vector<Edge> edges;
       
    72       edges.push_back(Parent::direct(uedge, true));
       
    73       edges.push_back(Parent::direct(uedge, false));
       
    74       Parent::getNotifier(Edge()).add(edges);
       
    75 
       
    76       return uedge;
       
    77     }
       
    78 
       
    79   };
       
    80 
       
    81   template <typename _Base> 
       
    82   class ExtendableUndirEdgeSetExtender : public _Base {
       
    83   public:
       
    84 
       
    85     typedef ExtendableUndirEdgeSetExtender Graph;
       
    86     typedef _Base Parent;
       
    87 
       
    88     typedef typename Parent::Node Node;
       
    89     typedef typename Parent::Edge Edge;
       
    90     typedef typename Parent::UndirEdge UndirEdge;
    48 
    91 
    49     UndirEdge addEdge(const Node& from, const Node& to) {
    92     UndirEdge addEdge(const Node& from, const Node& to) {
    50       UndirEdge uedge = Parent::addEdge(from, to);
    93       UndirEdge uedge = Parent::addEdge(from, to);
    51       Parent::getNotifier(UndirEdge()).add(uedge);
    94       Parent::getNotifier(UndirEdge()).add(uedge);
    52 
    95