OMK::SimulatedObject Class Reference

This is the class defining what a object or entity is like in Mask. More...

#include <OMKSimulatedObject.h>

Inheritance diagram for OMK::SimulatedObject:

Inheritance graph
[legend]
Collaboration diagram for OMK::SimulatedObject:

Collaboration graph
[legend]
List of all members.

Public Member Functions

member functions for queries using the simulation tree
template<typename Type>
std::list< const ObjectDescriptor * > * listSonsOfType ()
 list the sons of this object of a certain type in the simulation tree.
template<typename Type>
std::list< const ObjectDescriptor * > * listBrothersOfType ()
 get the name of the brothers, of a certain type, of the simulated object in the simualtion tree warning : the underlying implementation relies on dynamic_cast, which implies usual restrictions on it's use in the constructor (object might not find itself)
template<typename Type>
std::list< const ObjectDescriptor * > * listDescendantsOfType ()
 list of descendants, of a certain type, of this simulated object in the simulation tree
virtual bool isAncestor (const Name &name)
 isAncestor
virtual SimulatedObjectgetFather () const
 get the simulated object's father in the simulation tree if the simulated object has a father WARNING : if any other information than a pointer to the object simulating the father is needed, please use getFathersDescriptor() to access that information
virtual const ObjectDescriptorgetFathersDescriptor () const
 get the name of the simulated object's father in the simulation tree
Accessors.
virtual const NamegetName () const
 get the name of the simulated object
virtual ControllergetController () const
 get the controler of the simulated object
ObjectHandlegetObjectHandle () const
 get the object handle. Usage by the kernel.
void setObjectHandle (ObjectHandle *objectHandle)
 set the object handle : feils if an object handle allready exists
const ObjectDescriptorgetObjectDescriptor () const
 gain access to the object descriptor
virtual const NameToPointerMap<
InputNT > & 
getInputTable () const
 get a reference to the table of the simulated object's inputs
virtual const NameToPointerMap<
OutputNT > & 
getOutputTable () const
 get a reference to the table of the simulated object's outputs
virtual const NameToPointerMap<
OutputNT > & 
getControlParameterTable () const
 get a reference to the table of the simulated object's parameters
virtual const std::list< EventListener * > & getEventListeners () const
 get a reference to the list of EventListeners
virtual InputNTgetPointerToInputNamed (const Name &inputName) const
 get a pointer to an input
virtual OutputNTgetPointerToOutputNamed (const Name &outputName) const
 get a pointer to an output
virtual OutputNTgetPointerToControlParameterNamed (const Name &parameterName) const
 get a pointer to a control parameter
virtual const ConfigurationParameterDescriptorgetConfigurationParameters () const
 get a pointer to the structure describing our configuration parameters
member function whose redifinition enables creation of specialised simulated object .
virtual void postConstruction ()
 Complete constructor the object.
virtual void init ()
 initialise the object.
virtual void emigrate ()
 CHADI.
virtual void immigrate (Event *event)
virtual void compute ()
 compute evolution of this object.
virtual void finish ()
 finish calculation of evolution.
virtual void extract (std::istream &in=std::cin)
 extract pertinant information for this object from an input stream
virtual void insertInStream (std::ostream &out=std::cout) const
 insert pertinant information for this object in an output stream
virtual void unpack (IncomingSynchronisationMessage &)
 unpack an update from a message
virtual void unpackAllValues (IncomingSynchronisationMessage &)
 unpack all necessary info if the object is a mirror from a message
virtual void pack (OutgoingSynchronisationMessage &) const
 pack update information in a message
virtual void packAllValues (OutgoingSynchronisationMessage &) const
 pack initial information in a message
virtual void prepareEventProcessing (std::list< Event * > &)
 prepareEventProcessing called before any events are processed if any clean up is needed after the preceeding simulation step
virtual bool processEvent (Event *)
 process an event for this object.
virtual void eventsProcessed (std::list< Event * > &)
 eventsProcessed called once all the events have been handled to processEvent, and those who have been succesfully processed (processEvent having return true ) have been destroyed
virtual bool processEventsASAP () const
 event processing mode.
virtual void addEventListener (EventListener &)
 Event listener registration.
void registerEventListenerForEvent (EventListener &eventListener, const EventIdentifier &eventId)
 Event listener registration for an event id.
void unregisterEventListener (EventListener &eventListener)
 Unregistration of an event listener for the simulation object.
signal generation and bookeeping
void fireSignal (const EventIdentifier &sig)
 fire a signal wich will be seen by anybody registred for that signal
template<typename UserType>
void fireValuedSignal (const EventIdentifier &sig, const UserType &value)
 fire a signal which carries an associated value
virtual bool registerForSignalBy (const EventIdentifier &sig, const Name &producer)
 register for a signal fired by a particular simulated object
virtual bool registerForSignalBy (const EventIdentifier &sig, const Name &producer, const EventIdentifier &eventId)
 register for a signal fired by a particular simulated object
virtual bool registerForSignalBy (const EventIdentifier &sig, SimulatedObject *producer)
 register for a signal fired by a particular simulated object
virtual bool registerForSignalBy (const EventIdentifier &sig, SimulatedObject &producer)
 register for a signal fired by a particular simulated object
virtual bool registerForSignalBy (const EventIdentifier &sig, SimulatedObject *producer, const EventIdentifier &eventId)
 register for a signal fired by a particular simulated object
virtual bool registerForSignalBy (const EventIdentifier &sig, SimulatedObject &producer, const EventIdentifier &eventId)
 register for a signal fired by a particular simulated object
virtual bool registerForSignal (const EventIdentifier &sig)
 register for a particular signal fired by anybody
virtual bool registerForSignal (const EventIdentifier &sig, const EventIdentifier &eventId)
 register for a particular signal fired by anybody
virtual bool cancelRegistrationForSignalBy (const EventIdentifier &sig, const Name &producer)
 cancel registration for a signal fired by a particular simulated object
virtual bool cancelRegistrationForSignalBy (const EventIdentifier &sig, SimulatedObject *producer)
 cancel registration for a signal fired by a particular simulated object
virtual bool cancelRegistrationForSignalBy (const EventIdentifier &sig, SimulatedObject &producer)
 cancel registration for a signal fired by a particular simulated object
virtual bool cancelRegistrationForSignal (const EventIdentifier &sig)
 cancel registration for a particular signal fired by anybody
attribute declaration
template<typename Type>
Input< Type > & addInput (const Name &inputName, bool makeConnectable=false, int precisionLevel=OMK::Type::PolatorNT::defaultPrecisionLevel)
 add a input to the simulated object
template<typename Type>
SensitiveInput< Type > & addSensitiveInput (const Name &inputName, bool makeConnectable=false, int precisionLevel=OMK::Type::PolatorNT::defaultPrecisionLevel)
 add a sensitive input to the simulated object
template<typename Type>
SensitiveNotifyingInput< Type > & addSensitiveNotifyingInput (const Name &inputName, bool makeConnectable=false, int precisionLevel=OMK::Type::PolatorNT::defaultPrecisionLevel)
 add a sensitive Notifying input to the simulated object
void deleteInput (const Name &inputName)
 delete an input from the list of inputs of the simulated object WARNING : consideration is being given for the removal of this member function
template<typename Type>
Output< Type > & addOutput (const Name &outputName, OMK::Type::PolatorNT *polator=0)
 add an output to the simulated object
template<typename Type>
ControlParameter< Type > & addControlParameter (const Name &controlParameterName, OMK::Type::PolatorNT *polator=0)
 add a control parameter to the simulated object
template<typename Type>
InputAlias< Type > & addInputAlias (const Name &aliasName, const Name &aliasedObjectName, const Name &aliasedInputName, int precisionLevel=OMK::Type::PolatorNT::defaultPrecisionLevel)
 add an input which is an alias to an input of an other object
template<typename Type>
SensitiveInputAlias< Type > & addSensitiveInputAlias (const Name &aliasName, const Name &aliasedObjectName, const Name &aliasedInputName, int precisionLevel=OMK::Type::PolatorNT::defaultPrecisionLevel)
 add an sensitive input which is an alias to an input of an other object
template<typename Type>
SensitiveNotifyingInputAlias<
Type > & 
addSensitiveNotifyingInputAlias (const Name &aliasName, const Name &aliasedObjectName, const Name &aliasedInputName, int precisionLevel=OMK::Type::PolatorNT::defaultPrecisionLevel)
 add a sensitive Notifying input which is an alias to an input of an other object
template<typename Type>
OutputAlias< Type > & addOutputAlias (const Name &aliasName, const Name &aliasedObjectName, const Name &aliasedOutputName, OMK::Type::PolatorNT *interp=0)
 add an output which is an alias to the output of an ancestor in the simulation tree
date and duration manipulation methods
virtual const DategetSimulatedDate () const
 get the simulated date
float getPeriod () const
 getPeriod this is a shorthand for 1 / _objectDescriptor.Frequency () is expressed in seconds
member function related to event sending
void sendEvent (const Name &receiver, const EventIdentifier &eventId)
 send an event
void sendEvent (SimulatedObject *receiver, const EventIdentifier &eventId)
 send an event
void sendEvent (SimulatedObject &receiver, const EventIdentifier &eventId)
 send an event
template<typename UserType>
void sendValuedEvent (const Name &receiver, const EventIdentifier &eventId, const UserType &userInfo)
 send a valued event
template<typename UserType>
void sendValuedEvent (SimulatedObject *receiver, const EventIdentifier &eventId, const UserType &userInfo)
 send a valued event
template<typename UserType>
void sendValuedEvent (SimulatedObject &receiver, const EventIdentifier &eventId, const UserType &userInfo)
 send a valued event
void sendEvent (const Event &event)
 send an event.
void sendEvent (Event *event)
 send the event pointed to by event warning : after this member function is called, *event should be considered as deleted, as the controler will delete it at any time : use previous member function if you want Mask to copy the event.

Protected Attributes

Controller_controller
 reéférence sur le controleur
const ObjectDescriptor_objectDescriptor
 référence sur le descripteur d'objet
NameToPointerMap< InputNT_inputTable
 the input table
NameToPointerMap< OutputNT_outputTable
 the output table
NameToPointerMap< OutputNT_controlParameterTable
 the table of control parameters
std::list< EventListener * > _listOfEventListeners
 the list of Event listeners of that object
ObjectHandle_objectHandle
 pointeur on the associated objectHandle

Friends

class InputNT

Detailed Description

This is the class defining what a object or entity is like in Mask.

A simulation object is completely initialised in 4 to 6 steps :

Definition at line 72 of file OMKSimulatedObject.h.


Constructor & Destructor Documentation

SimulatedObject::SimulatedObject ( Controller ctrl,
const ObjectDescriptor objectDescription 
)

constructor

Definition at line 70 of file OMKSimulatedObject.cpp.

References _objectDescriptor, and OMK::ObjectDescriptor::_pointerToSimulatedObject.

00070                                                                                               : 
00071    Flowable(),
00072    _controller ( ctrl ),
00073    _objectDescriptor ( objectDecriptor ),
00074    _objectHandle ( NULL )
00075 {
00076    _objectDescriptor._pointerToSimulatedObject = this ;
00077 }

SimulatedObject::~SimulatedObject (  )  [virtual]

destructor

Definition at line 80 of file OMKSimulatedObject.cpp.

References _controlParameterTable, _inputTable, _listOfEventListeners, _objectDescriptor, _outputTable, OMK::ObjectDescriptor::_pointerToSimulatedObject, getPointerToControlParameterNamed(), getPointerToInputNamed(), getPointerToOutputNamed(), OMK_DEBUG_OMK_EXEC, and OMTRACEID.

00081 {
00082   // destroy inputs, outputs and control parameters
00083    
00084   NameToPointerMap<OutputNT>::iterator pOutput; // iterateur
00085   OutputNT *outputCourante;
00086   NameToPointerMap<OutputNT>::iterator pParam; // iterateur
00087   OutputNT *paramCourant;
00088   NameToPointerMap<InputNT>::iterator pInput; // iterateur
00089   InputNT *inputCourant;
00090 
00091   // Pour toutes les outputs, on detruit ;
00092 
00093   OMTRACEID( OMK_DEBUG_OMK_EXEC, "SimulatedObject:: ~SimulatedObject ()  : control parameters destruction" ) ;
00094   for(pParam= _controlParameterTable.begin(); pParam!= _controlParameterTable.end(); pParam++)
00095     {
00096       paramCourant = getPointerToControlParameterNamed ((*pParam).first);
00097       delete paramCourant;
00098     }
00099   OMTRACEID( OMK_DEBUG_OMK_EXEC, "SimulatedObject:: ~SimulatedObject ()  : control parameters destruction done" << std::endl << "inputs destruction" ) ;
00100   for(pInput= _inputTable.begin(); pInput!=_inputTable.end();pInput++)
00101     {
00102       inputCourant = getPointerToInputNamed ((*pInput).first);
00103       delete inputCourant ;
00104     }
00105   OMTRACEID( OMK_DEBUG_OMK_EXEC, "SimulatedObject:: ~SimulatedObject ()  : inputs destruction done" << std::endl << "outputs destruction" ) ;
00106   for(pOutput= _outputTable.begin(); pOutput!= _outputTable.end(); pOutput++)
00107     {
00108        outputCourante = getPointerToOutputNamed ((*pOutput).first);
00109        delete outputCourante;
00110     }
00111   OMTRACEID( OMK_DEBUG_OMK_EXEC, "SimulatedObject:: ~SimulatedObject ()  : outputs destruction done" << std::endl << "encapsulated classes creators destruction " ) ;
00112 
00113   // update the object descriptor
00114   _objectDescriptor._pointerToSimulatedObject = NULL ;
00115 
00116   // Delete all the remaining event listeners
00117   for( std::list <EventListener *>::iterator listener = _listOfEventListeners.begin() ;
00118        listener != _listOfEventListeners.end() ; listener = _listOfEventListeners.begin() )
00119   {
00120     delete *listener ;
00121   }
00122   OMTRACEID( OMK_DEBUG_OMK_EXEC, "SimulatedObject:: ~SimulatedObject ()  : done" ) ;
00123 }

