author | deba |
Thu, 11 Nov 2004 10:17:20 +0000 | |
changeset 981 | 2e34b796d532 |
parent 946 | c94ef40a22ce |
child 1022 | 567f392d1d2e |
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 |
|
deba@980 | 35 |
Parent::getObserverRegistry(Node()).erase(node); |
klao@946 | 36 |
Parent::erase(node); |
klao@946 | 37 |
} |
klao@946 | 38 |
|
klao@946 | 39 |
void erase(const Edge& edge) { |
deba@980 | 40 |
Parent::getObserverRegistry(Edge()).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 |