Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

PsnObjectHandle Class Reference

An object handle is the data structure used by controllers to access simulated objects. More...

#include <PsnObjectHandle.h>

Inheritance diagram for PsnObjectHandle:

Inheritance graph
[legend]
Collaboration diagram for PsnObjectHandle:

Collaboration graph
[legend]
List of all members.

Public Methods

 PsnObjectHandle (PsSimulatedObject &objet)
 the contructor

virtual ~PsnObjectHandle ()
 destructor

virtual void notifyChangeInControlParameter (PsOutputNT *)
 receive notification of a change in a control parameter the produced information could be used to synchronize control parameter data only when it's relevent

virtual bool controlParametersChanged (bool keepChanged=false)
 has a least one control parameter changed since last query where keepChanged was false

virtual void receiveEvent (const PsEvent &event)=0
 receive an event a clone of that event will be stored

virtual void receiveEvent (PsEvent *event)=0
 receive an event responsability of deleting the evnt passed as parameter is transfered to the object handle

virtual void registerEventListenerForEvent (PsEventListener &eventListener, const PsEventIdentifier &eventId)
 registration of an event listener for the simulation objet

virtual void sendEventsForSignal (PsEvent &event, const PsEventIdentifier &sigId)=0
 send events to simulated objects registered for sigId

virtual bool receiveRegistrationForSignal (const PsEventIdentifier &sigId, const PsName &registrant, const PsEventIdentifier &eventId)=0
 receive the registration for signal sigId by registrant.

virtual bool cancelRegistrationForSignal (const PsEventIdentifier &sigId, const PsName &registrant)=0
 cancel the registration made by registrant for sigId

const PsSimulatedObjectgetSimulatedObject () const
 get a reference to the encapsulated simulated object

PsSimulatedObjectgetSimulatedObject ()
 get a reference to the encapsulated simulated object


Protected Methods

virtual void attributeRead ()
 called when an attribute is read

virtual bool getAttributeRead (bool keepChanged=false)
 test to see if an attribute was read.


Protected Attributes

bool _attributeRead
 a boolean indicating if an attribute of the handled object was read since last call to getAttributeRead ( true )

PsSimulatedObject_myObject
 a reference to the encapsulated object

bool _aControlParameterHasChanged
 memorise changes to a control parameter of the controlled object


Friends

class PsAttribute

Detailed Description

An object handle is the data structure used by controllers to access simulated objects.

in particular, objects handle comme in two flavors : reference object handles and mirror handles, depending on whether the controller is manipulating a reference object or a miror of a reference object. an object handle, once created, is responsible for the destruction of the correspondong simulated object; after having obtained responsability for this destruction in the constructor.

Definition at line 49 of file PsnObjectHandle.h.


Constructor & Destructor Documentation

PsnObjectHandle::PsnObjectHandle PsSimulatedObject   objet
 

the contructor

Definition at line 24 of file PsnObjectHandle.cxx.

References PsObjectDescriptor::_destroySimulatedObject, _myObject, PsSimulatedObject::getObjectDescriptor(), and PsSimulatedObject::setObjectHandle().

00024                                                             :
00025    _myObject (objet),
00026    _aControlParameterHasChanged (false),
00027    _attributeRead ( false )
00028 {
00029    _myObject.setObjectHandle(this) ;
00030    _myObject.getObjectDescriptor()._destroySimulatedObject = false ;
00031 }

PsnObjectHandle::~PsnObjectHandle   [virtual]
 

destructor

Definition at line 34 of file PsnObjectHandle.cxx.

References _myObject, and PsSimulatedObject::getController().

00035 {
00036    // don't delete the controller when it deletes it's object handle
00037    if (& _myObject.getController() != &_myObject )
00038       {
00039          delete &_myObject ;
00040       }
00041 }


Member Function Documentation

void PsnObjectHandle::attributeRead   [protected, virtual]
 

called when an attribute is read

Reimplemented in PsnMirrorObjectHandle.

