# HG changeset patch # User deba # Date 1103199302 0 # Node ID ca63ec3424d8e1ddf6969c1f0f9053fff6dfe638 # Parent 3eaff8d041714b3a31fd43ed8be9aeed42e750ba Renaming AlterationObserverRegistry -> AlterationNotifier first step diff -r 3eaff8d04171 -r ca63ec3424d8 src/lemon/alteration_observer_registry.h --- a/src/lemon/alteration_observer_registry.h Wed Dec 15 19:56:55 2004 +0000 +++ b/src/lemon/alteration_observer_registry.h Thu Dec 16 12:15:02 2004 +0000 @@ -1,5 +1,5 @@ /* -*- C++ -*- - * src/lemon/observer_registry.h - Part of LEMON, a generic C++ optimization library + * src/lemon/notifier.h - Part of LEMON, a generic C++ optimization library * * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport * (Egervary Combinatorial Optimization Research Group, EGRES). @@ -36,7 +36,7 @@ /// This class is a registry for the objects which observe the /// alterations in a container. The alteration observers can be attached /// to and detached from the registry. The observers have to inherit - /// from the \ref AlterationObserverRegistry::ObserverBase and override + /// from the \ref AlterationNotifier::ObserverBase and override /// the virtual functions in that. /// /// The most important application of the alteration observing is the @@ -49,7 +49,7 @@ /// \author Balazs Dezso template - class AlterationObserverRegistry { + class AlterationNotifier { public: typedef _Item Item; @@ -72,9 +72,9 @@ class ObserverBase { protected: - typedef AlterationObserverRegistry Registry; + typedef AlterationNotifier Registry; - friend class AlterationObserverRegistry; + friend class AlterationNotifier; /// Default constructor. @@ -84,18 +84,18 @@ virtual ~ObserverBase() {} - /// Attaches the observer into an AlterationObserverRegistry. + /// Attaches the observer into an AlterationNotifier. - /// This member attaches the observer into an AlterationObserverRegistry. + /// This member attaches the observer into an AlterationNotifier. /// - void attach(AlterationObserverRegistry& r) { + void attach(AlterationNotifier& r) { registry = &r; registry->attach(*this); } - /// Detaches the observer into an AlterationObserverRegistry. + /// Detaches the observer into an AlterationNotifier. - /// This member detaches the observer from an AlterationObserverRegistry. + /// This member detaches the observer from an AlterationNotifier. /// void detach() { if (registry) { @@ -178,23 +178,23 @@ /// Default constructor. /// - /// The default constructor of the AlterationObserverRegistry. + /// The default constructor of the AlterationNotifier. /// It creates an empty registry. - AlterationObserverRegistry() {} + AlterationNotifier() {} - /// Copy Constructor of the AlterationObserverRegistry. + /// Copy Constructor of the AlterationNotifier. - /// Copy constructor of the AlterationObserverRegistry. + /// Copy constructor of the AlterationNotifier. /// It creates only an empty registry because the copiable /// registry's observers have to be registered still into that registry. - AlterationObserverRegistry(const AlterationObserverRegistry&) {} + AlterationNotifier(const AlterationObserverRegistry&) {} /// Assign operator. - /// Assign operator for the AlterationObserverRegistry. + /// Assign operator for the AlterationNotifier. /// It makes the registry only empty because the copiable /// registry's observers have to be registered still into that registry. - AlterationObserverRegistry& operator=(const AlterationObserverRegistry&) { + AlterationNotifier& operator=(const AlterationObserverRegistry&) { typename Container::iterator it; for (it = container.begin(); it != container.end(); ++it) { (*it)->registry = 0; @@ -203,9 +203,9 @@ /// Destructor. - /// Destructor of the AlterationObserverRegistry. + /// Destructor of the AlterationNotifier. /// - ~AlterationObserverRegistry() { + ~AlterationNotifier() { typename Container::iterator it; for (it = container.begin(); it != container.end(); ++it) { (*it)->registry = 0; @@ -308,24 +308,24 @@ typedef typename Parent::Edge Edge; /// The edge observer registry. - typedef AlterationObserverRegistry EdgeObserverRegistry; + typedef AlterationNotifier EdgeObserverRegistry; /// The node observer registry. - typedef AlterationObserverRegistry NodeObserverRegistry; + typedef AlterationNotifier NodeObserverRegistry; protected: - mutable EdgeObserverRegistry edge_observers; + mutable EdgeNotifier edge_observers; - mutable NodeObserverRegistry node_observers; + mutable NodeNotifier node_observers; public: - EdgeObserverRegistry& getObserverRegistry(Edge = INVALID) const { + EdgeNotifier& getObserverRegistry(Edge = INVALID) const { return edge_observers; } - NodeObserverRegistry& getObserverRegistry(Node = INVALID) const { + NodeNotifier& getObserverRegistry(Node = INVALID) const { return node_observers; } @@ -358,16 +358,16 @@ typedef typename Parent::UndirEdge UndirEdge; /// The edge observer registry. - typedef AlterationObserverRegistry UndirEdgeObserverRegistry; + typedef AlterationNotifier UndirEdgeObserverRegistry; protected: - mutable UndirEdgeObserverRegistry undir_edge_observers; + mutable UndirEdgeNotifier undir_edge_observers; public: - using Parent::getObserverRegistry; - UndirEdgeObserverRegistry& getObserverRegistry(UndirEdge) const { + using Parent::getNotifier; + UndirEdgeNotifier& getObserverRegistry(UndirEdge) const { return undir_edge_observers; }