rwlogo

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
List of all members | Public Member Functions
IlvObserver Class Reference

Observer class, notified of changes occurring in a set of IlvObservable objects. More...

#include <ilviews/base/observer.h>

Inheritance diagram for IlvObserver:
IlvModifiedFlagObserver

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...
 

Detailed Description

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.

See Also
IlvObservable, IlvSmartData.

Constructor & Destructor Documentation

IlvObserver::IlvObserver ( )

Constructor.

Initializes a new IlvObserver that has no observables.

Member Function Documentation

virtual void IlvObserver::attach ( IlvObservable o)
virtual

Attach the observer to an observable.

This member function tells the observable that it should start notifying the observer of its state changes.

Parameters
oThe observable.
virtual void IlvObserver::detach ( IlvObservable o)
virtual

Detach the observer from an observable.

Tells the observable that it should no longer report its state changes to the observer.

Parameters
oThe observable.
IlBoolean IlvObserver::observes ( IlvObservable o) const

Tells if the observer is attached to a given observable.

Returns
IlTrue if the observer is attached to o.
Parameters
oThe observable.
virtual void IlvObserver::update ( IlvObservable o,
IlAny  arg 
)
virtual

Notifying member function called by observables.

Must be defined in subclasses to implement the notification mechanism.

Parameters
oObservable whose state has changed.
argAny 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.
See Also
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.