Definition at line 73 of file PsnObjectHandle.cxx.

References _attributeRead.

Referenced by PsnMirrorObjectHandle::attributeRead(), and PsAttribute::touch().

00074 {
00075    _attributeRead = true ;
00076 }

virtual bool PsnObjectHandle::cancelRegistrationForSignal const PsEventIdentifier   sigId,
const PsName   registrant
[pure virtual]
 

cancel the registration made by registrant for sigId

Returns:
cancellation was successful

Implemented in PsnMirrorObjectHandle, and PsnReferenceObjectHandle.

Referenced by PsSimulatedObject::cancelRegistrationForSignalBy().

bool PsnObjectHandle::controlParametersChanged bool    keepChanged = false [virtual]
 

has a least one control parameter changed since last query where keepChanged was false

Parameters:
keepChanged if true, the query doesn't change the state of the object

Definition at line 60 of file PsnObjectHandle.cxx.

References _aControlParameterHasChanged.

Referenced by PsSimulatedObject::insertInStream(), and PsSimulatedObject::pack().

00061 {
00062    bool result ;
00063    result = _aControlParameterHasChanged ;
00064    _aControlParameterHasChanged = keepChanged && _aControlParameterHasChanged ;
00065    return result;
00066 }

bool PsnObjectHandle::getAttributeRead bool    keepChanged = false [protected, virtual]
 

test to see if an attribute was read.

Definition at line 78 of file PsnObjectHandle.cxx.

References _attributeRead.

Referenced by PsnMirrorObjectHandle::unpack().

00079 {
00080    bool result = _attributeRead ;
00081    if ( _attributeRead ) _attributeRead = keepChanged ;
00082    return result ;
00083 }

PsSimulatedObject & PsnObjectHandle::getSimulatedObject  
 

get a reference to the encapsulated simulated object

Definition at line 49 of file PsnObjectHandle.cxx.

References _myObject.

00050 {
00051    return _myObject ;
00052 }

const PsSimulatedObject & PsnObjectHandle::getSimulatedObject   const
 

get a reference to the encapsulated simulated object

Definition at line 44 of file PsnObjectHandle.cxx.

References _myObject.

Referenced by PsnMultiThreadedScheduler::addToScheduable(), PsnMultiThreadedBenchmarkingScheduler::addToScheduable(), PsnMultiThreadedAsynchronousScheduler::addToScheduable(), PsnPvmDuplicatedObjectHandle::broadcastEvent(), PsnMirrorObjectHandle::cancelRegistrationForSignal(), PsController::deleteObjectHandle(), PsDistributedController::getPointerToSimulatedObjectNamed(), PsController::getPointerToSimulatedObjectNamed(), PsController::hasEventsToProcess(), PsnPvmReferenceObjectHandle::makeSynchronisationMessage(), PsController::processDeleteEventOf(), PsnReferenceObjectHandle::processEvents(), PsDistributedController::processStartEventOf(), PsController::processStartEventOf(), PsnMirrorObjectHandle::PsnMirrorObjectHandle(), PsnMirrorObjectHandle::receiveEvent(), PsnMirrorObjectHandle::receiveRegistrationForSignal(), PsnMirrorObjectHandle::registerToReferenceObject(), PsnFrameScheduler::runStep(), PsController::scheduleObject(), PsController::sendInitialEventsTo(), and PsnPvmReferenceObjectHandle::unpack().

00045 {
00046    return _myObject ;
00047 }

void PsnObjectHandle::notifyChangeInControlParameter PsOutputNT   [virtual]
 

receive notification of a change in a control parameter the produced information could be used to synchronize control parameter data only when it's relevent

Definition at line 55 of file PsnObjectHandle.cxx.

References _aControlParameterHasChanged.

Referenced by PsGenericControlParameter< Type, AncestorClass >::realSet().

00056 {
00057    _aControlParameterHasChanged = true;
00058 }

