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 | Friends
IlvObservable Class Reference

Observable class, sending notification to a set of Observer objects. More...

#include <ilviews/base/observer.h>

Inheritance diagram for IlvObservable:
IlvSmartData IlvActionHistory IlvCommandHistory

Public Member Functions

 IlvObservable ()
 Empty constructor. More...
 
virtual void notify (IlAny arg=0)
 Notification method, to be called in methods that modify the state of the object whenever required. More...
 
- Public Member Functions inherited from IlvSmartData
 IlvSmartData ()
 Constructor. More...
 
 IlvSmartData (const IlvSmartData &data)
 Copy constructor. More...
 
virtual ~IlvSmartData ()
 Destructor.
 
void decrRef ()
 Decrements the reference counter of the object and deletes this object when the counter reaches 0. More...
 
void incrRef ()
 Increments the reference counter.
 
int refCount ()
 Returns the number of references to this object. More...
 

Friends

class IlvObserver
 

Detailed Description

Observable class, sending notification to a set of Observer objects.

Library: views

This class implements the Observable side of the Observer/Observable design pattern. The notify member function takes an optional parameter. This parameter can be used by observers aware of the types of state changes that can occur on the observable to optimize the notification process. This parameter is often an enumerated type indicating the method of the observable that has called the notify method. The class implements a lock mechanism preventing loops of notification. Frequently in a data structure, some objects are observing each other's state and want both to propagate changes and be notified of other's changes. This introduces the risk of infinite loops of notification. The IlvObservable class implements a lock that is set whenever its notify member function is called, so that no nested call can be done for a given object. Observable objects are reference counted, as the reference count is often needed in subclasses.

See Also
IlvObservable, IlvSmartData, IlvSmartPointer.

Constructor & Destructor Documentation

IlvObservable::IlvObservable ( )

Empty constructor.

Initializes an instance of IlvObservable.

Member Function Documentation

virtual void IlvObservable::notify ( IlAny  arg = 0)
virtual

Notification method, to be called in methods that modify the state of the object whenever required.

Parameters
argAny type of information the observable may want to provide on its state change, that could be useful to observers.

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