SimulatedObject::SimulatedObject ( Controller ctrl,
const ObjectDescriptor objectDescription 
)

constructor

Definition at line 70 of file OMKSimulatedObject.cpp.

References _objectDescriptor, and OMK::ObjectDescriptor::_pointerToSimulatedObject.

00070                                                                                               : 
00071    Flowable(),
00072    _controller ( ctrl ),
00073    _objectDescriptor ( objectDecriptor ),
00074    _objectHandle ( NULL )
00075 {
00076    _objectDescriptor._pointerToSimulatedObject = this ;
00077 }

SimulatedObject::~SimulatedObject (  )  [virtual]

destructor

Definition at line 80 of file OMKSimulatedObject.cpp.

References _controlParameterTable, _inputTable, _listOfEventListeners, _objectDescriptor, _outputTable, OMK::ObjectDescriptor::_pointerToSimulatedObject, getPointerToControlParameterNamed(), getPointerToInputNamed(), getPointerToOutputNamed(), OMK_DEBUG_OMK_EXEC, and OMTRACEID.

00081 {
00082   // destroy inputs, outputs and control parameters
00083    
00084   NameToPointerMap<OutputNT>::iterator pOutput; // iterateur
00085   OutputNT *outputCourante;
00086   NameToPointerMap<OutputNT>::iterator pParam; // iterateur
00087   OutputNT *paramCourant;
00088   NameToPointerMap<InputNT>::iterator pInput; // iterateur
00089   InputNT *inputCourant;
00090 
00091   // Pour toutes les outputs, on detruit ;
00092 
00093   OMTRACEID( OMK_DEBUG_OMK_EXEC, "SimulatedObject:: ~SimulatedObject ()  : control parameters destruction" ) ;
00094   for(pParam= _controlParameterTable.begin(); pParam!= _controlParameterTable.end(); pParam++)
00095     {
00096       paramCourant = getPointerToControlParameterNamed ((*pParam).first);
00097       delete paramCourant;
00098     }
00099   OMTRACEID( OMK_DEBUG_OMK_EXEC, "SimulatedObject:: ~SimulatedObject ()  : control parameters destruction done" << std::endl << "inputs destruction" ) ;
00100   for(pInput= _inputTable.begin(); pInput!=_inputTable.end();pInput++)
00101     {
00102       inputCourant = getPointerToInputNamed ((*pInput).first);
00103       delete inputCourant ;
00104     }
00105   OMTRACEID( OMK_DEBUG_OMK_EXEC, "SimulatedObject:: ~SimulatedObject ()  : inputs destruction done" << std::endl << "outputs destruction" ) ;
00106   for(pOutput= _outputTable.begin(); pOutput!= _outputTable.end(); pOutput++)
00107     {
00108        outputCourante = getPointerToOutputNamed ((*pOutput).first);
00109        delete outputCourante;
00110     }
00111   OMTRACEID( OMK_DEBUG_OMK_EXEC, "SimulatedObject:: ~SimulatedObject ()  : outputs destruction done" << std::endl << "encapsulated classes creators destruction " ) ;
00112 
00113   // update the object descriptor
00114   _objectDescriptor._pointerToSimulatedObject = NULL ;
00115 
00116   // Delete all the remaining event listeners
00117   for( std::list <EventListener *>::iterator listener = _listOfEventListeners.begin() ;
00118        listener != _listOfEventListeners.end() ; listener = _listOfEventListeners.begin() )
00119   {
00120     delete *listener ;
00121   }
00122   OMTRACEID( OMK_DEBUG_OMK_EXEC, "SimulatedObject:: ~SimulatedObject ()  : done" ) ;
00123 }


Member Function Documentation

template<typename Type>
std::list< const ObjectDescriptor * > * OMK::SimulatedObject::listSonsOfType (  ) 

list the sons of this object of a certain type in the simulation tree.

warning : the underlying implementation relies on dynamic_cast, which implies usual restrictions on it's use in the constructor (object might not find itself)

Returns:
the list of the sons, which should be deleted after use

Definition at line 15 of file OMKSimulatedObject.inl.

References getObjectDescriptor().

00016 {
00017   return getObjectDescriptor().template listSonsOfType< Type >() ;
00018 }

template<typename Type>
std::list< const ObjectDescriptor * > * OMK::SimulatedObject::listBrothersOfType (  ) 

get the name of the brothers, of a certain type, of the simulated object in the simualtion tree warning : the underlying implementation relies on dynamic_cast, which implies usual restrictions on it's use in the constructor (object might not find itself)

Returns:
the list of names, which should be deleted after use

Definition at line 21 of file OMKSimulatedObject.inl.

References getObjectDescriptor(), and OMASSERT.

00022 {
00023    OMASSERT( getObjectDescriptor().getFathersObjectDescriptor() != 0 ) ;
00024    return getObjectDescriptor().
00025              getFathersObjectDescriptor()->template listSonsOfType< Type >() ;
00026 }

template<typename Type>
std::list< const ObjectDescriptor * > * OMK::SimulatedObject::listDescendantsOfType (  ) 

list of descendants, of a certain type, of this simulated object in the simulation tree

Returns:
the list of the descendants, which should be deleted after use

Definition at line 29 of file OMKSimulatedObject.inl.

References getObjectDescriptor().

00030 {
00031   return getObjectDescriptor().template listDescendantsOfType< Type >();
00032 }

bool SimulatedObject::isAncestor ( const Name name  )  [virtual]

isAncestor

Parameters:
name : the simulated object which could be an ancestor
Returns:
answer

Definition at line 804 of file OMKSimulatedObject.cpp.

References OMK::ObjectDescriptor::getFathersObjectDescriptor(), OMK::ObjectDescriptor::getName(), and getObjectDescriptor().

Referenced by addInputAlias(), addSensitiveInputAlias(), and addSensitiveNotifyingInputAlias().

00805 {
00806    bool result = false ;
00807    const ObjectDescriptor * ancestorDescriptor = getObjectDescriptor().getFathersObjectDescriptor() ;
00808    while ( (ancestorDescriptor != NULL) &&
00809            !result )
00810       {
00811          if ( ancestorDescriptor->getName() == name)
00812             {
00813                result = true ;
00814             }
00815          ancestorDescriptor = ancestorDescriptor->getFathersObjectDescriptor() ;
00816       }
00817    return result ;
00818 }

SimulatedObject * SimulatedObject::getFather (  )  const [virtual]

get the simulated object's father in the simulation tree if the simulated object has a father WARNING : if any other information than a pointer to the object simulating the father is needed, please use getFathersDescriptor() to access that information

Returns:
NULL if the simulated object has no father, a pointer to the father otherwise

Definition at line 228 of file OMKSimulatedObject.cpp.

References _controller, _objectDescriptor, OMK::ObjectDescriptor::getFathersObjectDescriptor(), OMK::ObjectDescriptor::getName(), and OMK::Controller::getPointerToSimulatedObjectNamed().

00228                                                     {
00229    //refObjet is not always initialised in a distributed environment
00230    if ( _objectDescriptor.getFathersObjectDescriptor() != NULL )
00231       {
00232          return  _controller.getPointerToSimulatedObjectNamed(_objectDescriptor.getFathersObjectDescriptor()->getName());
00233       }
00234    else
00235       {
00236          return NULL ;
00237       }
00238 }

const ObjectDescriptor & SimulatedObject::getFathersDescriptor (  )  const [virtual]

get the name of the simulated object's father in the simulation tree

Returns:
the descriptor of the current object if the object has no father, the father's descriptor otherwise

Definition at line 215 of file OMKSimulatedObject.cpp.

References _objectDescriptor, and OMK::ObjectDescriptor::getFathersObjectDescriptor().

00215                                                                       {
00216    if ( _objectDescriptor.getFathersObjectDescriptor () != NULL ) 
00217       {
00218          return *_objectDescriptor.getFathersObjectDescriptor () ;
00219       }
00220    else 
00221       {
00222          return _objectDescriptor ;
00223       }
00224 } 

const Name & SimulatedObject::getName (  )  const [virtual]

get the name of the simulated object

Definition at line 164 of file OMKSimulatedObject.cpp.

References _objectDescriptor, and OMK::ObjectDescriptor::getName().

Referenced by OMK::Controller::actOnSystemEvent(), addControlParameter(), addInput(), addInputAlias(), addOutput(), addOutputAlias(), addSensitiveInput(), addSensitiveInputAlias(), addSensitiveNotifyingInput(), addSensitiveNotifyingInputAlias(), OMK::FrameScheduler::addToScheduable(), OMK::PvmLocalObjectHandle::broadcastEvent(), OMK::PvmDuplicatedObjectHandle::broadcastEvent(), cancelRegistrationForSignal(), cancelRegistrationForSignalBy(), OMK::MKMHumano::computeParameters(), OMK::Controller::computeScheduling(), OMK::OutputNT::connect(), OMK::Input< T >::connect(), OMK::Input< T >::connectToControlParameter(), OMK::Vis::VisBase::createInput(), OMK::Controller::createLocalObject(), OMK::Controller::createObject(), OMK::Controller::createReferenceObjectHandle(), OMK::debugMsg(), OMK::Vis::VisBase::finish(), fireSignal(), fireValuedSignal(), OMK::Input< T >::get(), OMK::Output< T >::getDateOfLastExactValue(), OMK::Input< T >::getDateOfLastExactValue(), OMK::StaticHumano::getInitialiseSequence(), OMK::Output< T >::getLastExactValue(), OMK::Input< T >::getLastExactValue(), getPointerToOutputNamed(), OMK::DistributedController::getPointerToSimulatedObjectNamed(), OMK::Controller::getPointerToSimulatedObjectNamed(), OMK::MovingHumano::getVisualObjectPrm(), OMK::BasicHumano::getVisualObjectPrm(), OMK::Controller::hasEventsToProcess(), OMK::Controller::init(), OMK::UnInitialisedAttributeException::insertInStream(), OMK::Iii::SimpleConnectorT< Type >::isConnected(), OMK::Inp::EscListener::keyPressed(), OMK::Vis::VisObjectExtension::loadAnimatorParameters(), OMK::Vis::VisObjectExtension::loadObjectParameters(), OMK::HumanoPlayer::loadParameters(), OMK::MultiValuedEventSignalEmitterUtilT< T, ModelType >::loadParametersUtil(), OMK::ValuedEventSignalEmitterUtilT< T, ModelType >::loadParametersUtil(), OMK::Output< T >::localInsert(), OMK::PvmReferenceObjectHandle::makeSynchronisationMessage(), OMK::Controller::migrateObjectToProcess(), OMK::operator<(), OMK::Output< T >::Output(), OMK::PvmReferenceObjectHandle::packInitialValues(), OMK::Output< T >::printDebuggingInformation(), OMK::InputAlias< T >::printDebuggingInformation(), OMK::Input< T >::printDebuggingInformation(), OMK::Vis::VisBase::processAddVisualObjectEvent(), OMK::Controller::processDeleteEventOf(), OMK::DistributedController::processEvent(), OMK::Controller::processEvent(), OMK::DistributedController::processStartEventOf(), OMK::PvmController::PvmController(), OMK::Input< T >::realConnect(), OMK::DistributedController::receiveCancellationForSignal(), OMK::ReferenceObjectHandle::receiveEvent(), OMK::DistributedController::receiveRegistrationForSignal(), registerForSignal(), registerForSignalBy(), OMK::PvmMirrorObjectHandle::registerToReferenceObject(), OMK::FrameScheduler::removeFromScheduable(), OMK::FrameScheduler::schedule(), sendEvent(), OMK::Controller::sendInitialEventsTo(), OMK::PvmMirrorObjectHandle::sendRequestToReferenceObject(), sendValuedEvent(), OMK::Output< T >::set(), OMK::AbstractInput< Type >::setConnectable(), OMK::PvmMirrorObjectHandle::unpack(), and OMK::FrameScheduler::unschedule().

00165 {
00166   return _objectDescriptor.getName() ;
00167 }

Controller & SimulatedObject::getController (  )  const [virtual]

get the controler of the simulated object

Definition at line 172 of file OMKSimulatedObject.cpp.

References _controller.

