Stefan Scholz / ETL
Embed: (wiki syntax)

« Back to documentation index

observer

observer

A templated implementation to simplify the creation of the observer pattern and attempts to eliminate certain runtime errors by turning them into compile errors. More...

Data Structures

class  observer_exception
 The base class for observer exceptions. More...
class  observer_list_full
 The exception thrown when the observer list is full. More...
class  observable< TObserver, MAX_OBSERVERS >
 The object that is being observed. More...
class  observer< T1, T2, T3, T4, T5, T6, T7, T8 >
 The observer interface for eight notification types. More...
class  observer< T1, T2, T3, T4, T5, T6, T7 >
 The observer interface for seven notification types. More...
class  observer< T1, T2, T3, T4, T5, T6 >
 The observer interface for six notification types. More...
class  observer< T1, T2, T3, T4, T5 >
 The observer interface for five notification types. More...
class  observer< T1, T2, T3, T4 >
 The observer interface for four notification types. More...
class  observer< T1, T2, T3 >
 The observer interface for three notification types. More...
class  observer< T1, T2 >
 The observer interface for two notification types. More...
class  observer< T1 >
 The observer interface for one notification type. More...

Detailed Description

A templated implementation to simplify the creation of the observer pattern and attempts to eliminate certain runtime errors by turning them into compile errors.

The pattern consists of two template classes.

  • Observer
    This template may take up to eight notification types. Each notification type will generate a pure virtual 'notification' function. The class that inherits from this *must* define all of the 'notification' function overloads otherwise the object will remain 'abstract' and will not compile. This ensures that no overload can be forgotten.
  • observable
    The class derived from this will be observed by the above class. It keeps a list of registered observers and will notify all of them with the notifications.