- Make set_notify_enabled() methods of Simulation and History private to enforce encapsulation further (so that derived classes don't fall in temptation...)

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1171 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-09-15 09:48:58 +00:00
parent 83b655496f
commit 4080de9f5b
2 changed files with 12 additions and 8 deletions

View File

@ -146,6 +146,9 @@ namespace sgpem
void notify_change(); void notify_change();
position _front;
private:
/** \brief Enable/disable notifications to registered observers /** \brief Enable/disable notifications to registered observers
* *
* This is quite useful to disable momentarily notification while you * This is quite useful to disable momentarily notification while you
@ -156,9 +159,6 @@ namespace sgpem
*/ */
bool set_notify_enabled(bool enabled = true); bool set_notify_enabled(bool enabled = true);
position _front;
private:
bool _notify; bool _notify;
}; //~ class History }; //~ class History
@ -169,6 +169,8 @@ namespace sgpem
* History that would reset it / notify its observers. For example, when loading * History that would reset it / notify its observers. For example, when loading
* from a file. In this case, create an object of this type on the stack. * from a file. In this case, create an object of this type on the stack.
* The destructor will take care of re-enabling notifications. * The destructor will take care of re-enabling notifications.
*
* Locks can be taken recursively without fear.
*/ */
class SG_DLLEXPORT History::LockNotify class SG_DLLEXPORT History::LockNotify
{ {

View File

@ -177,6 +177,11 @@ namespace sgpem
typedef std::vector<SimulationObserver*> RegisteredObservers; typedef std::vector<SimulationObserver*> RegisteredObservers;
RegisteredObservers _observers; RegisteredObservers _observers;
Simulation(); // Constructor
void notify_change();
private:
/** \brief Enable/disable notifications to registered observers /** \brief Enable/disable notifications to registered observers
* *
* This is quite useful to disable momentarily notification while you * This is quite useful to disable momentarily notification while you
@ -187,11 +192,6 @@ namespace sgpem
*/ */
bool set_notify_enabled(bool enabled = true); bool set_notify_enabled(bool enabled = true);
Simulation(); // Constructor
void notify_change();
private:
bool _notify; bool _notify;
}; //~ class Simulation }; //~ class Simulation
@ -201,6 +201,8 @@ namespace sgpem
* Simulation that would reset it / notify its observers. For example, when loading * Simulation that would reset it / notify its observers. For example, when loading
* from a file. In this case, create an object of this type on the stack. * from a file. In this case, create an object of this type on the stack.
* The destructor will take care of re-enabling notifications. * The destructor will take care of re-enabling notifications.
*
* Locks can be taken recursively without fear.
*/ */
class SG_DLLEXPORT Simulation::LockNotify class SG_DLLEXPORT Simulation::LockNotify
{ {