author | alpar |
Mon, 01 Nov 2004 17:57:19 +0000 | |
changeset 953 | d9c115e2eeaf |
child 980 | 0f1044b7a3af |
permissions | -rw-r--r-- |
klao@946 | 1 |
// -*- c++ -*- |
klao@946 | 2 |
|
klao@946 | 3 |
#ifndef LEMON_ERASABLE_GRAPH_EXTENDER_H |
klao@946 | 4 |
#define LEMON_ERASABLE_GRAPH_EXTENDER_H |
klao@946 | 5 |
|
klao@946 | 6 |
#include <lemon/invalid.h> |
klao@946 | 7 |
|
klao@946 | 8 |
|
klao@946 | 9 |
namespace lemon { |
klao@946 | 10 |
|
klao@946 | 11 |
template <typename _Base> |
klao@946 | 12 |
class ErasableGraphExtender : public _Base { |
klao@946 | 13 |
public: |
klao@946 | 14 |
|
klao@946 | 15 |
typedef ErasableGraphExtender Graph; |
klao@946 | 16 |
typedef _Base Parent; |
klao@946 | 17 |
|
klao@946 | 18 |
typedef typename Parent::Node Node; |
klao@946 | 19 |
typedef typename Parent::Edge Edge; |
klao@946 | 20 |
|
klao@946 | 21 |
void erase(const Node& node) { |
klao@946 | 22 |
Edge edge; |
klao@946 | 23 |
Parent::firstOut(edge, node); |
klao@946 | 24 |
while (edge != INVALID ) { |
klao@946 | 25 |
erase(edge); |
klao@946 | 26 |
Parent::firstOut(edge, node); |
klao@946 | 27 |
} |
klao@946 | 28 |
|
klao@946 | 29 |
Parent::firstIn(edge, node); |
klao@946 | 30 |
while (edge != INVALID ) { |
klao@946 | 31 |
erase(edge); |
klao@946 | 32 |
Parent::firstIn(edge, node); |
klao@946 | 33 |
} |
klao@946 | 34 |
|
klao@946 | 35 |
Parent::getNodeObserverRegistry().erase(node); |
klao@946 | 36 |
Parent::erase(node); |
klao@946 | 37 |
} |
klao@946 | 38 |
|
klao@946 | 39 |
void erase(const Edge& edge) { |
klao@946 | 40 |
Parent::getEdgeObserverRegistry().erase(edge); |
klao@946 | 41 |
Parent::erase(edge); |
klao@946 | 42 |
} |
klao@946 | 43 |
|
klao@946 | 44 |
}; |
klao@946 | 45 |
|
klao@946 | 46 |
} |
klao@946 | 47 |
|
klao@946 | 48 |
#endif |