C4 Engine
C4 Engine API Documentation

Observable::AddObserver

Defined in:  TSObservable.h
Installs an observer on an observable object.
Prototype

void AddObserver(ObserverType *observer);

Parameters
observer The observer to install.
Description
The AddObserver function installs the observer specified by the observer parameter on an observable object. The observer should have the type Observer<observerType, observableType>, where observerType is the type of the object that is notified when an event occurs, and observableType is the type of the object being observed.

An observer can only observe one object at a time, so if the observer specified by the observer parameter is already watching a different object at the time the AddObserver function is called, then it is no longer watching that object after the AddObserver function returns.

When an observable object is destroyed, all of its observers are automatically removed.
See Also

Observable::HasObservers

Observable::RemoveObserver