Facebook Twitter YouTube

class ExclusiveObserver

Defined in:  TSObservable.h
The ExclusiveObserver class encapsulates an object pointer and callback function for an exclusive observer.

template <class observerType, class observableType> class ExclusiveObserver :

public ExclusiveObserverBase<observableType, typename observableType::ObservableEventType>

Template Parameters
observerType The type of the class for which a notification function is called when an event occurs.
observableType The type of the class that is being observed. This parameter should be the type of the class that inherits directly from the ExclusiveObservable class.

template <class eventType> ExclusiveObserver(observerType *observer, void (observerType::*callback)(observableType *, eventType));

ExclusiveObserver(observerType *observer, void (observerType::*callback)(observableType *));

observer A pointer to the object for which a notification function is called when an event occurs.
callback A pointer to a member function (the notification function) of the object specified by the observer parameter that is called when an event occurs.
The ExclusiveObserver class encapsulates a member function of an observer object. Observers are installed on exclusive observable objects by calling the ExclusiveObservable::SetObserver function. Once installed, the member function stored in the observer object is called each time an event is posted for the observable object.

The first parameter of the member function belonging to the observer object is a pointer to the object being observed. If the event type of the observable object is not void, then the event is passed as the second parameter to the member function. Otherwise, the member function should not take a second parameter.
Base Classes
ExclusiveObserverBase<observableType, typename observableType::ObservableEventType> Used internally.
See Also