COIN-OR::LEMON - Graph Library

source: lemon-0.x/src/lemon/extendable_graph_extender.h @ 1021:fd1d073b6557

Last change on this file since 1021:fd1d073b6557 was 980:0f1044b7a3af, checked in by Balazs Dezso, 16 years ago

maxNodeId() and maxEdgeId() changed to maxId(Node) and maxId(Edge)
getNodeObserverRegistry() and getEdgeObserverRegistry() changed to
getObserverRegistry(Node) and getObserverRegistry(Edge)

IdMappableGraphExtender? erased

File size: 694 bytes
Line 
1// -*- c++ -*-
2
3#ifndef LEMON_EXTENDABLE_GRAPH_EXTENDER_H
4#define LEMON_EXTENDABLE_GRAPH_EXTENDER_H
5
6namespace lemon {
7
8  template <typename _Base>
9  class ExtendableGraphExtender : public _Base {
10  public:
11
12    typedef ExtendableGraphExtender Graph;
13    typedef _Base Parent;
14
15    typedef typename Parent::Node Node;
16    typedef typename Parent::Edge Edge;
17
18    Node addNode() {
19      Node node = Parent::addNode();
20      Parent::getObserverRegistry(Node()).add(node);
21      return node;
22    }
23   
24    Edge addEdge(const Node& from, const Node& to) {
25      Edge edge = Parent::addEdge(from, to);
26      Parent::getObserverRegistry(Edge()).add(edge);
27      return edge;
28    }
29
30  };
31
32}
33
34#endif
Note: See TracBrowser for help on using the repository browser.