rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

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

List of all members.

Public Member Functions

 IlvObserver ()
 Constructor.
virtual void attach (IlvObservable *o)
 Attach the observer to an observable.
virtual void detach (IlvObservable *o)
 Detach the observer from an observable.
IlBoolean observes (IlvObservable *o) const
 Tells if the observer is attached to a given observable.
virtual void update (IlvObservable *o, IlAny arg)
 Notifying member function called by observables.

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:
o The 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:
o The 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:
o The 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:
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.
See also:
IlvActionMessage for an example of use of this parameter.

Reimplemented in IlvModifiedFlagObserver.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

© Copyright 2012, 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.