1.1 --- a/lemon/graph_utils.h Mon Mar 06 09:38:19 2006 +0000
1.2 +++ b/lemon/graph_utils.h Mon Mar 06 10:28:37 2006 +0000
1.3 @@ -1189,8 +1189,8 @@
1.4 virtual void build() {
1.5 Map::build();
1.6 Item it;
1.7 - const typename Map::Graph* graph = Map::getGraph();
1.8 - for (graph->first(it); it != INVALID; graph->next(it)) {
1.9 + const typename Map::Notifier* notifier = Map::getNotifier();
1.10 + for (notifier->first(it); it != INVALID; notifier->next(it)) {
1.11 Map::set(it, invMap.size());
1.12 invMap.push_back(it);
1.13 }
1.14 @@ -1497,7 +1497,8 @@
1.15
1.16 template <typename _Graph>
1.17 class InDegMap
1.18 - : protected AlterationNotifier<typename _Graph::Edge>::ObserverBase {
1.19 + : protected ItemSetTraits<_Graph, typename _Graph::Edge>
1.20 + ::ItemNotifier::ObserverBase {
1.21
1.22 public:
1.23
1.24 @@ -1505,6 +1506,9 @@
1.25 typedef int Value;
1.26 typedef typename Graph::Node Key;
1.27
1.28 + typedef typename ItemSetTraits<_Graph, typename _Graph::Edge>
1.29 + ::ItemNotifier::ObserverBase Parent;
1.30 +
1.31 private:
1.32
1.33 class AutoNodeMap : public DefaultMap<_Graph, Key, int> {
1.34 @@ -1533,18 +1537,12 @@
1.35 ///
1.36 /// Constructor for creating in-degree map.
1.37 InDegMap(const Graph& _graph) : graph(_graph), deg(_graph) {
1.38 - AlterationNotifier<typename _Graph::Edge>
1.39 - ::ObserverBase::attach(graph.getNotifier(typename _Graph::Edge()));
1.40 + Parent::attach(graph.getNotifier(typename _Graph::Edge()));
1.41
1.42 for(typename _Graph::NodeIt it(graph); it != INVALID; ++it) {
1.43 deg[it] = countInEdges(graph, it);
1.44 }
1.45 }
1.46 -
1.47 - virtual ~InDegMap() {
1.48 - AlterationNotifier<typename _Graph::Edge>::
1.49 - ObserverBase::detach();
1.50 - }
1.51
1.52 /// Gives back the in-degree of a Node.
1.53 int operator[](const Key& key) const {
1.54 @@ -1611,9 +1609,13 @@
1.55
1.56 template <typename _Graph>
1.57 class OutDegMap
1.58 - : protected AlterationNotifier<typename _Graph::Edge>::ObserverBase {
1.59 + : protected ItemSetTraits<_Graph, typename _Graph::Edge>
1.60 + ::ItemNotifier::ObserverBase {
1.61
1.62 public:
1.63 +
1.64 + typedef typename ItemSetTraits<_Graph, typename _Graph::Edge>
1.65 + ::ItemNotifier::ObserverBase Parent;
1.66
1.67 typedef _Graph Graph;
1.68 typedef int Value;
1.69 @@ -1646,19 +1648,13 @@
1.70 ///
1.71 /// Constructor for creating out-degree map.
1.72 OutDegMap(const Graph& _graph) : graph(_graph), deg(_graph) {
1.73 - AlterationNotifier<typename _Graph::Edge>
1.74 - ::ObserverBase::attach(graph.getNotifier(typename _Graph::Edge()));
1.75 + Parent::attach(graph.getNotifier(typename _Graph::Edge()));
1.76
1.77 for(typename _Graph::NodeIt it(graph); it != INVALID; ++it) {
1.78 deg[it] = countOutEdges(graph, it);
1.79 }
1.80 }
1.81
1.82 - virtual ~OutDegMap() {
1.83 - AlterationNotifier<typename _Graph::Edge>::
1.84 - ObserverBase::detach();
1.85 - }
1.86 -
1.87 /// Gives back the out-degree of a Node.
1.88 int operator[](const Key& key) const {
1.89 return deg[key];