src/lemon/extendable_graph_extender.h
author deba
Thu, 11 Nov 2004 10:17:20 +0000
changeset 981 2e34b796d532
parent 946 c94ef40a22ce
child 1022 567f392d1d2e
permissions -rw-r--r--
maxUndirEdgeId modified to maxId(UndirEdge)
maxEdgeId modified to maxId(Edge)
klao@946
     1
// -*- c++ -*-
klao@946
     2
klao@946
     3
#ifndef LEMON_EXTENDABLE_GRAPH_EXTENDER_H
klao@946
     4
#define LEMON_EXTENDABLE_GRAPH_EXTENDER_H
klao@946
     5
klao@946
     6
namespace lemon {
klao@946
     7
klao@946
     8
  template <typename _Base> 
klao@946
     9
  class ExtendableGraphExtender : public _Base {
klao@946
    10
  public:
klao@946
    11
klao@946
    12
    typedef ExtendableGraphExtender Graph;
klao@946
    13
    typedef _Base Parent;
klao@946
    14
klao@946
    15
    typedef typename Parent::Node Node;
klao@946
    16
    typedef typename Parent::Edge Edge;
klao@946
    17
klao@946
    18
    Node addNode() {
klao@946
    19
      Node node = Parent::addNode();
deba@980
    20
      Parent::getObserverRegistry(Node()).add(node);
klao@946
    21
      return node;
klao@946
    22
    }
klao@946
    23
    
klao@946
    24
    Edge addEdge(const Node& from, const Node& to) {
klao@946
    25
      Edge edge = Parent::addEdge(from, to);
deba@980
    26
      Parent::getObserverRegistry(Edge()).add(edge);
klao@946
    27
      return edge;
klao@946
    28
    }
klao@946
    29
klao@946
    30
  };
klao@946
    31
klao@946
    32
}
klao@946
    33
klao@946
    34
#endif