#include <OMKPvmLocalObjectHandle.h>
Inheritance diagram for OMK::PvmLocalObjectHandle:
Public Member Functions | |
virtual | ~PvmLocalObjectHandle () |
destructor | |
PvmLocalObjectHandle (SimulatedObject &, Controller &) | |
constructor | |
virtual void | addProcessOfLocal (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 * > | _processesOfLocal |
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 OMKPvmLocalObjectHandle.h.
PvmLocalObjectHandle::~PvmLocalObjectHandle | ( | ) | [virtual] |
PvmLocalObjectHandle::PvmLocalObjectHandle | ( | SimulatedObject & | , | |
Controller & | ||||
) |
constructor
Definition at line 9 of file OMKPvmLocalObjectHandle.cxx.
00009 : 00010 LocalObjectHandle ( obj, ctrl ) 00011 { 00012 00013 }
void PvmLocalObjectHandle::addProcessOfLocal | ( | const Process * | process | ) | [virtual] |
add a process to the data structure storing the location of copies
Implements OMK::LocalObjectHandle.
Definition at line 68 of file OMKPvmLocalObjectHandle.cxx.
References _processesOfLocal.
00069 { 00070 _processesOfLocal.push_back( process ) ; 00071 }
void PvmLocalObjectHandle::unpack | ( | IncomingSynchronisationMessage & | ) | [virtual] |
unpack from a pvm message
Reimplemented from OMK::Flowable.
Definition at line 45 of file OMKPvmLocalObjectHandle.cxx.
References OMK::EventCreator::createEvent(), OMK::EventReceived, OMK::ReferenceObjectHandle::receiveEvent(), and OMK::Event::unpack().
00046 { 00047 RequestType typeMess ; 00048 int messageType ; 00049 00050 in >> messageType ; 00051 typeMess = static_cast <RequestType> (messageType) ; 00052 00053 if ( typeMess == EventReceived ) 00054 { 00055 Event * event ; 00056 Name classToCreate ; 00057 EventIdentifier eventId; 00058 Date eventDate; 00059 Name sender, receiver ; 00060 in >> classToCreate >> eventId>> eventDate>>sender>>receiver ; 00061 event = EventCreator::createEvent (classToCreate, eventId, eventDate, sender, receiver ) ; 00062 event->unpack ( in ) ; 00063 ReferenceObjectHandle::receiveEvent ( event ) ; 00064 } 00065 }
void PvmLocalObjectHandle::broadcastEvent | ( | const Event & | event | ) | [protected, virtual] |
broadcast event
Implements OMK::LocalObjectHandle.
Definition at line 22 of file OMKPvmLocalObjectHandle.cxx.
References _processesOfLocal, OMK::Event::clone(), OMK::EventReceived, OMK::SimulatedObject::getName(), OMK::ObjectHandle::getSimulatedObject(), and OMK::ReferenceObjectHandle::receiveEvent().
00023 { 00024 // Warn: PvmOutgoingMessage * outgoingMessage ; 00025 //send the event to all copies of oneself 00026 for (std::list<const Process *>::const_iterator i = _processesOfLocal.begin() ; 00027 i != _processesOfLocal.end () ; 00028 ++i) 00029 { 00030 if (getSimulatedObject().getController().getObjectDescriptor().getProcess() != (*i)->getProcessName() ) 00031 { 00032 //cerr<<"sending "<<event<<" to "<<getSimulatedObject().getName ()<<" of process "<<(*i)->getProcessName()<<endl; 00033 #ifdef _DEBUGPVMMESS 00034 std::cerr<<"PvmLocalObjectHandle::broadcastEvent"<<std::endl; 00035 #endif 00036 (*i)->getSvmLink ()->getOutgoingBuffer()<< getSimulatedObject().getName () 00037 << EventReceived 00038 << event ; 00039 } 00040 } 00041 //receive the event oneself 00042 ReferenceObjectHandle::receiveEvent ( event.clone() ) ; 00043 }
std::list<const Process *> OMK::PvmLocalObjectHandle::_processesOfLocal [protected] |
The data structure used to store the processes to broadcast information to.
Definition at line 54 of file OMKPvmLocalObjectHandle.h.
Referenced by addProcessOfLocal(), and broadcastEvent().
Documentation generated on Mon Jun 9 11:46:03 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |