VR-Link API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
DtObservee Class Reference

Instances of DtObservee are used to manage interest in this object by other objects, i.e. More...

+ Collaboration diagram for DtObservee:

Public Types

enum  DtWhyNotifyObserver { DtPendingDeleteOfYourObserved, DtDeleteOfYourObserved }
 The observed object calls DtAbsNotifyObserver::notifyFromObserved() with the following values to notify the observer of crucial information. More...

Public Member Functions

 DtObservee ()
 default constructor
virtual ~DtObservee ()
 destructor Observers should be notified before an object begins its destruction.
 DtObservee (const DtObservee &orig)
 copy constructor Maintains what was observing this object.
DtObserveeoperator= (const DtObservee &orig)
 assignment operator Maintains what was observing this object.
virtual bool registerObservedBy (DtAbsNotifyObserver *observer)
 Register observation of this object by another.
virtual bool deRegisterObservedBy (DtAbsNotifyObserver *observer)
 Deregister observation of this object by another.
virtual void notifyAllObservers (const DtWhyNotifyObserver &why)
 Notify all observers with a status.

Static Public Member Functions

static void destroy (DtObservee *object)
 Destroy object.

Protected Member Functions

void internalNotifyAllObservers (const DtWhyNotifyObserver &why)
 Notify all observers with a status.

Protected Attributes

DtList myObservedByNotifiers
 List of DtAbsNotifyObserver's which are used when observing this object.
bool myNotifiedPendingDelete

Detailed Description

Instances of DtObservee are used to manage interest in this object by other objects, i.e.

this object is being watched. This class forms the basis of all smart observation since only this class knows when it goes away, so it must tell watchers. Watchers can not smartly observe an object otherwise. This class uses DtAbsNotifyObserver to inform an observer that it is going away. Since DtAbsNotifyObserver is the critical component of notification, watchers do not have any derivation requirement (i.e. they can have no base class). The derivation requirement is that a derived DtAbsNotifyObserver is created which knows how to call out to the watcher class.

Objects of class DtObservee can be observed/pointed at/watched by essentially any other class because it uses class DtAbsNotifyObserver to notify the observer when an instance is deleted. A single instance of DtObservee can be watched by multiple instances of multiple classes.

Member Enumeration Documentation

The observed object calls DtAbsNotifyObserver::notifyFromObserved() with the following values to notify the observer of crucial information.

Enumerator:
DtPendingDeleteOfYourObserved 

This value is used from destroy() to let the observers of this observed object know the object they are observing is about to be destroyed (i.e.

deleted). This allows the observers to examine the observed object for any information one last time before the object is deleted. Observers do not need to deregister themselves, and they should no longer try to observe the deleted object or reference it after handling this notification, i.e. they should remove it from their list of items they are observing.

DtDeleteOfYourObserved 

This value is used from the base class destructor if the DtPendingDeleteOfYourObserved status was not used.

It is used as a failsafe to let observers know the object they are observing is in the process of being destroyed (i.e. deleted). Observers should not examine the observed object for any information since it is almost entirely deconstructed. Observers do not need to deregister themselves, and they should no longer try to observe the deleted object or reference it i.e. they should remove it from their list of items they are observing.

Constructor & Destructor Documentation

DtObservee::DtObservee ( )

default constructor

virtual DtObservee::~DtObservee ( )
virtual

destructor Observers should be notified before an object begins its destruction.

Unfortunately, there is no way to mandate that this happen other than to rely on programming discipline to put a call to notify in every derived destructor.

The static member destroy() was implemented to provide notification of pending delete and then deletion and is the preferred method of deleting an object of this class.

If a programmer uses delete directly on an object of this class rather than using destroy(), it is the programmer's obligation to make sure notification goes out to observers before the object begins to be destroyed.

If notification does not go out of pending destruction, this destructor will send notification of destruction in process, but the observers must not examine the object in this case.

DtObservee::DtObservee ( const DtObservee orig)

copy constructor Maintains what was observing this object.

Member Function Documentation

virtual bool DtObservee::deRegisterObservedBy ( DtAbsNotifyObserver observer)
virtual

Deregister observation of this object by another.

Returns DtFalse if the observer has not already been registered.

static void DtObservee::destroy ( DtObservee object)
static

Destroy object.

Notifies observers of pending destruction and then deletes the object. Caller should not access object again.

void DtObservee::internalNotifyAllObservers ( const DtWhyNotifyObserver why)
protected

Notify all observers with a status.

Non-virtual since meant to be called from dtor.

virtual void DtObservee::notifyAllObservers ( const DtWhyNotifyObserver why)
virtual

Notify all observers with a status.

Default calls internalNotifyAllObservers().

DtObservee& DtObservee::operator= ( const DtObservee orig)

assignment operator Maintains what was observing this object.

virtual bool DtObservee::registerObservedBy ( DtAbsNotifyObserver observer)
virtual

Register observation of this object by another.

Returns DtFalse if the observer has already been registered.

Member Data Documentation

bool DtObservee::myNotifiedPendingDelete
protected
DtList DtObservee::myObservedByNotifiers
protected

List of DtAbsNotifyObserver's which are used when observing this object.


The documentation for this class was generated from the following file:

Document ID: Generated on Thu Feb 22 04:26:36 EST 2018 from SVN revision 186468
Copyright © 2005-2016 VT MÄK. All Rights Reserved (www.mak.com)