C4 Engine
C4 Engine API Documentation

class Observable

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

template <class observableType, class eventType = voidclass Observable

Member Functions
Observable::HasObservers Returns a boolean value indicating whether an observable object has any observers.
Observable::AddObserver Installs an observer on an observable object.
Observable::RemoveObserver Removes an observer from an observable object.
Observable::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 Observable class.
eventType The type of an event object that is sent to observers when an event occurs. If there is no event object, then this parameter should be omitted.
Constructor

Observable();

Description
The Observable class maintains a list of observers that are listening to an observable object for event notifications. An observable object inherits from the Observable class.

Observers are installed by calling the Observable::AddObserver function for the observable object. When an event occurs, the observable object calls the Observable::PostEvent function to sent an event to its current observers.
See Also

Observer

ExclusiveObservable