#include <CAVERNmisc_observer_c.hxx>
Inheritance diagram for CAVERNmisc_observer_c::
Public Methods | |
virtual | ~CAVERNmisc_observer_c () |
virtual void | update (CAVERNmisc_subject_c *)=0 |
Protected Methods | |
CAVERNmisc_observer_c () |
What is it for? The subject-observer design pattern is an object oriented alternative to callback functions. We can have multiple observers "watch" a single subject. An observer begins to watch a subject when the subject makes an "attach(&observer)" call. Everytime the subject calls its notify() method, all observers that are watching it will react by calling their update() method.
We do not instantiate the CAVERNmisc_subject_c and the CAVERNmisc_observer_c. Instead, the API user creates classes that inherit the properties of these two superclasses. The class that inherits the observer class properties should implement the update() method. The update method is a pure virtual function. Not implementing it would result in a compiler error.
@author: cavern@evl
@version: 12/1/99
|
This method is executed whenever a subject this observer is "watching" calls its notify() method. You can think of this as the equivalent of a callback function. This is a pure virtual function that should be implemented by classes that inherit from the observer.
Reimplemented in CAVERNdb_sharedState_c. |