#include <OMKPvmDuplicatedObjectHandle.h>
Inheritance diagram for OMK::PvmDuplicatedObjectHandle:
Public Member Functions | |
virtual | ~PvmDuplicatedObjectHandle () |
destructor | |
PvmDuplicatedObjectHandle (SimulatedObject &, Controller &) | |
constructor | |
virtual void | addProcessOfDuplicate (const Process *process) |
add a process to the data structure storing the location of copies | |
virtual void | unpack (IncomingSynchronisationMessage &) |
unpack from a pvm message | |
Protected Member Functions | |
virtual void | broadcastEvent (const Event &event) |
broadcast event | |
Protected Attributes | |
std::list< const Process * > | _processesOfDuplicates |
The data structure used to store the processes to broadcast information to. |
This object handle is a reference object handle for object who have more than one reference object ( duplicated objects and the controller). This implementation id concerned with the propagation of events to the other reference objects.
Definition at line 34 of file OMKPvmDuplicatedObjectHandle.h.
PvmDuplicatedObjectHandle::~PvmDuplicatedObjectHandle | ( | ) | [virtual] |
PvmDuplicatedObjectHandle::PvmDuplicatedObjectHandle | ( | SimulatedObject & | , | |
Controller & | ||||
) |
constructor
Definition at line 13 of file OMKPvmDuplicatedObjectHandle.cxx.
00013 : 00014 DuplicatedObjectHandle ( obj, ctrl ) 00015 { 00016 }
void PvmDuplicatedObjectHandle::addProcessOfDuplicate | ( | const Process * | process | ) | [virtual] |
add a process to the data structure storing the location of copies
Implements OMK::DuplicatedObjectHandle.
Definition at line 74 of file OMKPvmDuplicatedObjectHandle.cxx.
References _processesOfDuplicates.
00075 { 00076 _processesOfDuplicates.push_back( process ) ; 00077 }
void PvmDuplicatedObjectHandle::unpack | ( | IncomingSynchronisationMessage & | ) | [virtual] |
unpack from a pvm message
Reimplemented from OMK::Flowable.
Definition at line 50 of file OMKPvmDuplicatedObjectHandle.cxx.
References OMK::EventCreator::createEvent(), OMK::EventReceived, OMK::ReferenceObjectHandle::receiveEvent(), and OMK::Event::unpack().
00051 { 00052 RequestType typeMess ; 00053 int messageType ; 00054 00055 in >> messageType ; 00056 typeMess = static_cast <RequestType> (messageType) ; 00057 00058 if ( typeMess == EventReceived ) 00059 { 00060 Event * event ; 00061 Name classToCreate ; 00062 EventIdentifier eventId; 00063 Date eventDate; 00064 Name sender, receiver ; 00065 in >> classToCreate >> eventId>> eventDate>>sender>>receiver ; 00066 event = EventCreator::createEvent (classToCreate, eventId, eventDate, sender, receiver ) ; 00067 event->unpack ( in ) ; 00068 ReferenceObjectHandle::receiveEvent ( event ) ; 00069 } 00070 }
void PvmDuplicatedObjectHandle::broadcastEvent | ( | const Event & | event | ) | [protected, virtual] |
broadcast event
Implements OMK::DuplicatedObjectHandle.
Definition at line 22 of file OMKPvmDuplicatedObjectHandle.cxx.
References _processesOfDuplicates, OMK::Event::clone(), OMK::EventReceived, OMK::SimulatedObject::getName(), OMK::ObjectHandle::getSimulatedObject(), and OMK::ReferenceObjectHandle::receiveEvent().
00023 { 00024 //send the event to all copies of oneself 00025 for (std::list<const Process *>::const_iterator i = _processesOfDuplicates.begin() ; 00026 i != _processesOfDuplicates.end () ; 00027 ++i) 00028 { 00029 if (getSimulatedObject().getController().getObjectDescriptor().getProcess() != (*i)->getProcessName() ) 00030 { 00031 #ifdef _DEBUGPVMMESS 00032 std::cerr<<"PvmDuplicatedObjectHandle::broadcastEvent"<<std::endl; 00033 #endif 00034 if ( ! (*i)->getSvmLink ()->getOutgoingBuffer().isTimeStamped() ) 00035 { 00036 (*i)->getSvmLink ()->getOutgoingBuffer(). 00037 insertTimeStamp ( getSimulatedObject().getController().getSimulatedDate() ) ; 00038 } 00039 (*i)->getSvmLink ()->getOutgoingBuffer()<< getSimulatedObject().getName () 00040 << EventReceived 00041 << event ; 00042 } 00043 } 00044 //receive the event oneself 00045 ReferenceObjectHandle::receiveEvent ( event.clone() ) ; 00046 }
std::list<const Process *> OMK::PvmDuplicatedObjectHandle::_processesOfDuplicates [protected] |
The data structure used to store the processes to broadcast information to.
Definition at line 56 of file OMKPvmDuplicatedObjectHandle.h.
Referenced by addProcessOfDuplicate(), and broadcastEvent().
Documentation generated on Mon Jun 9 11:46:03 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |