Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

GltObserver< T > Class Template Reference
[GLT Misc]

Type-safe base-class for Observer classes. More...

#include <observer.h>

Inheritance diagram for GltObserver< T >:

Inheritance graph
[legend]
Collaboration diagram for GltObserver< T >:

Collaboration graph
[legend]
List of all members.

Public Methods

 GltObserver ()
 Constructor.

 ~GltObserver ()
 Destructor.

void observe (T &subject)
 Observe an object.

void forget (T &subject)
 Forget an object.

virtual void OnNotify (const T *subject)=0
 Callback handler for subject updates -- should be supplied by subclass.


Protected Methods

void OnNotify (const void *subject)
 Supplied by GltObserver to do type-specific OnNotify callback event.


Detailed Description

template<class T>
class GltObserver< T >

Type-safe base-class for Observer classes.

Classes inheriting from GltObserver can observe one or more subjects of a particular type. The derived class must define an OnNotify() handler for each type of subject that it observes. When the GltSubject derived subject calls the notify() member function, each observer will receive the OnNotify() callback.

It is safe to delete either the subject or observer at any time. Both will "forget" about each other as soon as either of the destructors is called.

Definition at line 95 of file observer.h.


The documentation for this class was generated from the following file:
Generated on Tue Nov 5 11:11:45 2002 for GLT by doxygen1.2.18