C4 Engine
C4 Engine API Documentation

class ExclusiveObservable

Defined in:  TSObservable.h
An object inherits from the ExclusiveObservable class when it can be observed by a single observer only, and the ExclusiveObservable class provides a mechanism for notifying the observer of the object when events occur.
Definition

template <class observableType, class eventType = voidclass ExclusiveObservable

Member Functions
ExclusiveObservable::HasObserver Returns a boolean value indicating whether an observable object has an observer.
ExclusiveObservable::SetObserver Installs the observer on an observable object.
ExclusiveObservable::PostEvent Posts an event to an observable object.
Template Parameters
observableType The type of the class that can be observed. This parameter should be the type of the class that inherits directly from the ExclusiveObservable class.
eventType The type of an event object that is sent to the observer when an event occurs. If there is no event object, then this parameter should be omitted.
Constructor

ExclusiveObservable();

Description
The ExclusiveObservable class maintains a link to a single observer that is listening to an observable object for event notifications. An observable object inherits from the ExclusiveObservable class.

The exclusive observer are installed by calling the ExclusiveObservable::SetObserver function for the observable object. When an event occurs, the observable object calls the ExclusiveObservable::PostEvent function to sent an event to its current observer.
See Also

ExclusiveObserver

Observable