IObserver

The IObserver class is the abstract base class for all objects that are to be notified of changes in the state of other objects in the system. Connection objects are derived from this class to connect notifiers with a designated target object. Typically you use an IObserverConnection or an IObserverConnectionTo to wire your class for notifications.

You can create your own connection objects by deriving from this class and implementing the function dispatchNotificationEvent to process specific events.


IObserver - Member Functions and Data by Group

Constructors & Destructor

Only derived classes can create objects of this class. To enforce this, the only constructor has protected access.


[view class]
~IObserver
public:
virtual ~IObserver()

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
IObserver
protected:
IObserver()

The default constructor.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Data Access

Members to access properties of object.


[view class]
threadId
public:
const IThreadId& threadId() const
Returns the threadId in which this notifier was created.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Event Dispatching

Use these members to evaluate events and determine if it is appropriate for an observer object to process them. These members also attach the observer to and detach the observer from the INotifier object.


[view class]
handleNotificationsFor
Attaches the observer to the INotifier object. The observer is notified of all events after the notifier object has been enabled for notifications.


Overload 1
public:
virtual IObserver& handleNotificationsFor(IInterest&)
Attaches the observer to the INotifier object. The observer is notified only of events for a particular interest after the notifier object has been enabled for notifications. The interest is typically published by the notifier.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
virtual IObserver& handleNotificationsFor( INotifier&, const INotificationId& id )
Attaches the observer to the INotifier object. The observer is notified only of events from a particular notifier and notifier id after the notifier object has been enabled for notifications.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 3
public:
virtual IObserver& handleNotificationsFor( INotifier& notifier, const IEventData& userData = IEventData ( ) )

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
stopHandlingNotificationsFor

Detaches the observer from the INotifier object. If the observer is handling notifications, this method should be called before the observer is destructed.


Overload 1
public:
virtual IObserver& stopHandlingNotificationsFor( const IInterest& )

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
virtual IObserver& stopHandlingNotificationsFor( INotifier&, const INotificationId& id )

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 3
public:
virtual IObserver& stopHandlingNotificationsFor( INotifier& notifier )

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
dispatchNotificationEvent
protected:
virtual IObserver& dispatchNotificationEvent( const INotificationEvent& event ) = 0

A notifier calls this dispatch method after the observer has registered to receive events.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Obsolete

These will soon be obsoleted.


[view class]
handleNotificationsFor
public:
virtual IObserver& handleNotificationsFor( INotifier& notifier, const IEventData& userData = IEventData ( ) )
Attaches the observer to the INotifier object. The observer is notified of all events after the notifier object has been enabled for notifications.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IObserver - Inherited Member Functions and Data

Inherited Public Functions

IObserver

Inherited Public Data

Inherited Protected Functions

Inherited Protected Data