Referenced by OMK::Controller::actOnSystemEvent(), addOutputAlias(), cancelRegistrationForSignalBy(), OMK::HumanoRecorder::computeParameters(), OMK::OutputNT::connect(), OMK::Input< T >::connect(), OMK::Input< T >::connectToControlParameter(), OMK::ObjectDescriptor::createDescribedObject(), fireSignal(), fireValuedSignal(), OMK::Controller::hasEventsToProcess(), OMK::Iii::IConnector::IConnector(), OMK::Inp::EscListener::keyPressed(), OMK::PvmMirrorObjectHandle::linkToNewReferential(), OMK::EventSignalEmitterUtil::loadParametersUtil(), OMK::Output< T >::localGet(), OMK::PvmMirrorObjectHandle::PvmMirrorObjectHandle(), OMK::Inp::DistributedCameraListener::readConfigurationParameters(), OMK::Input< T >::realConnect(), registerForSignalBy(), OMK::PvmMirrorObjectHandle::registerToReferenceObject(), sendEvent(), OMK::PvmMirrorObjectHandle::sendRequestToReferenceObject(), sendValuedEvent(), OMK::Output< T >::set(), OMK::AbstractInput< Type >::setConnectable(), OMK::Output< T >::suggest(), OMK::PvmMirrorObjectHandle::unpack(), and OMK::ObjectHandle::~ObjectHandle().

00172                                                    {
00173   return _controller;
00174 }

ObjectHandle * SimulatedObject::getObjectHandle (  )  const

get the object handle. Usage by the kernel.

Definition at line 49 of file OMKSimulatedObject.cpp.

References _objectHandle.

Referenced by addEventListener(), cancelRegistrationForSignalBy(), OMK::DistributedController::createLocalObject(), fireSignal(), fireValuedSignal(), OMK::DistributedController::getPointerToSimulatedObjectNamed(), OMK::Controller::init(), insertInStream(), pack(), packAllValues(), OMK::GenericControlParameter< T, AncestorClass >::realSet(), registerEventListenerForEvent(), registerForSignalBy(), OMK::Controller::scheduleControlledObjects(), sendEvent(), OMK::SignalDispatcher::sendEventsForSignal(), sendValuedEvent(), and unregisterEventListener().

00050 {
00051    return _objectHandle ;
00052 }

void SimulatedObject::setObjectHandle ( ObjectHandle objectHandle  ) 

set the object handle : feils if an object handle allready exists

Definition at line 56 of file OMKSimulatedObject.cpp.

References _objectHandle.

Referenced by OMK::ObjectHandle::ObjectHandle().

00057 {
00058    //OMASSERT ( _objectHandle == NULL ) ; // TDTD 09-05-2006 commentaire cause noyau Chadi : pour la migration
00059    _objectHandle = objectHandle ;
00060 }

const ObjectDescriptor & SimulatedObject::getObjectDescriptor (  )  const

gain access to the object descriptor

Definition at line 64 of file OMKSimulatedObject.cpp.

References _objectDescriptor.

Referenced by OMK::PvmMirrorObjectHandle::cancelRegistrationForSignal(), OMK::MKMHumano::computeParameters(), OMK::Vis::VisBase::createInput(), OMK::debugMsg(), OMK::Controller::deleteObject(), OMK::Controller::deleteObjectHandle(), OMK::Controller::getPointerToDuplicatedObjectNamed(), OMK::DistributedController::getPointerToSimulatedObjectNamed(), OMK::ExtensibleSimulatedObject::init(), OMK::Clock::init(), isAncestor(), listBrothersOfType(), OMK::Controller::listBrothersOfType(), listDescendantsOfType(), OMK::Controller::listDescendantsOfType(), listSonsOfType(), OMK::Vis::VisObjectExtension::loadAnimatorParameters(), OMK::ObjectHandle::ObjectHandle(), OMK::operator<=(), OMK::ExtensibleSimulatedObject::postConstruction(), OMK::Vis::VisBase::processAddVisualObjectEvent(), OMK::Controller::processDeleteEventOf(), OMK::DistributedController::processEvent(), OMK::PvmMirrorObjectHandle::PvmMirrorObjectHandle(), OMK::PvmMirrorObjectHandle::receiveEvent(), OMK::PvmMirrorObjectHandle::receiveRegistrationForSignal(), OMK::Controller::sendInitialEventsTo(), and OMK::PvmMirrorObjectHandle::sendRequestToReferenceObject().

00064                                                                      {
00065    return _objectDescriptor ;
00066 }

const NameToPointerMap< InputNT > & SimulatedObject::getInputTable (  )  const [virtual]

get a reference to the table of the simulated object's inputs

Definition at line 244 of file OMKSimulatedObject.cpp.

References _inputTable.

00245 {
00246    return _inputTable ;
00247 }

const NameToPointerMap< OutputNT > & SimulatedObject::getOutputTable (  )  const [virtual]

get a reference to the table of the simulated object's outputs

Definition at line 249 of file OMKSimulatedObject.cpp.

References _outputTable.

00250 {
00251    return _outputTable ;
00252 }

const NameToPointerMap< OutputNT > & SimulatedObject::getControlParameterTable (  )  const [virtual]

get a reference to the table of the simulated object's parameters

Definition at line 254 of file OMKSimulatedObject.cpp.

References _controlParameterTable.

00255 {
00256    return _controlParameterTable ;
00257 }

const list< EventListener * > & SimulatedObject::getEventListeners (  )  const [virtual]

get a reference to the list of EventListeners

Definition at line 822 of file OMKSimulatedObject.cpp.

References _listOfEventListeners.

Referenced by OMK::ReferenceObjectHandle::ReferenceObjectHandle().

00823 {
00824    return _listOfEventListeners ;
00825 }

InputNT * SimulatedObject::getPointerToInputNamed ( const Name inputName  )  const [virtual]

get a pointer to an input

Parameters:
inputName the name of the input looked for
Returns:
NULL if the simulated object has no input of name attributeName, a pointer to the input otherwise

Definition at line 156 of file OMKSimulatedObject.cpp.

References _inputTable.

Referenced by OMK::OutputNT::connect(), and ~SimulatedObject().

00157 {
00158   return _inputTable.getObjectOfIndex (nomAtt) ;
00159 } 

OutputNT * SimulatedObject::getPointerToOutputNamed ( const Name outputName  )  const [virtual]

get a pointer to an output

Parameters:
outputName the name of the output looked for
Returns:
NULL if the simulated object has no output of name attributeName, a pointer to the output otherwise

Definition at line 143 of file OMKSimulatedObject.cpp.

References _outputTable, getName(), OMK_DEBUG_OMK_EXEC, and OMTRACEID.

Referenced by OMK::Input< T >::connect(), and ~SimulatedObject().

00144 {
00145    OutputNT * ref = _outputTable.getObjectOfIndex (nomAtt) ;
00146    if (ref == NULL) {
00147      OMTRACEID( OMK_DEBUG_OMK_EXEC, "SimulatedObject::getPointerToOutputNamed: \""
00148                 << nomAtt << "\" is an unknown output for object \"" 
00149                 << getName() << "\"" ) ;
00150    }
00151    return ref ;
00152 }

OutputNT * SimulatedObject::getPointerToControlParameterNamed ( const Name parameterName  )  const [virtual]

get a pointer to a control parameter

Parameters:
parameterName the name of the parameter looked for
Returns:
NULL if the simulated object has no parameter of name attributeName, a pointer to the parameter otherwise

Definition at line 136 of file OMKSimulatedObject.cpp.

References _controlParameterTable.

Referenced by OMK::Input< T >::connectToControlParameter(), and ~SimulatedObject().

00137 {
00138   return _controlParameterTable.getObjectOfIndex (nomAtt) ;
00139 } 

const ConfigurationParameterDescriptor * SimulatedObject::getConfigurationParameters (  )  const [virtual]

get a pointer to the structure describing our configuration parameters

Definition at line 239 of file OMKSimulatedObject.cpp.

References _objectDescriptor, and OMK::ObjectDescriptor::getConfigurationParameters().

Referenced by OMK::MKMHumano::computeParameters(), OMK::Controller::Controller(), OMK::StaticHumano::getInitialiseSequence(), OMK::Iii::IConnector::IConnector(), OMK::PluginsLoaderClass::init(), OMK::ExtensibleSimulatedObject::init(), OMK::Clock::init(), OMK::Inp::DistributedCameraListener::readConfigurationParameters(), and OMK::IAttribute::setOwner().

00239                                                                                            {
00240    return _objectDescriptor.getConfigurationParameters();
00241 }

void SimulatedObject::postConstruction (  )  [virtual]

Complete constructor the object.

Use this method as polymorph. it is called systematically after the object constructor. Can be use to dispatch outputs construction for exmaple.

Reimplemented in OMK::ExtensibleSimulatedObject.

Definition at line 177 of file OMKSimulatedObject.cpp.

00178 {
00179 }

void SimulatedObject::init (  )  [virtual]

initialise the object.

Use this member function for any initilisation than can only be done when all the simulated objects have been created. In particular, plugging the input of the objects should be done here. By default, this member function calls the initialisation of the associated computational object.

Reimplemented in OMK::Clock, OMK::Controller, OMK::ExtensibleSimulatedObject, OMK::PvmController, OMK::Vis::VisBase, and OMK::Inp::DistributedCameraListener.

Definition at line 181 of file OMKSimulatedObject.cpp.

Referenced by OMK::ReferenceObjectHandle::init(), and OMK::ReferenceObjectHandle::initAfterMorphose().

00182 {
00183 }

void SimulatedObject::emigrate (  )  [virtual]

CHADI.

Definition at line 186 of file OMKSimulatedObject.cpp.

00187 {
00188 }

void SimulatedObject::immigrate ( Event event  )  [virtual]

Definition at line 190 of file OMKSimulatedObject.cpp.

Referenced by OMK::DistributedController::processEvent().

00191 {
00192 }

void SimulatedObject::compute (  )  [virtual]

compute evolution of this object.

Reimplemented in OMK::Clock, OMK::Controller, OMK::ExtensibleSimulatedObject, and OMK::Inp::DistributedCameraListener.

Definition at line 196 of file OMKSimulatedObject.cpp.

Referenced by OMK::ReferenceObjectHandle::compute().

00197 {
00198 }

void SimulatedObject::finish (  )  [virtual]

finish calculation of evolution.

by default, this member function does nothing. Finish is usefull in the event of having the simulation restarted whitout complete destruction of the objects

Reimplemented in OMK::Controller, OMK::ExtensibleSimulatedObject, OMK::PvmController, OMK::Vis::VisBase, OMK::Inp::DistributedCameraListener, and OMK::MKMHumano.

Definition at line 202 of file OMKSimulatedObject.cpp.

Referenced by OMK::ExtensibleSimulatedObject::finish().

00203 {
00204 }

void SimulatedObject::extract ( std::istream &  in = std::cin  )  [virtual]

extract pertinant information for this object from an input stream

Parameters:
in the input stream the data is extracted from. By default, this method enables outputs and control paramters to be updated in case the current simulated object is just a miroir of the simulated object doing the calculations

Implements OMK::Flowable.

Definition at line 371 of file OMKSimulatedObject.cpp.

References _controlParameterTable, _outputTable, OMK_DEBUG_OMK_MULTI, and OMTRACEID.

00372 {
00373   OMTRACEID( OMK_DEBUG_OMK_MULTI, "SimulatedObject:" << this << ":extract" ) ;
00374   NameToPointerMap<OutputNT>::iterator pOutput; // iterateur
00375   OutputNT *outputCourante;
00376   NameToPointerMap<OutputNT>::iterator pParam; // iterateur
00377   OutputNT *paramCourant;
00378 
00379   // Pour toutes les outputs, on stocke
00380   for(pOutput= _outputTable.begin(); pOutput!= _outputTable.end(); pOutput++)
00381   {
00382     outputCourante = (*pOutput).second;
00383     in >> *outputCourante;
00384   } 
00385   bool avecParam;
00386   in >> avecParam;
00387   if (avecParam) 
00388   {
00389     OMTRACEID( OMK_DEBUG_OMK_MULTI, "SimulatedObject:" << this << ":extract extract parameters" ) ;
00390     for(pParam= _controlParameterTable.begin(); pParam!= _controlParameterTable.end(); pParam++)
00391     {
00392             paramCourant = (*pParam).second;
00393             in >> *paramCourant;
00394             OMTRACEID( OMK_DEBUG_OMK_MULTI, (*pParam).first ) ;
00395     }
00396   }
00397   OMTRACEID( OMK_DEBUG_OMK_MULTI, "SimulatedObject:" << this << ":extract done " ) ;
00398 }

void SimulatedObject::insertInStream ( std::ostream &  out = std::cout  )  const [virtual]

insert pertinant information for this object in an output stream

Parameters:
out,the output stream the data is written to. By default, this method enables outputs and control paramters to be updated in case the current simulated object is a referential that has to update all it's mirrors

Implements OMK::Flowable.

Definition at line 597 of file OMKSimulatedObject.cpp.

References _controlParameterTable, _outputTable, OMK::ObjectHandle::controlParametersChanged(), getObjectHandle(), getSimulatedDate(), OMK::Controller::initialSimulationDate, OMK_DEBUG_OMK_MULTI, and OMTRACEID.

