185 /// Copy Constructor of the AlterationNotifier. |
185 /// Copy Constructor of the AlterationNotifier. |
186 |
186 |
187 /// Copy constructor of the AlterationNotifier. |
187 /// Copy constructor of the AlterationNotifier. |
188 /// It creates only an empty registry because the copiable |
188 /// It creates only an empty registry because the copiable |
189 /// registry's observers have to be registered still into that registry. |
189 /// registry's observers have to be registered still into that registry. |
190 AlterationNotifier(const AlterationObserverRegistry&) {} |
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 registry only empty because the copiable |
196 /// registry's observers have to be registered still into that registry. |
196 /// registry's observers have to be registered still into that registry. |
197 AlterationNotifier& operator=(const AlterationObserverRegistry&) { |
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 } |
202 } |
202 } |
306 |
306 |
307 typedef typename Parent::Node Node; |
307 typedef typename Parent::Node Node; |
308 typedef typename Parent::Edge Edge; |
308 typedef typename Parent::Edge Edge; |
309 |
309 |
310 /// The edge observer registry. |
310 /// The edge observer registry. |
311 typedef AlterationNotifier<Edge> EdgeObserverRegistry; |
311 typedef AlterationNotifier<Edge> EdgeNotifier; |
312 /// The node observer registry. |
312 /// The node observer registry. |
313 typedef AlterationNotifier<Node> NodeObserverRegistry; |
313 typedef AlterationNotifier<Node> NodeNotifier; |
314 |
314 |
315 |
315 |
316 protected: |
316 protected: |
317 |
317 |
318 mutable EdgeNotifier edge_observers; |
318 mutable EdgeNotifier edge_observers; |
319 |
319 |
320 mutable NodeNotifier node_observers; |
320 mutable NodeNotifier node_observers; |
321 |
321 |
322 public: |
322 public: |
323 |
323 |
324 EdgeNotifier& getObserverRegistry(Edge = INVALID) const { |
324 EdgeNotifier& getNotifier(Edge = INVALID) const { |
325 return edge_observers; |
325 return edge_observers; |
326 } |
326 } |
327 |
327 |
328 NodeNotifier& getObserverRegistry(Node = INVALID) const { |
328 NodeNotifier& getNotifier(Node = INVALID) const { |
329 return node_observers; |
329 return node_observers; |
330 } |
330 } |
331 |
331 |
332 ~AlterableGraphExtender() { |
332 ~AlterableGraphExtender() { |
333 node_observers.clear(); |
333 node_observers.clear(); |
356 typedef AlterableGraphExtender<_Base> Parent; |
356 typedef AlterableGraphExtender<_Base> Parent; |
357 |
357 |
358 typedef typename Parent::UndirEdge UndirEdge; |
358 typedef typename Parent::UndirEdge UndirEdge; |
359 |
359 |
360 /// The edge observer registry. |
360 /// The edge observer registry. |
361 typedef AlterationNotifier<UndirEdge> UndirEdgeObserverRegistry; |
361 typedef AlterationNotifier<UndirEdge> UndirEdgeNotifier; |
362 |
362 |
363 protected: |
363 protected: |
364 |
364 |
365 mutable UndirEdgeNotifier undir_edge_observers; |
365 mutable UndirEdgeNotifier undir_edge_observers; |
366 |
366 |
367 public: |
367 public: |
368 |
368 |
369 using Parent::getNotifier; |
369 using Parent::getNotifier; |
370 UndirEdgeNotifier& getObserverRegistry(UndirEdge) const { |
370 UndirEdgeNotifier& getNotifier(UndirEdge) const { |
371 return undir_edge_observers; |
371 return undir_edge_observers; |
372 } |
372 } |
373 |
373 |
374 ~AlterableUndirGraphExtender() { |
374 ~AlterableUndirGraphExtender() { |
375 undir_edge_observers.clear(); |
375 undir_edge_observers.clear(); |