src/lemon/alteration_notifier.h
changeset 1114 eb57527fd183
parent 1039 bd01c5a3f989
child 1134 56b07afdbf8d
equal deleted inserted replaced
0:4f203b951ab6 1:c62cb053a948
   190     AlterationNotifier(const AlterationNotifier&) {}
   190     AlterationNotifier(const AlterationNotifier&) {}
   191 
   191 
   192     /// Assign operator.
   192     /// Assign operator.
   193 		
   193 		
   194     /// Assign operator for the AlterationNotifier. 
   194     /// Assign operator for the AlterationNotifier. 
   195     /// It makes the registry only empty because the copiable
   195     /// It makes the notifier only empty because the copiable
   196     /// registry's observers have to be registered still into that registry.
   196     /// notifier's observers have to be registered still into that registry.
   197     AlterationNotifier& operator=(const AlterationNotifier&) {
   197     AlterationNotifier& operator=(const AlterationNotifier&) {
   198       typename Container::iterator it;
   198       typename Container::iterator it;
   199       for (it = container.begin(); it != container.end(); ++it) {
   199       for (it = container.begin(); it != container.end(); ++it) {
   200 	(*it)->registry = 0;
   200 	(*it)->registry = 0;
   201       }
   201       }
   313     typedef AlterationNotifier<Node> NodeNotifier;
   313     typedef AlterationNotifier<Node> NodeNotifier;
   314 
   314 
   315 
   315 
   316   protected:
   316   protected:
   317 
   317 
   318     mutable EdgeNotifier edge_observers;
   318     mutable EdgeNotifier edge_notifier;
   319 
   319 
   320     mutable NodeNotifier node_observers;
   320     mutable NodeNotifier node_notifier;
   321 
   321 
   322   public:
   322   public:
   323 
   323 
   324     EdgeNotifier& getNotifier(Edge = INVALID) const {
   324     EdgeNotifier& getNotifier(Edge = INVALID) const {
   325       return edge_observers;
   325       return edge_notifier;
   326     }
   326     }
   327 
   327 
   328     NodeNotifier& getNotifier(Node = INVALID) const {
   328     NodeNotifier& getNotifier(Node = INVALID) const {
   329       return node_observers;
   329       return node_notifier;
   330     }
   330     }
   331 
   331 
   332     ~AlterableGraphExtender() {
   332     ~AlterableGraphExtender() {
   333       node_observers.clear();
   333       node_notifier.clear();
   334       edge_observers.clear();
   334       edge_notifier.clear();
   335     }
   335     }
   336     
   336     
   337   };
   337   };
   338 
   338 
   339   /// \brief Class to extend an undirected graph with the functionality of
   339   /// \brief Class to extend an undirected graph with the functionality of
   360     /// The edge observer registry.
   360     /// The edge observer registry.
   361     typedef AlterationNotifier<UndirEdge> UndirEdgeNotifier;
   361     typedef AlterationNotifier<UndirEdge> UndirEdgeNotifier;
   362 
   362 
   363   protected:
   363   protected:
   364 
   364 
   365     mutable UndirEdgeNotifier undir_edge_observers;
   365     mutable UndirEdgeNotifier undir_edge_notifier;
   366 
   366 
   367   public:
   367   public:
   368 
   368 
   369     using Parent::getNotifier;
   369     using Parent::getNotifier;
   370     UndirEdgeNotifier& getNotifier(UndirEdge) const {
   370     UndirEdgeNotifier& getNotifier(UndirEdge) const {
   371       return undir_edge_observers;
   371       return undir_edge_notifier;
   372     }
   372     }
   373 
   373 
   374     ~AlterableUndirGraphExtender() {
   374     ~AlterableUndirGraphExtender() {
   375       undir_edge_observers.clear();
   375       undir_edge_notifier.clear();
   376     }
   376     }
   377   };
   377   };
   378   
   378   
   379 /// @}
   379 /// @}
   380   
   380