00598 {
00599   NameToPointerMap<OutputNT>::const_iterator pOutput; // iterateur
00600   OutputNT * outputCourante;
00601   NameToPointerMap<OutputNT>::const_iterator pParam; // iterateur
00602   OutputNT *paramCourant;
00603   OMTRACEID( OMK_DEBUG_OMK_MULTI, "SimulatedObject::insertInStream" ) ;
00604 
00605   // Pour toutes les outputs, on stocke
00606   for(pOutput= _outputTable.begin(); pOutput!= _outputTable.end(); pOutput++)
00607   {
00608     outputCourante = (*pOutput).second;
00609     OMTRACEID( OMK_DEBUG_OMK_MULTI, (*pOutput).first << endl << *outputCourante ) ;
00610     out << *outputCourante << " ";
00611   }  
00612   bool mettreParam = getObjectHandle()->controlParametersChanged()
00613                   || (getSimulatedDate()==Controller::initialSimulationDate) ;
00614   OMTRACEID( OMK_DEBUG_OMK_MULTI, mettreParam ) ;
00615   out << mettreParam << " ";
00616   if(mettreParam) 
00617   {
00618     for(pParam= _controlParameterTable.begin(); pParam!= _controlParameterTable.end(); pParam++) 
00619     {
00620             paramCourant = (*pParam).second;
00621       OMTRACEID( OMK_DEBUG_OMK_MULTI, (*pParam).first ) ;
00622             out << *paramCourant << " ";
00623     }
00624   }
00625   OMTRACEID( OMK_DEBUG_OMK_MULTI, "SimulatedObject:" << this << ":insertInStream done" ) ;
00626 }

void SimulatedObject::unpack ( IncomingSynchronisationMessage  )  [virtual]

unpack an update from a message

Reimplemented from OMK::Flowable.

Definition at line 471 of file OMKSimulatedObject.cpp.

References _controlParameterTable, _outputTable, OMK::SynchronisationMessage::controlParameters, OMK::SynchronisationMessage::endOfSynchronisationFragment, OMK::SynchronisationMessage::noControlParameters, OMASSERT, OMK_DEBUG_OMK_MULTI, OMTRACEID, and OMK::Name::unpack().

Referenced by OMK::PvmController::parseSynchronisationMessage(), OMK::PvmReferenceObjectHandle::unpack(), and OMK::PvmMirrorObjectHandle::unpack().

00472 {
00473   OMTRACEID( OMK_DEBUG_OMK_MULTI, "SimulatedObject:"<< this <<":unpack" ) ;
00474   Name attributeName ;
00475   NameToPointerMap<OutputNT>::iterator pOutput = _outputTable.begin();
00476 
00477   attributeName.unpack( in ) ;
00478   while( (attributeName != SynchronisationMessage::controlParameters)
00479             && (attributeName != SynchronisationMessage::noControlParameters) )
00480   {
00481           if ( pOutput->first == attributeName )
00482           {
00483       (pOutput->second)->unpack(in) ;
00484       ++pOutput ;
00485           }
00486           else
00487           {
00488             do 
00489                   {
00490         ++pOutput ;
00491         OMASSERT ( pOutput != _outputTable.end() ) ;// a new output has been added : not accepted
00492                   } while ( pOutput->first != attributeName ) ;
00493 
00494       (pOutput->second)->unpack ( in ) ;
00495       ++pOutput ;
00496     }
00497           attributeName.unpack ( in ) ;
00498   }
00499    
00500   if (attributeName == SynchronisationMessage::controlParameters) 
00501   {
00502     //the control parameters have been added to the synchronisation message
00503     pOutput =  _controlParameterTable.begin();
00504     attributeName.unpack ( in ) ;
00505     while ( attributeName != SynchronisationMessage::endOfSynchronisationFragment )
00506     {
00507       if ( pOutput->first == attributeName )
00508       {
00509         (pOutput->second)->unpack( in ) ;
00510         ++pOutput ;
00511       }
00512       else
00513       {
00514         do 
00515         {
00516           ++pOutput ;
00517           OMASSERT ( pOutput != _controlParameterTable.end() ) ;// a new control parameter has been added : not accepted
00518         } while ( pOutput->first != attributeName ) ;
00519 
00520         (pOutput->second)->unpack (in) ;
00521         ++pOutput ;
00522       }
00523       attributeName.unpack ( in ) ;
00524     }
00525   }
00526   else
00527   { // consume the OMKPvmMessage::endOfSyncronisationMessage 
00528     attributeName.unpack ( in ) ;
00529   }    
00530 }

void SimulatedObject::unpackAllValues ( IncomingSynchronisationMessage  )  [virtual]

unpack all necessary info if the object is a mirror from a message

Definition at line 533 of file OMKSimulatedObject.cpp.

References _controlParameterTable, _outputTable, OMK::SynchronisationMessage::controlParameters, OMK::SynchronisationMessage::endOfSynchronisationFragment, OMK::SynchronisationMessage::noControlParameters, OMASSERT, OMK_DEBUG_OMK_MULTI, OMTRACEID, and OMK::Name::unpack().

Referenced by OMK::PvmMirrorObjectHandle::unpack().

00534 {
00535   OMTRACEID( OMK_DEBUG_OMK_MULTI, "SimulatedObject:"<< this <<":unpackAllValues" ) ;
00536   Name attributeName ;
00537   NameToPointerMap<OutputNT>::iterator pOutput = _outputTable.begin();
00538 
00539   attributeName.unpack( in ) ;
00540   while( (attributeName != SynchronisationMessage::controlParameters)
00541     && (attributeName != SynchronisationMessage::noControlParameters) )
00542   {
00543     if ( pOutput->first == attributeName )
00544     {
00545       (pOutput->second)->unpackAllValues(in) ;
00546       ++pOutput ;
00547     }
00548     else
00549     {
00550       do 
00551       {
00552         ++pOutput ;
00553         OMASSERT ( pOutput != _outputTable.end() ) ;// a new output has been added : not accepted
00554       } while ( pOutput->first != attributeName ) ;
00555 
00556       (pOutput->second)->unpackAllValues ( in ) ;
00557       ++pOutput ;
00558     }
00559     attributeName.unpack ( in ) ;
00560   }
00561 
00562   if (attributeName == SynchronisationMessage::controlParameters) 
00563   {
00564     //the control parameters have been added to the synchronisation message
00565     pOutput =  _controlParameterTable.begin();
00566     attributeName.unpack ( in ) ;
00567     while ( attributeName != SynchronisationMessage::endOfSynchronisationFragment )
00568     {
00569       if ( pOutput->first == attributeName )
00570       {
00571         (pOutput->second)->unpackAllValues( in ) ;
00572         ++pOutput ;
00573       }
00574       else
00575       {
00576         do 
00577         {
00578           ++pOutput ;
00579           OMASSERT ( pOutput != _controlParameterTable.end() ) ;// a new control parameter has been added : not accepted
00580         } while ( pOutput->first != attributeName ) ;
00581 
00582         (pOutput->second)->unpackAllValues (in) ;
00583         ++pOutput ;
00584       }
00585       attributeName.unpack ( in ) ;
00586     }
00587   }
00588   else
00589   {
00590     // consume the OMKPvmMessage::endOfSyncronisationMessage 
00591     attributeName.unpack ( in ) ;
00592   }    
00593 }

void SimulatedObject::pack ( OutgoingSynchronisationMessage  )  const [virtual]

pack update information in a message

Reimplemented from OMK::Flowable.

Definition at line 401 of file OMKSimulatedObject.cpp.

References _controlParameterTable, _outputTable, OMK::SynchronisationMessage::controlParameters, OMK::ObjectHandle::controlParametersChanged(), OMK::SynchronisationMessage::endOfSynchronisationFragment, getObjectHandle(), getSimulatedDate(), OMK::Controller::initialSimulationDate, OMK::SynchronisationMessage::noControlParameters, OMASSERT, OMK_DEBUG_OMK_MULTI, and OMTRACEID.

00402 {
00403   //make sure the object has been encapsulated in an object handle
00404   OMASSERT( getObjectHandle() != NULL ) ;
00405   OMTRACEID( OMK_DEBUG_OMK_MULTI, "SimulatedObject:" << this << ":pack" ) ;
00406 
00407   // store the value of all outputs
00408   for( NameToPointerMap<OutputNT>::const_iterator pOutput = _outputTable.begin(); 
00409        pOutput != _outputTable.end(); 
00410        ++pOutput)
00411   {
00412     OMTRACEID( OMK_DEBUG_OMK_MULTI, (*pOutput).first ) ;
00413     pOutput->second->pack (out) ;
00414   } 
00415   
00416   bool mettreParam = ( getObjectHandle()->controlParametersChanged() ) || 
00417                      (getSimulatedDate() == Controller::initialSimulationDate) ;
00418 
00419   OMTRACEID( OMK_DEBUG_OMK_MULTI, "SimulatedObject:" << this << ":pack: " << ( mettreParam ? "packing control parameters" : "control parameters not packed" ) );
00420 
00421   if(mettreParam) 
00422   {
00423     out << SynchronisationMessage::controlParameters;
00424     for( NameToPointerMap<OutputNT>::const_iterator pParam= _controlParameterTable.begin(); 
00425                pParam!= _controlParameterTable.end(); 
00426                pParam++) 
00427     {
00428       OMTRACEID( OMK_DEBUG_OMK_MULTI, (*pParam).first ) ;
00429       (*pParam).second->pack(out) ;
00430     }
00431   }
00432   else
00433   {
00434           out << SynchronisationMessage::noControlParameters;
00435   }
00436   OMTRACEID( OMK_DEBUG_OMK_MULTI, "SimulatedObject:" << this << ":pack done " ) ;
00437   out << SynchronisationMessage::endOfSynchronisationFragment ;
00438 }

void SimulatedObject::packAllValues ( OutgoingSynchronisationMessage  )  const [virtual]

pack initial information in a message

Definition at line 440 of file OMKSimulatedObject.cpp.

References _controlParameterTable, _outputTable, OMK::SynchronisationMessage::controlParameters, OMK::SynchronisationMessage::endOfSynchronisationFragment, getObjectHandle(), OMASSERT, OMK_DEBUG_OMK_MULTI, and OMTRACEID.

Referenced by OMK::PvmReferenceObjectHandle::packInitialValues().

00441 {
00442   //make sure the object has been encapsulated in an object handle
00443   OMASSERT (getObjectHandle() != NULL) ;
00444 
00445   OMTRACEID( OMK_DEBUG_OMK_MULTI, "SimulatedObject:"<< this <<":packAllValues" ) ;
00446 
00447   // store the value of all outputs
00448   for( NameToPointerMap<OutputNT>::const_iterator pOutput = _outputTable.begin(); 
00449        pOutput != _outputTable.end(); 
00450        ++pOutput)
00451   {
00452     OMTRACEID( OMK_DEBUG_OMK_MULTI, (*pOutput).first ) ;
00453           pOutput->second->packAllValues (out) ;
00454   } 
00455   
00456   OMTRACEID( OMK_DEBUG_OMK_MULTI, "SimulatedObject:"<< this <<":pack: packing control parameters" ) ;
00457   out<<SynchronisationMessage::controlParameters;
00458   for( NameToPointerMap<OutputNT>::const_iterator pParam = _controlParameterTable.begin(); 
00459        pParam!= _controlParameterTable.end(); 
00460        pParam++) 
00461   {
00462     OMTRACEID( OMK_DEBUG_OMK_MULTI, (*pParam).first ) ;
00463     (*pParam).second->packAllValues(out) ;
00464   }
00465 
00466   OMTRACEID( OMK_DEBUG_OMK_MULTI, "SimulatedObject:"<< this <<":pack done " ) ;
00467   out << SynchronisationMessage::endOfSynchronisationFragment ;
00468 }

void SimulatedObject::prepareEventProcessing ( std::list< Event * > &   )  [virtual]

prepareEventProcessing called before any events are processed if any clean up is needed after the preceeding simulation step

Definition at line 354 of file OMKSimulatedObject.cpp.

Referenced by OMK::ReferenceObjectHandle::processEvents().

00354                                                                 {
00355 
00356 }

bool SimulatedObject::processEvent ( Event  )  [virtual]

process an event for this object.

the event will be automatically deleted if the return value of the call is true, otherwise deletion becomes the responsability of the object

Reimplemented in OMK::DistributedController, OMK::Clock, OMK::Controller, and OMK::Vis::VisBase.

Definition at line 358 of file OMKSimulatedObject.cpp.

Referenced by OMK::Vis::VisBase::processEvent(), OMK::Clock::processEvent(), and OMK::ReferenceObjectHandle::processEvents().

00358                                                  {
00359    return true ;
00360 }

void SimulatedObject::eventsProcessed ( std::list< Event * > &   )  [virtual]

eventsProcessed called once all the events have been handled to processEvent, and those who have been succesfully processed (processEvent having return true ) have been destroyed

Definition at line 362 of file OMKSimulatedObject.cpp.

Referenced by OMK::ReferenceObjectHandle::processEvents().

00362                                                          {
00363 
00364 }

bool SimulatedObject::processEventsASAP (  )  const [virtual]

event processing mode.

Returns:
: true if events need to be processed at the controler's frequency rather then at the object's one normal use of this member function would be to redefine it for objects who need to process events as fast as possible. if the return value is dynamic, supprises could arise because of the use of a double buffer for the list of events.

Definition at line 347 of file OMKSimulatedObject.cpp.

Referenced by OMK::ReferenceObjectHandle::receiveEvent().

00348  {
00349     //default mode : processEvents at the object's frequency.
00350     return false ;
00351  }

void SimulatedObject::addEventListener ( EventListener  )  [virtual]

Event listener registration.

Called to register the event listener in the object. Most of the listeners register themself in their constructor. The referenced event listener can be deleted, it will call automatically unregisterEventListener.

