sipxportlib  Version 3.3
Public Member Functions | Protected Member Functions | List of all members
UtlObservable Class Referenceabstract

#include <UtlObservable.h>

Inheritance diagram for UtlObservable:
Inheritance graph
[legend]

Public Member Functions

virtual ~UtlObservable ()
 
virtual void registerObserver (UtlObserver *observer)=0
 
virtual void removeObserver (UtlObserver *observer)=0
 

Protected Member Functions

virtual void notify (int code, void *pUserData)=0
 

Detailed Description

Simple interface for any object which is observable, meaning that observers can register to be notified of the observable's state changes.

Constructor & Destructor Documentation

virtual ~UtlObservable ( )
inlinevirtual

Member Function Documentation

virtual void registerObserver ( UtlObserver observer)
pure virtual

Registers a listener of this observable. Derived classes of UtlObservable should store its observers in a collection.

Parameters
observerThe observer that wants to "listen to" this observable's state changes.

Implemented in UtlObservableImpl.

virtual void removeObserver ( UtlObserver observer)
pure virtual

Removes a listener of this observable. Derived classes of UtlObservable should remove this observer from it's collection.

Parameters
observerThe observer that no longer wants to "listen to" this observable's state changes.

Implemented in UtlObservableImpl.

virtual void notify ( int  code,
void *  pUserData 
)
protectedpure virtual

The observable calls this to notify its observers of a change. Derived classes should iterate through their collection of observers and call UtlObserver->onNotify .

Parameters
codeAn integer notification value. For example, it can be used to indicate the observable's state.
pUserDataA reference to any object that the observable may pass to the observer.

Implemented in UtlObservableImpl.