Product Home Class IndexDownload

CK_Observer

This is a mixin class. Any class can inherit CK_Observer to become an observer. When an object is an observer, it is capable of observing any object that is a CK_Subject. The subject/observer design pattern is described in more detail here: Subjects & Observers.


Constructors

CK_Observer
This class is a mixin and should be inherited by another class.

Public Methods

subjectDeleted
This function is called when the subject being observed is deleted.
subjectUpdate
This function is called by the observed subject's notifyObservers() function.

A CK_Observer should never exist on its own. It should always be mixed-in to another class. In other words, a class in the user's application should inherit CK_Observer (if it wants to be an observer). A class that inherits CK_Observer should override either subjectDeleted(), subjectUpdate(), or both.

Called when the subject being observed is deleted. This method should be overridden by the class inheriting CK_Observer.

Parameters

subjectId
This is the user-defined subject id. The application can set the subject's id by calling CK_Subject::setSubjectId(). The library does not use the subject ids in any way, but simply passes it to the observer callback functions. This allows the application to pass a parameter from the subject to an observer.

Called when the observed subject's notifyObservers() method is called. This method should be overridden by the class inheriting CK_Observer.

Parameters

subjectId
This is the user-defined subject id. (see subjectDeleted).