Definition at line 837 of file OMKSimulatedObject.cpp.

References _listOfEventListeners, getObjectHandle(), and OMK::EventListener::registerEvents().

Referenced by OMK::ChangedControlParameterEventListener< T >::ChangedControlParameterEventListener(), OMK::EventListenerCallBack< CallerClass >::EventListenerCallBack(), OMK::InputConnectionEventListener< T >::InputConnectionEventListener(), OMK::Inp::InputExtension::loadExtensionParameters(), and OMK::ValuedEventListenerCallBack< CallerClass, PrmType >::ValuedEventListenerCallBack().

00838 {
00839   // To avoid twice registration of the same event handler
00840   if( find(_listOfEventListeners.begin(), _listOfEventListeners.end(), & eventListener ) == _listOfEventListeners.end() )
00841   {
00842     _listOfEventListeners.push_front( &eventListener ) ;
00843     if( getObjectHandle() ) 
00844     {
00845       eventListener.registerEvents() ;
00846     }
00847   }
00848 }

void SimulatedObject::registerEventListenerForEvent ( EventListener eventListener,
const EventIdentifier eventId 
)

Event listener registration for an event id.

Called by the event listener in its registerEvents for registration of the eventId listened to.

Definition at line 850 of file OMKSimulatedObject.cpp.

References getObjectHandle(), OMASSERT, and OMK::ObjectHandle::registerEventListenerForEvent().

Referenced by OMK::ValuedEventListenerCallBack< CallerClass, PrmType >::registerEvents(), OMK::Inp::InputCreatorListener::registerEvents(), OMK::InputConnectionEventListener< T >::registerEvents(), OMK::EventListenerCallBack< CallerClass >::registerEvents(), and OMK::ChangedControlParameterEventListener< T >::registerEvents().

00852 {
00853    //this member function should only be called by event listeners when registering the events they are associated to
00854    //this registration process is initiated during the creation of the assocaited object handle
00855    // or after its creation
00856    //therefore, the following assertion should allways be verified
00857    OMASSERT( getObjectHandle() ); 
00858 
00859    getObjectHandle()->registerEventListenerForEvent( eventListener , eventId ) ;
00860 }

void SimulatedObject::unregisterEventListener ( EventListener eventListener  ) 

Unregistration of an event listener for the simulation object.

Parameters:
eventListener The event listener to unreference.
This method is call in the destructor of the event listener to clear the reference to the listener in the event processing of the object. This method is called for each event listener which stay in the object during the destruction of the object.

Definition at line 862 of file OMKSimulatedObject.cpp.

References _listOfEventListeners, getObjectHandle(), OMASSERT, and OMK::ObjectHandle::unregisterEventListener().

Referenced by OMK::EventListener::~EventListener().

00863 {
00864   std::list <EventListener *>::iterator listener = find(_listOfEventListeners.begin(), _listOfEventListeners.end(), & eventListener ) ;
00865   _listOfEventListeners.erase( listener ) ;
00866    //this member function is only called by the destructor of the event listeners 
00867    OMASSERT( getObjectHandle() ); 
00868 
00869    getObjectHandle()->unregisterEventListener( eventListener ) ;
00870 }

void SimulatedObject::fireSignal ( const EventIdentifier sig  ) 

fire a signal wich will be seen by anybody registred for that signal

Parameters:
sig : the event identifier to be fired

Definition at line 632 of file OMKSimulatedObject.cpp.

References OMK::Controller::broadcastEventsForSignal(), getController(), getName(), getObjectHandle(), getSimulatedDate(), OMTRACE, and OMK::ObjectHandle::sendEventsForSignal().

Referenced by OMK::Controller::computeScheduling(), and OMK::EventSignalEmitterUtil::sendUtil().

00633 {
00634   Event event(sig,getSimulatedDate(),getName(),getName()) ;
00635   //does firing a signal during creation have any sense ? yes
00636 
00637 
00638   if ( dynamic_cast<ReferenceObjectHandle *> ( getObjectHandle()) != NULL) {
00639     if (getObjectHandle() != NULL ) 
00640     {
00641       getObjectHandle()->sendEventsForSignal( event , sig ) ;
00642     }
00643     else
00644     {  
00645       // no registration can have taken place, as this should only happen at object creation,
00646       // so just broadcast the signal
00647       getController().broadcastEventsForSignal ( event, sig ) ;
00648     }
00649   }
00650   else OMTRACE("ERREUR No send Event when SimObj DEAD");
00651 }

template<typename UserType>
void OMK::SimulatedObject::fireValuedSignal ( const EventIdentifier sig,
const UserType &  value 
)

fire a signal which carries an associated value

Parameters:
sig : the event identifier to be fired
value : the value carried by the signal

Definition at line 35 of file OMKSimulatedObject.inl.

References OMK::Controller::broadcastEventsForSignal(), getController(), getName(), getObjectHandle(), getSimulatedDate(), and OMK::ObjectHandle::sendEventsForSignal().

Referenced by OMK::BasicHumano::computeParameters(), OMK::IAttributeT< PrmType, ModelType, AccessorType >::fireIdAndValue(), OMK::IAttributeT< PrmType, ModelType, AccessorType >::fireValue(), OMK::DistributedController::getPointerToSimulatedObjectNamed(), OMK::Vis::VisObjectExtension::loadAnimatorParameters(), OMK::BasicHumano::loadParameters(), OMK::Inp::DistributedCameraOgreListener::postComputeParameters(), OMK::Vis::VisBase::processAddVisualObjectEvent(), OMK::Controller::processDeleteEventOf(), OMK::DistributedController::processEvent(), OMK::Controller::processEvent(), OMK::MultiValuedEventSignalEmitterUtilT< T, ModelType >::sendUtil(), and OMK::ValuedEventSignalEmitterUtilT< T, ModelType >::sendUtil().

00037 {
00038   ValuedEvent< UserType > event( sig, getSimulatedDate(), getName(),
00039                                  getName(), value) ;
00040   if( getObjectHandle() != 0 )
00041   {
00042     getObjectHandle()->sendEventsForSignal( event , sig ) ;
00043   }
00044   else
00045   {
00046     getController().broadcastEventsForSignal( event, sig ) ;
00047   }
00048 }

bool SimulatedObject::registerForSignalBy ( const EventIdentifier sig,
const Name producer 
) [virtual]

register for a signal fired by a particular simulated object

Parameters:
sig the identifier of the signal registered, which will be the event identifier of the event generated
producer the object to whom one is registering
Returns:
true if registration was successfull

Definition at line 653 of file OMKSimulatedObject.cpp.

Referenced by OMK::IAttribute::activateConnectBySignal(), OMK::IAttribute::activateGetBySignal(), OMK::IAttribute::activateSetBySignal(), OMK::IAttribute::activateSetBySignalOf(), OMK::HumanoRecorder::loadParameters(), OMK::loadSignalRegistrationParameters(), OMK::PvmController::PvmController(), OMK::Vis::VisBase::registerEventPlug(), and registerForSignalBy().

00655 {
00656    return registerForSignalBy ( sig, producer, sig ) ;
00657 }

bool SimulatedObject::registerForSignalBy ( const EventIdentifier sig,
const Name producer,
const EventIdentifier eventId 
) [virtual]

register for a signal fired by a particular simulated object

Parameters:
sig the identifier of the signal registered
producer the object to whom one is registering
eventId the event identifier to be sent when sig is generated (== sig by default)
Returns:
true if registration was successfull

Definition at line 661 of file OMKSimulatedObject.cpp.

References _controller, OMK::Controller::addToPendingRegistrations(), getController(), getName(), OMK::Controller::getPointerToSimulatedObjectNamed(), and registerForSignalBy().

00664 {
00665    SimulatedObject * pointerToProducer ;
00666    pointerToProducer = _controller.getPointerToSimulatedObjectNamed ( producer );
00667    if (pointerToProducer != NULL) 
00668       {
00669          return registerForSignalBy(sig, pointerToProducer, eventId);
00670       }
00671    else 
00672       {
00673          return getController().addToPendingRegistrations ( sig , producer, eventId, getName() ) ;
00674       }
00675 }

bool SimulatedObject::registerForSignalBy ( const EventIdentifier sig,
SimulatedObject producer 
) [virtual]

register for a signal fired by a particular simulated object

Parameters:
sig the identifier of the signal registered, which will be the event identifier of the event generated
producer the object to whom one is registering
Returns:
true if registration was successfull

Definition at line 679 of file OMKSimulatedObject.cpp.

References registerForSignalBy().

00681 {
00682    return registerForSignalBy ( sig , producer , sig ) ;
00683 }

bool SimulatedObject::registerForSignalBy ( const EventIdentifier sig,
SimulatedObject producer 
) [virtual]

register for a signal fired by a particular simulated object

Parameters:
sig the identifier of the signal registered, which will be the event identifier of the event generated
producer the object to whom one is registering
Returns:
true if registration was successfull

Definition at line 687 of file OMKSimulatedObject.cpp.

References registerForSignalBy().

00689 {
00690    return registerForSignalBy ( sig , producer , sig ) ;
00691 }

bool SimulatedObject::registerForSignalBy ( const EventIdentifier sig,
SimulatedObject producer,
const EventIdentifier eventId 
) [virtual]

register for a signal fired by a particular simulated object

Parameters:
sig the identifier of the signal registered
producer the object to whom one is registering
eventId the event identifier to be sent when sig is generated
Returns:
true if registration was successfull

Definition at line 695 of file OMKSimulatedObject.cpp.

References OMK::Controller::addToPendingRegistrations(), getController(), getName(), getObjectHandle(), OMASSERT, and OMK::ObjectHandle::receiveRegistrationForSignal().

00698 {
00699    OMASSERT ( producer != NULL ) ;
00700    //unless registring for oneself during creation, the next if branch should allways be verified
00701    if (producer->getObjectHandle() != NULL)
00702       {
00703          return producer->getObjectHandle()->receiveRegistrationForSignal ( sig, getName(), eventId ) ;
00704       }
00705    else 
00706       {
00707          return getController().addToPendingRegistrations (sig, 
00708                                                            producer->getName() ,
00709                                                            eventId,
00710                                                            getName() ) ;
00711       }
00712 }

bool SimulatedObject::registerForSignalBy ( const EventIdentifier sig,
SimulatedObject producer,
const EventIdentifier eventId 
) [virtual]

register for a signal fired by a particular simulated object

Parameters:
sig the identifier of the signal registered
producer the object to whom one is registering
eventId the event identifier to be sent when sig is generated
Returns:
true if registration was successfull

Definition at line 716 of file OMKSimulatedObject.cpp.

References OMK::Controller::addToPendingRegistrations(), getController(), getName(), getObjectHandle(), and OMK::ObjectHandle::receiveRegistrationForSignal().

00719 {
00720    if (producer.getObjectHandle() != NULL)
00721       {
00722          //unless registring for oneself during creation, the next if branch should allways be verified
00723          return producer.getObjectHandle()->receiveRegistrationForSignal ( sig, getName(), eventId ) ;
00724       }
00725    else 
00726       {
00727          return getController().addToPendingRegistrations (sig, 
00728                                                            producer.getName(),
00729                                                            eventId,
00730                                                            getName() ) ;
00731       }
00732 }

bool SimulatedObject::registerForSignal ( const EventIdentifier sig  )  [virtual]

register for a particular signal fired by anybody

Parameters:
sig the identifier of the signal registered, which will be the event identifier of the event generated
Returns:
true if registration was successfull

Definition at line 736 of file OMKSimulatedObject.cpp.

References _controller, getName(), and OMK::Controller::receiveRegistrationForSignal().

Referenced by OMK::IAttribute::activateConnectBySignal(), OMK::IAttribute::activateGetBySignal(), OMK::IAttribute::activateSetBySignal(), OMK::IAttribute::activateSetBySignalOf(), OMK::Vis::VisBase::init(), OMK::EventSignalEmitterUtil::loadParametersUtil(), OMK::loadSignalRegistrationParameters(), and OMK::Vis::VisBase::registerEventPlug().

00737 {
00738   return _controller.receiveRegistrationForSignal ( sig, getName(), sig);
00739 }

bool SimulatedObject::registerForSignal ( const EventIdentifier sig,
const EventIdentifier eventId 
) [virtual]

register for a particular signal fired by anybody

Parameters:
sig the identifier of the signal registered
eventId the event identifier to be sent when sig is generated
Returns:
true if registration was successfull

Definition at line 743 of file OMKSimulatedObject.cpp.

References _controller, getName(), and OMK::Controller::receiveRegistrationForSignal().

00745 {
00746   return _controller.receiveRegistrationForSignal ( sig, getName(), eventId );
00747 }

bool SimulatedObject::cancelRegistrationForSignalBy ( const EventIdentifier sig,
const Name producer 
) [virtual]

cancel registration for a signal fired by a particular simulated object

Parameters:
sig the identifier of the signal being canceled
producer the object to whom one is canceling registration
Returns:
true if cancelation was successfull

Definition at line 751 of file OMKSimulatedObject.cpp.

References _controller, getController(), getName(), OMK::Controller::getPointerToSimulatedObjectNamed(), and OMK::Controller::removeFromPendingRegistrations().

