Rogue Wave Views |
Rogue Wave Views Documentation Home |
Observer class, notified of changes occurring in a set of IlvObservable
objects.
More...
#include <ilviews/base/observer.h>
Public Member Functions | |
IlvObserver () | |
Constructor. More... | |
virtual void | attach (IlvObservable *o) |
Attach the observer to an observable. More... | |
virtual void | detach (IlvObservable *o) |
Detach the observer from an observable. More... | |
IlBoolean | observes (IlvObservable *o) const |
Tells if the observer is attached to a given observable. More... | |
virtual void | update (IlvObservable *o, IlAny arg) |
Notifying member function called by observables. More... | |
Observer class, notified of changes occurring in a set of IlvObservable
objects.
Library: views
The design pattern Observer/Observable is commonly used to provide a loose notification mechanism between objects of unrelated classes that need to work together in an application. Objects of type IlvObservable
can tell of their modifications by calling a notify() method that will sequentially notify any objects Observer attached to them, the notify
member function calls the update
member function of the observers. This last method is the only one that needs to be implemented in subclasses to take in charge the implications of the notifications.
IlvObservable
, IlvSmartData
. IlvObserver::IlvObserver | ( | ) |
Constructor.
Initializes a new IlvObserver
that has no observables.
|
virtual |
Attach the observer to an observable.
This member function tells the observable that it should start notifying the observer of its state changes.
o | The observable. |
|
virtual |
Detach the observer from an observable.
Tells the observable that it should no longer report its state changes to the observer.
o | The observable. |
IlBoolean IlvObserver::observes | ( | IlvObservable * | o | ) | const |
Tells if the observer is attached to a given observable.
IlTrue
if the observer is attached to o. o | The observable. |
|
virtual |
Notifying member function called by observables.
Must be defined in subclasses to implement the notification mechanism.
o | Observable whose state has changed. |
arg | Any argument commonly agreed between the observer and the observable that should help the observer in determining what exactly in the state of the observable has changed. |
IlvActionMessage
for an example of use of this parameter. Reimplemented in IlvModifiedFlagObserver.
© Copyright 2015, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.