virtual void PsnObjectHandle::receiveEvent PsEvent   event [pure virtual]
 

receive an event responsability of deleting the evnt passed as parameter is transfered to the object handle

Implemented in PsnDuplicatedObjectHandle, PsnMirrorObjectHandle, PsnMomeMirrorObjectHandle, PsnMomeReferenceObjectHandle, and PsnReferenceObjectHandle.

virtual void PsnObjectHandle::receiveEvent const PsEvent   event [pure virtual]
 

receive an event a clone of that event will be stored

Implemented in PsnDuplicatedObjectHandle, PsnMirrorObjectHandle, PsnMomeMirrorObjectHandle, and PsnReferenceObjectHandle.

Referenced by PsSimulatedObject::sendEvent(), PsnSignalDispatcher::sendEventsForSignal(), and PsSimulatedObject::sendValuedEvent().

virtual bool PsnObjectHandle::receiveRegistrationForSignal const PsEventIdentifier   sigId,
const PsName   registrant,
const PsEventIdentifier   eventId
[pure virtual]
 

receive the registration for signal sigId by registrant.

Parameters:
eventId the eventId of the event sent to registrant when sigId is fired
Returns:
registration was successful

Implemented in PsnMirrorObjectHandle, and PsnReferenceObjectHandle.

Referenced by PsSimulatedObject::registerForSignalBy().

void PsnObjectHandle::registerEventListenerForEvent PsEventListener   eventListener,
const PsEventIdentifier   eventId
[virtual]
 

registration of an event listener for the simulation objet

Reimplemented in PsnReferenceObjectHandle.

Definition at line 68 of file PsnObjectHandle.cxx.

00069                                                                                          {
00070 
00071 }

virtual void PsnObjectHandle::sendEventsForSignal PsEvent   event,
const PsEventIdentifier   sigId
[pure virtual]
 

send events to simulated objects registered for sigId

Parameters:
event the prototype of the event to send : only receiver and eventId is changed for each simulated object receiving the event
sigId the signal to take into account

Implemented in PsnMirrorObjectHandle, and PsnReferenceObjectHandle.

Referenced by PsSimulatedObject::fireSignal(), and PsSimulatedObject::fireValuedSignal().


Friends And Related Function Documentation

friend class PsAttribute [friend]
 

Definition at line 121 of file PsnObjectHandle.h.


Member Data Documentation

bool PsnObjectHandle::_aControlParameterHasChanged [protected]
 

memorise changes to a control parameter of the controlled object

Definition at line 136 of file PsnObjectHandle.h.

Referenced by controlParametersChanged(), and notifyChangeInControlParameter().

bool PsnObjectHandle::_attributeRead [protected]
 

a boolean indicating if an attribute of the handled object was read since last call to getAttributeRead ( true )

Definition at line 130 of file PsnObjectHandle.h.

Referenced by attributeRead(), and getAttributeRead().

PsSimulatedObject& PsnObjectHandle::_myObject [protected]
 

a reference to the encapsulated object

Definition at line 133 of file PsnObjectHandle.h.

Referenced by PsnReferenceObjectHandle::compute(), getSimulatedObject(), PsnReferenceObjectHandle::init(), PsnPvmReferenceObjectHandle::makeSynchronisationMessage(), operator<(), operator<=(), PsnPvmReferenceObjectHandle::packInitialValues(), PsnReferenceObjectHandle::processEvents(), PsnObjectHandle(), PsnReferenceObjectHandle::PsnReferenceObjectHandle(), PsnReferenceObjectHandle::receiveEvent(), PsnMirrorObjectHandle::registerToReferenceObject(), PsnMirrorObjectHandle::sendRequestToReferenceObject(), PsnMirrorObjectHandle::unpack(), and ~PsnObjectHandle().


The documentation for this class was generated from the following files:
logo OpenMask

Documentation generated on Mon Nov 25 15:26:17 2002

Generated with doxygen 1.2.12 by Dimitri van Heesch ,   1997-2001