VWLib REFERENCE MANUAL


NAME
vwObserver - An abstract base class for vwLib. vwObserver is the observer component of the Observer Pattern in this library. Some widgets inherit from this class so that they can act as both subjects and observers.

HEADER FILE
#include <dependents.h>

PUBLIC METHOD SUMMARY
virtual vwObserver::~vwObserver ( void);
virtual void vwObserver::update ( vwSubject * callingSubject, void * data) = 0;

PROTECTED METHOD SUMMARY
vwObserver::vwObserver ( vwMediator *concreteMediator);

CLASS DESCRIPTION
vwObserver is the abstract observer class of the Observer Pattern on which this library is based. In congruence with a Mediator Pattern concrete mediator who's abstract class is vwMediator, vwObserver facilitates event propagation from widgets to itself as a concrete observer. While all widgets in this library are vwSubjects, some widgets also publicly inherit from vwObserver making them capable of acting as both subject and observer by generating events through vwSubject::notify(), and receiving events through vwObserver::update().

METHOD DESCRIPTIONS

   vwObserver() [Protected]
vwObserver ( vwMediator *concreteMediator);

Construct a vwObserver.

*concreteMediator specifies a pointer to the concrete mediator of the Mediator Pattern. The concrete mediator inherits publicly from the abstract class vwMediator.

   ~vwObserver()
virtual ~vwObserver ( void);

Destruct an instance. The destructor removes its reference from all subject lists maintained by the concrete mediator.

   update()
virtual void update ( vwSubject * callingSubject, void * data) = 0;

A pure virtual method in vwObserver, and therefore must be defined in concrete observers. If a concrete observer is attached to a particular concrete subject, update() is called whenever the subject generates an event by calling notify().

*callingSubject specifies a pointer to the vwSubject that initiated the update.

*data specifies a pointer to widget or user data that can be deceminated by the concrete observer. An update() originating from many widgets (e.g., vwSlider) will use *data to point to their updated 'value.'

 SEE ALSO
vwSubject, vwMediator

vrmedlab.jpg (7272 bytes)