00751                                                                                                      {
00752    SimulatedObject * pointerToProducer ;
00753    pointerToProducer = _controller.getPointerToSimulatedObjectNamed( producer );
00754    if (pointerToProducer != NULL) 
00755       {
00756          return cancelRegistrationForSignalBy(sig,pointerToProducer);
00757       }
00758    else 
00759       {
00760          return getController().removeFromPendingRegistrations ( sig, producer, getName() ) ;
00761       }
00762 }

bool SimulatedObject::cancelRegistrationForSignalBy ( const EventIdentifier sig,
SimulatedObject producer 
) [virtual]

cancel registration for a signal fired by a particular simulated object

Parameters:
sig the identifier of the signal being canceled
producer the object to whom one is canceling registration
Returns:
true if cancelation was successfull

Definition at line 764 of file OMKSimulatedObject.cpp.

References OMK::ObjectHandle::cancelRegistrationForSignal(), getController(), getName(), getObjectHandle(), OMASSERT, and OMK::Controller::removeFromPendingRegistrations().

00765 {
00766    OMASSERT ( producer != NULL ) ;
00767    //unless canceling a registration for oneself during creation, the next if sould be verified
00768    if ( producer->getObjectHandle() != NULL )
00769       {
00770          return producer->getObjectHandle()->cancelRegistrationForSignal ( sig, getName() ) ;
00771       }
00772    else
00773       {
00774          return getController().removeFromPendingRegistrations (sig, producer->getName(), getName() ) ;
00775       }
00776 }

bool SimulatedObject::cancelRegistrationForSignalBy ( const EventIdentifier sig,
SimulatedObject producer 
) [virtual]

cancel registration for a signal fired by a particular simulated object

Parameters:
sig the identifier of the signal being canceled
producer the object to whom one is canceling registration
Returns:
true if cancelation was successfull

Definition at line 778 of file OMKSimulatedObject.cpp.

References OMK::ObjectHandle::cancelRegistrationForSignal(), getController(), getName(), getObjectHandle(), and OMK::Controller::removeFromPendingRegistrations().

00779 {
00780    //unless canceling a registration for oneself during creation, the next assertion sould be verified
00781    if ( producer.getObjectHandle() != NULL )
00782       {    
00783          return producer.getObjectHandle()->cancelRegistrationForSignal ( sig, getName() ) ;
00784       }
00785    else
00786       {
00787          return getController().removeFromPendingRegistrations (sig, producer.getName(), getName() ) ;
00788       }
00789 }

bool SimulatedObject::cancelRegistrationForSignal ( const EventIdentifier sig  )  [virtual]

cancel registration for a particular signal fired by anybody

Parameters:
sig the identifier of the signal cancelled
Returns:
true if cancelelation was successfull

Definition at line 792 of file OMKSimulatedObject.cpp.

References _controller, getName(), and OMK::Controller::receiveCancellationForSignal().

Referenced by OMK::Vis::VisBase::finish().

00793 {
00794    return _controller.receiveCancellationForSignal(sig,getName());
00795 }

template<typename Type>
Input< Type > & OMK::SimulatedObject::addInput ( const Name inputName,
bool  makeConnectable = false,
int  precisionLevel = OMK::Type::PolatorNT::defaultPrecisionLevel 
)

add a input to the simulated object

Parameters:
inputName name of the added input
makeConnectable allow other simulated objects to change the connection of the created input
precisionLevel quality of the polations associated with the created input
Returns:
a reference to the created input

Definition at line 51 of file OMKSimulatedObject.inl.

References _controller, _inputTable, OMK::debugMsg(), getName(), OMK_DEBUG_OMK_EXEC, and OMTRACEID.

00054 {
00055   InputNT *redefinedInput( _inputTable.getObjectOfIndex( inputName ) ) ;
00056   Input< Type > * input( 0 ) ;
00057   if( redefinedInput == 0 )
00058   {
00059     input = _controller.template createInput< Type >( inputName, *this,
00060                                                       makeConnectable,
00061                                                       precisionLevel ) ;
00062   }
00063   else 
00064   {
00065     input = dynamic_cast< Input< Type > * >( redefinedInput ) ;
00066     if( input == 0 ) 
00067     {
00068       throw UnallowedOverloadingException( inputName, getName() ) ;
00069     }
00070     else 
00071     {
00072       OMTRACEID( OMK_DEBUG_OMK_EXEC, "input \"" << inputName
00073                  << "\" of " << OMK::debugMsg( this )
00074                  <<" already defined. No new input created : reference to old one used" ) ;
00075     }
00076   }
00077   return *input ;
00078 }

template<typename Type>
SensitiveInput< Type > & OMK::SimulatedObject::addSensitiveInput ( const Name inputName,
bool  makeConnectable = false,
int  precisionLevel = OMK::Type::PolatorNT::defaultPrecisionLevel 
)

add a sensitive input to the simulated object

Parameters:
inputName name of the added input
makeConnectable allow other simulated objects to change the connection of the created input
precisionLevel quality of the polations associated with the created input
Returns:
a reference to the created input

Definition at line 81 of file OMKSimulatedObject.inl.

References _controller, _inputTable, OMK::debugMsg(), getName(), OMK_DEBUG_OMK_EXEC, and OMTRACEID.

00084 {
00085   InputNT *redefinedInput( _inputTable.getObjectOfIndex( inputName ) ) ;
00086   SensitiveInput< Type > *input( 0 ) ;
00087   if( redefinedInput == 0 )
00088   {
00089     input = _controller.template createSensitiveInput< Type >( inputName,
00090                                                                *this,
00091                                                                makeConnectable,
00092                                                                precisionLevel );
00093   }
00094   else
00095   {
00096     input = dynamic_cast< SensitiveInput< Type > * >( redefinedInput ) ;
00097     if( input == 0 )
00098     {
00099       throw UnallowedOverloadingException( inputName, getName() ) ;
00100     }
00101     else 
00102     {
00103       OMTRACEID( OMK_DEBUG_OMK_EXEC, "sensitiveInput \"" << inputName
00104                  << "\" of " << OMK::debugMsg( this )
00105                  <<" already defined. No new sensitiveInput created : reference to old one used" ) ;
00106     }
00107   }
00108   return *input ;
00109 }

template<typename Type>
SensitiveNotifyingInput< Type > & OMK::SimulatedObject::addSensitiveNotifyingInput ( const Name inputName,
bool  makeConnectable = false,
int  precisionLevel = OMK::Type::PolatorNT::defaultPrecisionLevel 
)

add a sensitive Notifying input to the simulated object

Parameters:
inputName name of the added input
makeConnectable allow other simulated objects to change the connection of the created input
precisionLevel quality of the polations associated with the created input
Returns:
a reference to the created input

Definition at line 112 of file OMKSimulatedObject.inl.

References _controller, _inputTable, OMK::debugMsg(), getName(), OMK_DEBUG_OMK_EXEC, and OMTRACEID.

00116 {
00117   InputNT *redefinedInput( _inputTable.getObjectOfIndex( inputName ) ) ;
00118   SensitiveNotifyingInput< Type > *input( 0 ) ;
00119   if( redefinedInput == 0 ) 
00120   {
00121     input = _controller.template createSensitiveNotifyingInput< Type >(
00122       inputName, *this, makeConnectable, precisionLevel ) ;
00123   }
00124   else 
00125   {
00126     input = dynamic_cast< SensitiveNotifyingInput< Type > * >( redefinedInput ) ;
00127     if( input == 0 )
00128     {
00129       throw UnallowedOverloadingException( inputName, getName() ) ;
00130     }
00131     else 
00132     {
00133       OMTRACEID( OMK_DEBUG_OMK_EXEC, "sensitiveNotifyingInput \"" << inputName
00134                  << "\" of " << OMK::debugMsg( this ) 
00135                  << " already defined. No new sensitiveNotifyingInput created : reference to old one used" ) ;
00136     }
00137   }
00138   return *input ; 
00139 }

void SimulatedObject::deleteInput ( const Name inputName  ) 

delete an input from the list of inputs of the simulated object WARNING : consideration is being given for the removal of this member function

Parameters:
inputName the name of the input to be deleted

Definition at line 127 of file OMKSimulatedObject.cpp.

References _inputTable.

Referenced by OMK::Iii::SharedConnectorT< Type >::connect(), OMK::Iii::SharedConnectorT< Type >::disconnect(), OMK::Iii::SimpleConnectorT< Type >::disconnect(), and OMK::IAttributeT< PrmType, ModelType, AccessorType >::~IAttributeT().

00128 {
00129   InputNT * obj = _inputTable[ name ] ;
00130   _inputTable.erase( name ) ;
00131   delete obj ;
00132 }

template<typename Type>
Output< Type > & OMK::SimulatedObject::addOutput ( const Name outputName,
OMK::Type::PolatorNT polator = 0 
)

add an output to the simulated object

Parameters:
outputName name of the output to add
polator optional argument use to override the default polateur for Type

Definition at line 142 of file OMKSimulatedObject.inl.

References _controller, _outputTable, OMK::debugMsg(), getName(), OMK_DEBUG_OMK_EXEC, and OMTRACEID.

00144 {
00145   OutputNT *redefinedOutput( _outputTable.getObjectOfIndex( outputName ) ) ;
00146   Output< Type > *output( 0 );
00147   if( redefinedOutput == 0 )
00148   {
00149     output = _controller.template createOutput< Type >( outputName, *this,
00150                                                         polator ) ;
00151   }
00152   else 
00153   {
00154     output = dynamic_cast< Output< Type > * >( redefinedOutput ) ;
00155     if( output == 0 )
00156     {
00157       throw UnallowedOverloadingException( outputName, getName() ) ;
00158     }
00159     else 
00160     {
00161       OMTRACEID( OMK_DEBUG_OMK_EXEC, "output \"" << outputName << "\" of "
00162                  << OMK::debugMsg( this )
00163                  << " already defined. No new output created : reference to old one used" ) ;
00164     }
00165   } 
00166   _outputTable.addObjectWithIndex( outputName, output ) ;
00167   return *output ;
00168 }

template<typename Type>
ControlParameter< Type > & OMK::SimulatedObject::addControlParameter ( const Name controlParameterName,
OMK::Type::PolatorNT polator = 0 
)

add a control parameter to the simulated object

Parameters:
controlParamaterName name of the control parameter to add
polator optional argument use to override the default polateur for Type

Definition at line 171 of file OMKSimulatedObject.inl.

References _controller, _controlParameterTable, OMK::debugMsg(), getName(), OMASSERT, OMK_DEBUG_OMK_EXEC, and OMTRACEID.

00174 {
00175   OutputNT *redefinedControlParameter( _controlParameterTable.getObjectOfIndex(
00176                                          controlParameterName ) ) ;
00177   ControlParameter< Type > *controlParameter( 0 ) ;
00178   if( redefinedControlParameter == 0 )
00179   {
00180     controlParameter = _controller.template createControlParameter< Type >(
00181       controlParameterName, *this, polator ) ;
00182   }
00183   else 
00184   {
00185     controlParameter = dynamic_cast < ControlParameter<Type> * >(
00186       redefinedControlParameter ) ;
00187     if( controlParameter == 0 )
00188     {
00189       throw UnallowedOverloadingException( controlParameterName, getName() ) ;
00190     }
00191     else 
00192     {
00193       OMTRACEID( OMK_DEBUG_OMK_EXEC, "controlParameter \"" <<
00194                  controlParameterName << "\" of " << OMK::debugMsg( this )
00195                  <<" already defined. No new controlParameter created : reference to old one used" ) ;
00196     }
00197   }
00198   OutputNT *realControlParameter( dynamic_cast< OutputNT * >( controlParameter ) ) ;
00199   OMASSERT( realControlParameter != 0 ) ; 
00200   _controlParameterTable.addObjectWithIndex( controlParameterName,
00201                                              realControlParameter ) ;
00202   return *controlParameter ;
00203 }

template<typename Type>
InputAlias< Type > & OMK::SimulatedObject::addInputAlias ( const Name aliasName,
const Name aliasedObjectName,
const Name aliasedInputName,
int  precisionLevel = OMK::Type::PolatorNT::defaultPrecisionLevel 
)

add an input which is an alias to an input of an other object

Parameters:
aliasName name of the added input
aliasedObjectName the of the object being aliased. aliasedObjectName should be a simulated object ancestor of the current object
aliasedInputName name of the input aliased
makeConnectable allow other simulated objects to change the connection of the created input
precisionLevel quality of the polations associated with the created input
Returns:
a reference to the created input

Definition at line 206 of file OMKSimulatedObject.inl.

References _controller, _inputTable, OMK::debugMsg(), OMK::Controller::error(), getName(), OMK::Controller::getPointerToSimulatedObjectNamed(), isAncestor(), OMERROR, OMK_DEBUG_OMK_EXEC, and OMTRACEID.

00210 {
00211   InputNT *redefinedInput( _inputTable.getObjectOfIndex( aliasName ) ) ;
00212   InputAlias< Type > *alias( 0 ) ;
00213   if( redefinedInput == 0 )
00214   {
00215     // make sure aliasedObjectName is an ancestor of object
00216     if( isAncestor( aliasedObjectName ) )
00217     {
00218       SimulatedObject *obj( _controller.getPointerToSimulatedObjectNamed(
00219                               aliasedObjectName ) ) ;
00220       InputNT *input( obj->_inputTable.getObjectOfIndex( aliasedInputName ) ) ;
00221       AbstractInput< Type > *realInput( dynamic_cast< AbstractInput< Type > * >(
00222                                           input ) ) ;
00223       if( realInput != 0 )
00224       {
00225         if( obj != 0 )
00226         {
00227           alias = _controller.template createInputAlias< Type >( aliasName,
00228                                                                  *this,
00229                                                                  realInput,
00230                                                                  precisionLevel ) ;
00231         }
00232         else
00233         {
00234           Controller::error( "imposible aliasing " ) ;
00235         }
00236       }
00237       else
00238       {
00239         Controller::error( "impossible aliasing, probably because of type mismatch" ) ;
00240       }
00241     }
00242     else
00243     {
00244       OMERROR( "SimulatedObject::createInputAlias \"" << aliasedObjectName
00245                << "\" isn't the father of " 
00246                << OMK::debugMsg( this )
00247                << " : aliasing is therefore impossible for alias named \""
00248                << aliasedInputName << "\"" ) ;
00249       Controller::error( "" ) ;
00250     }
00251   }
00252   else 
00253   {
00254     alias = dynamic_cast< InputAlias< Type > * >( redefinedInput ) ;
00255     if( alias == 0 )
00256     {
00257       throw UnallowedOverloadingException( aliasName, getName() ) ;
00258     }
00259     else
00260     {
00261       OMTRACEID( OMK_DEBUG_OMK_EXEC, "inputAlias \"" << aliasName
00262                  << "\" of " << OMK::debugMsg( this )
00263                  <<" already defined. No new inputAlias created : reference to old one used" ) ;
00264     }
00265   }
00266   return *alias ;
00267 }

template<typename Type>
SensitiveInputAlias< Type > & OMK::SimulatedObject::addSensitiveInputAlias ( const Name aliasName,
const Name aliasedObjectName,
const Name aliasedInputName,
int  precisionLevel = OMK::Type::PolatorNT::defaultPrecisionLevel 
)

add an sensitive input which is an alias to an input of an other object

Parameters:
aliasName name of the added input
aliasedObjectName the of the object being aliased. aliasedObjectName should be a simulated object ancestor of the current object
aliasedInputName name of the input aliased
makeConnectable allow other simulated objects to change the connection of the created input
precisionLevel quality of the polations associated with the created input
Returns:
a reference to the created input

Definition at line 270 of file OMKSimulatedObject.inl.

References _controller, _inputTable, OMK::debugMsg(), OMK::Controller::error(), getName(), OMK::Controller::getPointerToSimulatedObjectNamed(), isAncestor(), OMERROR, OMK_DEBUG_OMK_EXEC, and OMTRACEID.

00275 {
00276   InputNT *redefinedInput( _inputTable.getObjectOfIndex( aliasName ) ) ;
00277   SensitiveInputAlias< Type > *alias( 0 ) ;
00278   if( redefinedInput == 0 )
00279   {
00280     // make sure aliasedObjectName is an ancestor of object
00281     if( isAncestor( aliasedObjectName ) )
00282     {
00283       SimulatedObject *obj( _controller.getPointerToSimulatedObjectNamed(
00284                               aliasedObjectName ) ) ;
00285       InputNT * input( obj->_inputTable.getObjectOfIndex( aliasedInputName ) ) ;
00286       AbstractInput< Type > *realInput( dynamic_cast< AbstractInput< Type > * >(
00287                                           input ) ) ;
00288       if( realInput != 0 )
00289       {
00290         if( obj != 0 )
00291         {
00292           alias = _controller.template createSensitiveInputAlias< Type >(
00293             aliasName, *this, realInput, precisionLevel ) ;
00294         }
00295         else
00296         {
00297           Controller::error( "Impossible aliasing " ) ;
00298         }
00299       }
00300       else
00301       {
00302         Controller::error( "impossible aliasing, probably because of type mismatch" ) ;
00303       }
00304     }
00305     else
00306     {
00307       OMERROR( "SimulatedObject::addSensitiveInputAlias \n" << aliasedObjectName
00308                << "\n isn't the father of " << OMK::debugMsg( this )
00309                << " : cannot create an alias of \""
00310                << aliasedInputName << "\"" ) ;
00311       throw UserException( "" ) ;
00312     }
00313   }
00314   else 
00315   {
00316     alias = dynamic_cast< SensitiveInputAlias< Type > * >( redefinedInput ) ;
00317     if( alias == 0 )
00318     {
00319       throw UnallowedOverloadingException( aliasName, getName() ) ;
00320     }
00321     else
00322     {
00323       OMTRACEID( OMK_DEBUG_OMK_EXEC, "sensitiveInputAlias \"" << aliasName
00324                  << "\" of " << OMK::debugMsg( this )
00325                  <<" already defined. No new sensitiveInputAlias created : reference to old one used" ) ;
00326     }
00327   }
00328   return *alias ;
00329 }

template<typename Type>
SensitiveNotifyingInputAlias< Type > & OMK::SimulatedObject::addSensitiveNotifyingInputAlias ( const Name aliasName,
const Name aliasedObjectName,
const Name aliasedInputName,
int  precisionLevel = OMK::Type::PolatorNT::defaultPrecisionLevel 
)

add a sensitive Notifying input which is an alias to an input of an other object

Parameters:
aliasName name of the added input
aliasedObjectName the of the object being aliased. aliasedObjectName should be a simulated object ancestor of the current object
aliasedInputName name of the input aliased
makeConnectable allow other simulated objects to change the connection of the created input
precisionLevel quality of the polations associated with the created input
Returns:
a reference to the created input

Definition at line 333 of file OMKSimulatedObject.inl.

References _controller, _inputTable, OMK::debugMsg(), OMK::Controller::error(), getName(), OMK::Controller::getPointerToSimulatedObjectNamed(), isAncestor(), OMERROR, OMK_DEBUG_OMK_EXEC, and OMTRACEID.

00337 {
00338   InputNT *redefinedInput( _inputTable.getObjectOfIndex( aliasName ) ) ;
00339   SensitiveNotifyingInputAlias< Type > *alias( 0 ) ;
00340   if( redefinedInput == 0 )
00341   {
00342     // make sure aliasedObjectName is an ancestor of object
00343     if( isAncestor( aliasedObjectName ) )
00344     {
00345       SimulatedObject *obj( _controller.getPointerToSimulatedObjectNamed(
00346                               aliasedObjectName ) ) ;
00347       InputNT *input( obj->_inputTable.getObjectOfIndex( aliasedInputName ) ) ;
00348       AbstractInput< Type > *realInput( dynamic_cast < AbstractInput< Type > * >(
00349                                           input ) ) ;
00350       if( realInput != 0 )
00351       {
00352         if( obj != 0 )
00353         {
00354           alias =
00355             _controller.template createSensitiveNotifyingInputAlias< Type >(
00356               aliasName, *this, realInput, precisionLevel ) ;
00357         }
00358         else
00359         {
00360           throw UserException( "Impossible aliasing " ) ;
00361         }
00362       }
00363       else
00364       {
00365         Controller::error( "alias type mismatch" ) ;
00366       }
00367     }
00368     else
00369     {
00370       OMERROR( "SimulatedObject::addSensitiveSeignalingInputAlias \""
00371                << aliasedObjectName << "\" isn' the father of "
00372                << OMK::debugMsg( this )
00373                << " : creation of alias named \"" << aliasedInputName
00374                << "\" impossible" ) ;
00375       throw UserException( "" );
00376     }
00377   }
00378   else
00379   {
00380     alias = dynamic_cast< SensitiveNotifyingInputAlias< Type > * >(
00381       redefinedInput ) ;
00382     if( alias == 0 )
00383     {
00384       throw UnallowedOverloadingException( aliasName, getName() ) ;
00385     }
00386     else
00387     {
00388       OMTRACEID( OMK_DEBUG_OMK_EXEC, "sensitiveNotifyingInputAlias \""
00389                  << aliasName << " of " << OMK::debugMsg( this )
00390                  <<" already defined. No new sensitiveNotifyingInputAlias : reference to old one used" ) ;
00391     }
00392   }
00393   return *alias ;
00394 }

template<typename Type>
OutputAlias< Type > & OMK::SimulatedObject::addOutputAlias ( const Name aliasName,
const Name aliasedObjectName,
const Name aliasedOutputName,
OMK::Type::PolatorNT interp = 0 
)

add an output which is an alias to the output of an ancestor in the simulation tree

Parameters:
aliasName name of the added input
aliasedObjectName the of the object being aliased. aliasedObjectName should be a simulated object ancestor of the current object
aliasedOutputName name of the input aliased
Returns:
a reference to the created input

Definition at line 397 of file OMKSimulatedObject.inl.

References _controller, _outputTable, OMK::debugMsg(), OMK::Controller::error(), getController(), getName(), OMK::Controller::getPointerToSimulatedObjectNamed(), OMERROR, OMK_DEBUG_OMK_EXEC, and OMTRACEID.

00402 {
00403   OutputNT *redefinedOutput( _outputTable.getObjectOfIndex( aliasName ) ) ;
00404   OutputAlias< Type > *alias( 0 ) ;
00405   std::list< const ObjectDescriptor * > *listeFils(
00406     getController().template listDescendantsOfType< SimulatedObject >(
00407       aliasedObjectName ) ) ;
00408   bool aliasedObjectPresent( false ) ;
00409    
00410   if( redefinedOutput == 0 ) 
00411   {
00412     // make sure aliasedObjectName is an ancestor of object
00413     if( listeFils != 0 )
00414     {
00415       std::list< const ObjectDescriptor * >::const_iterator listeFilsIterator(
00416         listeFils->begin() ) ;
00417       while( listeFilsIterator != listeFils->end() && !aliasedObjectPresent )
00418       {
00419         aliasedObjectPresent = ( (*listeFilsIterator)->getName() == getName() ) ;
00420         ++listeFilsIterator ;
00421       }       
00422       delete listeFils ;
00423     }
00424     if( aliasedObjectPresent )
00425     {
00426       SimulatedObject *obj( _controller.getPointerToSimulatedObjectNamed(
00427                               aliasedObjectName ) ) ;
00428       OutputNT *Outputnt( obj->getPointerToOutputNamed( aliasedOutputName ) ) ;
00429       Output< Type > *refOutput( dynamic_cast< Output< Type > * >( Outputnt ) ) ;
00430       if( refOutput != 0 )
00431       {
00432         if( obj != 0 ) 
00433         {
00434           alias = _controller.template createOutputAlias< Type >(
00435             aliasName, *this, refOutput, interp ) ;
00436         }
00437         else
00438         {
00439           OMERROR( "SimulatedObject::addOutputAlias " << std::endl 
00440                    << "alias \"" << aliasName
00441                    << "\" cannot be made on inexistant \""
00442                    << aliasedOutputName << "\"" ) ;
00443           throw UserException( "" ) ;
00444         }
00445       }
00446       else
00447       {
00448         throw UserException( "Impossible output aliasing : type mismatch" ) ;
00449       }
00450     }
00451     else
00452     {
00453       OMERROR( "SimulatedObject::addOutputAlias \"" << aliasedObjectName
00454                << "\" isn't the father of "  << OMK::debugMsg( this )
00455                << " : not possible to alias \""
00456                <<  aliasedOutputName << "\"" ) ;
00457       Controller::error( "" ) ;
00458     }
00459   }
00460   else
00461   {
00462     alias = dynamic_cast< OutputAlias< Type > * >( redefinedOutput ) ;
00463     if( alias == 0 )
00464     {
00465       throw UnallowedOverloadingException( aliasName, getName() ) ;
00466     }
00467     else
00468     {
00469       OMTRACEID( OMK_DEBUG_OMK_EXEC,
00470                  "outputAlias already defined. No new outputAlias created : reference to old one used" ) ;
00471     }
00472   }
00473   _outputTable.addObjectWithIndex( aliasName, alias ) ;
00474   return *alias ;
00475 }

const Date & SimulatedObject::getSimulatedDate (  )  const [virtual]

get the simulated date

Returns:
: return the current simulated date in ms

Reimplemented in OMK::Controller.

Definition at line 798 of file OMKSimulatedObject.cpp.

References _controller, and OMK::Controller::getSimulatedDate().

Referenced by fireSignal(), fireValuedSignal(), insertInStream(), pack(), and OMK::PvmReferenceObjectHandle::unpack().

00798                                                       {
00799    return _controller.getSimulatedDate();
00800 }

float SimulatedObject::getPeriod (  )  const

getPeriod this is a shorthand for 1 / _objectDescriptor.Frequency () is expressed in seconds

Definition at line 208 of file OMKSimulatedObject.cpp.

References _objectDescriptor, and OMK::ObjectDescriptor::getFrequency().

Referenced by OMK::PvmMirrorObjectHandle::sendRequestToReferenceObject().

00209 {
00210    return 1.f / _objectDescriptor.getFrequency () ;
00211 }

void SimulatedObject::sendEvent ( const Name receiver,
const EventIdentifier eventId 
)

send an event

Parameters:
receiver name of the receiver the simulated object the event is sent to eventId signature of the sent event

Definition at line 327 of file OMKSimulatedObject.cpp.

References _controller, OMK::Controller::addToPendingEvents(), getController(), getName(), OMK::Controller::getPointerToSimulatedObjectNamed(), OMK::Controller::getSimulatedDate(), OMK_DEBUG_OMK_EVENT, and OMTRACEID.

Referenced by OMK::Controller::createLocalObject(), OMK::Controller::createObject(), OMK::Controller::destroyObject(), OMK::Inp::EscListener::keyPressed(), OMK::Controller::migrateObjectToProcess(), OMK::DistributedController::processEvent(), OMK::DistributedController::processNewObjectDeclaration(), OMK::DistributedController::receiveCancellationForSignal(), OMK::DistributedController::receiveRegistrationForSignal(), OMK::Iii::SessionPrm::selfControlRelease(), sendEvent(), OMK::Inp::InputListener::sendEvent(), OMK::Controller::sendInitialEventsTo(), and OMK::EventSignalEmitterUtil::sendUtil().

00328 {
00329   OMTRACEID( OMK_DEBUG_OMK_EVENT, "SimulatedObject::sendEvent( const Name & \"" << receiver 
00330              <<"\", const EventIdentifier & \"" << eventId << "\" ) at " << _controller.getSimulatedDate() ) ;
00331   SimulatedObject *objDest = _controller.getPointerToSimulatedObjectNamed( receiver ) ;
00332   if ( objDest == NULL )
00333   {
00334     getController().addToPendingEvents( new Event( eventId,
00335                                                       _controller.getSimulatedDate (),
00336                                                       getName (),
00337                                                       receiver ) ) ;
00338   }
00339   else
00340   {
00341     sendEvent( objDest, eventId ) ;
00342   }
00343 }

void SimulatedObject::sendEvent ( SimulatedObject receiver,
const EventIdentifier eventId 
)

send an event

Parameters:
receiver pointer to the receiver the simulated object the event is sent to eventId signature of the sent event

Definition at line 306 of file OMKSimulatedObject.cpp.

References _controller, OMK::Controller::addToPendingEvents(), getController(), getName(), getObjectHandle(), OMK::Controller::getSimulatedDate(), OMASSERT, OMK_DEBUG_OMK_EVENT, OMTRACEID, and OMK::ObjectHandle::receiveEvent().

00307 {
00308   OMTRACEID( OMK_DEBUG_OMK_EVENT, "SimulatedObject::sendEvent ( SimulatedObject * \"" << receiver
00309              << "\", const EventIdentifier & \"" << eventId << "\" )" ) ;
00310   OMASSERT( receiver != NULL ) ;
00311   if( receiver->getObjectHandle() != NULL )
00312   {
00313     receiver->getObjectHandle()->receiveEvent( new Event( eventId,
00314                                                              _controller.getSimulatedDate (),
00315                                                              getName (),
00316                                                              receiver->getName () ) ) ;
00317   }
00318   else
00319   { //could happen during creation when the object handle is not yet created.
00320     getController().addToPendingEvents( new Event( eventId,
00321                                                       _controller.getSimulatedDate (),
00322                                                       getName (),
00323                                                       receiver->getName () ) ) ;
00324   }
00325 }

void SimulatedObject::sendEvent ( SimulatedObject receiver,
const EventIdentifier eventId 
)

send an event

Parameters:
receiver pointer to the receiver the simulated object the event is sent to eventId signature of the sent event

Definition at line 299 of file OMKSimulatedObject.cpp.

References getName(), OMK_DEBUG_OMK_EVENT, OMTRACEID, and sendEvent().

00300 {
00301   OMTRACEID( OMK_DEBUG_OMK_EVENT, "SimulatedObject::sendEvent ( SimulatedObject & \"" << receiver.getName()
00302              << "\", const EventIdentifier & \"" << eventId << "\" )" ) ;
00303   sendEvent( &receiver, eventId ) ;
00304 }

template<typename UserType>
void OMK::SimulatedObject::sendValuedEvent ( const Name receiver,
const EventIdentifier eventId,
const UserType &  userInfo 
)

send a valued event

Parameters:
receiver name of the receiver the simulated object the event is sent to
userInfo the value associated to the sent event eventId signature of the sent event

Definition at line 478 of file OMKSimulatedObject.inl.

References _controller, OMK::Controller::addToPendingEvents(), getController(), getName(), OMK::Controller::getPointerToSimulatedObjectNamed(), and OMK::Controller::getSimulatedDate().

Referenced by OMK::Vis::VisObjectExtension::loadAnimatorParameters(), OMK::Vis::VisBase::processAddVisualObjectEvent(), OMK::Input< T >::realConnect(), OMK::Iii::SessionPrm::selfControlRelease(), OMK::Iii::SessionPrm::selfControlTakeOverAndGetCurrentValues(), OMK::Iii::SessionPrm::selfGetAccessibleParameters(), OMK::Iii::IConnector::SendControlEnded(), OMK::Iii::IConnector::SendControlReleased(), OMK::Iii::IConnector::SendControlReleasedBy(), OMK::Iii::IConnector::SendControlTakenBy(), OMK::IAttributeT< PrmType, ModelType, AccessorType >::sendIdAndValue(), OMK::MultiValuedEventSignalEmitterUtilT< T, ModelType >::sendUtil(), OMK::ValuedEventSignalEmitterUtilT< T, ModelType >::sendUtil(), OMK::IAttributeT< PrmType, ModelType, AccessorType >::sendValue(), sendValuedEvent(), OMK::Inp::InputListener::sendValuedEvent(), and OMK::GenericControlParameter< T, AncestorClass >::set().

00481 {
00482   SimulatedObject *receiverObject(
00483     _controller.getPointerToSimulatedObjectNamed( receiver ) ) ;
00484   if( receiverObject == 0 )
00485   {
00486     getController().addToPendingEvents(
00487       new ValuedEvent< UserType >( eventId,
00488                                    _controller.getSimulatedDate(),
00489                                    getName(),
00490                                    receiver,
00491                                    userInfo ) ) ;
00492   }
00493   else
00494   {
00495     sendValuedEvent( receiverObject, eventId, userInfo ) ;
00496   }
00497 }

template<typename UserType>
void OMK::SimulatedObject::sendValuedEvent ( SimulatedObject receiver,
const EventIdentifier eventId,
const UserType &  userInfo 
)

send a valued event

Parameters:
receiver pointer to the receiver the simulated object the event is sent to
userInfo the value associated to the sent event eventId signature of the sent event

Definition at line 500 of file OMKSimulatedObject.inl.

References _controller, OMK::Controller::addToPendingEvents(), getController(), getName(), getObjectHandle(), OMK::Controller::getSimulatedDate(), and OMK::ObjectHandle::receiveEvent().

00503 {
00504   if( receiver->getObjectHandle() == 0 )
00505   {
00506     getController().addToPendingEvents(
00507       new ValuedEvent< UserType >( eventId,
00508                                    _controller.getSimulatedDate(),
00509                                    getName(),
00510                                    receiver->getName(),
00511                                    userInfo ) ) ;
00512   }
00513   else
00514   {
00515     receiver->getObjectHandle()->receiveEvent(
00516       new ValuedEvent< UserType >( eventId,
00517                                    _controller.getSimulatedDate(),
00518                                    getName(),
00519                                    receiver->getName(),
00520                                    userInfo ) ) ;
00521   }
00522 }

template<typename UserType>
void OMK::SimulatedObject::sendValuedEvent ( SimulatedObject receiver,
const EventIdentifier eventId,
const UserType &  userInfo 
)

send a valued event

Parameters:
receiver pointer to the receiver the simulated object the event is sent to
userInfo the value associated to the sent event eventId signature of the sent event

Definition at line 525 of file OMKSimulatedObject.inl.

References sendValuedEvent().

00528 {
00529   sendValuedEvent( &receiver, eventId, userInfo ) ;
00530 }

void SimulatedObject::sendEvent ( const Event event  ) 

send an event.

the event received is a copy of event

Parameters:
event the event to be sent

Definition at line 261 of file OMKSimulatedObject.cpp.

References _controller, OMK::Controller::addToPendingEvents(), OMK::Event::clone(), OMK::Event::date, OMK::Event::eventId, getController(), getObjectHandle(), OMK::Controller::getPointerToSimulatedObjectNamed(), OMK_DEBUG_OMK_EVENT, OMTRACEID, OMK::ObjectHandle::receiveEvent(), and OMK::Event::receiver.

00262 {
00263   OMTRACEID( OMK_DEBUG_OMK_EVENT, "SimulatedObject::sendEvent( const Event & \""
00264              << event.eventId << "\" ) to \"" << event.receiver << "\" at " << event.date ) ;
00265   SimulatedObject *objDest = _controller.getPointerToSimulatedObjectNamed( event.receiver ) ;
00266   if( objDest == NULL )
00267   {
00268     getController().addToPendingEvents( event.clone() ) ; 
00269   }
00270   else if( objDest->getObjectHandle() == NULL )
00271   {
00272     getController().addToPendingEvents( event.clone() ) ; 
00273   }
00274   else
00275   {
00276     objDest->getObjectHandle()->receiveEvent( event ) ;
00277   }
00278 }

void SimulatedObject::sendEvent ( Event event  ) 

send the event pointed to by event warning : after this member function is called, *event should be considered as deleted, as the controler will delete it at any time : use previous member function if you want Mask to copy the event.

Parameters:
event a pointer to the event to be sent

Definition at line 280 of file OMKSimulatedObject.cpp.

References _controller, OMK::Controller::addToPendingEvents(), OMK::Event::date, OMK::Event::eventId, getController(), getObjectHandle(), OMK::Controller::getPointerToSimulatedObjectNamed(), OMK_DEBUG_OMK_EVENT, OMTRACEID, OMK::ObjectHandle::receiveEvent(), and OMK::Event::receiver.

00281 {
00282   OMTRACEID( OMK_DEBUG_OMK_EVENT, "SimulatedObject::sendEvent ( Event * \"" << event->eventId 
00283              << "\" ) to \"" << event->receiver << "\" at " << event->date ) ;
00284   SimulatedObject *objDest = _controller.getPointerToSimulatedObjectNamed( event->receiver ) ;
00285   if( objDest == NULL ) 
00286   {
00287     getController().addToPendingEvents( event ) ; 
00288   }
00289   else if( objDest->getObjectHandle() == NULL )
00290   {
00291     getController().addToPendingEvents( event ) ; 
00292   }
00293   else
00294   {
00295     objDest->getObjectHandle()->receiveEvent( event ) ;
00296   }    
00297 }


Friends And Related Function Documentation

friend class InputNT [friend]

Reimplemented in OMK::Controller.

Definition at line 644 of file OMKSimulatedObject.h.


Member Data Documentation

Controller& OMK::SimulatedObject::_controller [protected]

reéférence sur le controleur

Definition at line 639 of file OMKSimulatedObject.h.

Referenced by addControlParameter(), addInput(), addInputAlias(), addOutput(), addOutputAlias(), addSensitiveInput(), addSensitiveInputAlias(), addSensitiveNotifyingInput(), addSensitiveNotifyingInputAlias(), cancelRegistrationForSignal(), cancelRegistrationForSignalBy(), getController(), getFather(), getSimulatedDate(), OMK::Vis::VisBase::registerEventPlug(), registerForSignal(), registerForSignalBy(), sendEvent(), and sendValuedEvent().

const ObjectDescriptor& OMK::SimulatedObject::_objectDescriptor [protected]

référence sur le descripteur d'objet

Definition at line 642 of file OMKSimulatedObject.h.

Referenced by getConfigurationParameters(), getFather(), getFathersDescriptor(), getName(), getObjectDescriptor(), getPeriod(), SimulatedObject(), and ~SimulatedObject().

NameToPointerMap<InputNT> OMK::SimulatedObject::_inputTable [protected]

the input table

Definition at line 646 of file OMKSimulatedObject.h.

Referenced by addInput(), addInputAlias(), addSensitiveInput(), addSensitiveInputAlias(), addSensitiveNotifyingInput(), addSensitiveNotifyingInputAlias(), deleteInput(), getInputTable(), getPointerToInputNamed(), OMK::InputNT::registerMe(), and ~SimulatedObject().

NameToPointerMap<OutputNT> OMK::SimulatedObject::_outputTable [protected]

the output table

Definition at line 649 of file OMKSimulatedObject.h.

Referenced by addOutput(), addOutputAlias(), extract(), getOutputTable(), getPointerToOutputNamed(), insertInStream(), pack(), packAllValues(), unpack(), unpackAllValues(), and ~SimulatedObject().

NameToPointerMap<OutputNT> OMK::SimulatedObject::_controlParameterTable [protected]

the table of control parameters

Definition at line 652 of file OMKSimulatedObject.h.

Referenced by addControlParameter(), extract(), getControlParameterTable(), getPointerToControlParameterNamed(), insertInStream(), pack(), packAllValues(), unpack(), unpackAllValues(), and ~SimulatedObject().

std::list<EventListener *> OMK::SimulatedObject::_listOfEventListeners [protected]

the list of Event listeners of that object

Definition at line 655 of file OMKSimulatedObject.h.

Referenced by addEventListener(), getEventListeners(), unregisterEventListener(), and ~SimulatedObject().

ObjectHandle* OMK::SimulatedObject::_objectHandle [protected]

pointeur on the associated objectHandle

Definition at line 658 of file OMKSimulatedObject.h.

Referenced by OMK::Controller::Controller(), getObjectHandle(), OMK::Controller::hasEventsToProcess(), OMK::PvmController::PvmController(), OMK::PvmController::run(), OMK::Controller::run(), setObjectHandle(), and OMK::Controller::~Controller().


logo OpenMask

Documentation generated on Mon Jun 9 11:46:03 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007