00001 /* 00002 * This file is part of openMask © INRIA, CNRS, Universite de Rennes 1 1993-2002, thereinafter the Software 00003 * 00004 * The Software has been developped within the Siames Project. 00005 * INRIA, the University of Rennes 1 and CNRS jointly hold intellectual property rights 00006 * 00007 * The Software has been registered with the Agence pour la Protection des 00008 * Programmes (APP) under registration number IDDN.FR.001.510008.00.S.P.2001.000.41200 00009 * 00010 * This file may be distributed under the terms of the Q Public License 00011 * version 1.0 as defined by Trolltech AS of Norway and appearing in the file 00012 * LICENSE.QPL included in the packaging of this file. 00013 * 00014 * Licensees holding valid specific licenses issued by INRIA, CNRS or Université de Rennes 1 00015 * for the software may use this file in accordance with that specific license 00016 * 00017 */ 00018 #ifdef _MOME 00019 00020 #include <PsnMomeMirrorObjectHandle.h> 00021 #include <PsSimulatedObject.h> 00022 #include <PsnBroadcastManager.h> 00023 #include "PsnSharedMemoryManager.h" 00024 00025 PsnMomeMirrorObjectHandle::PsnMomeMirrorObjectHandle (PsSimulatedObject & obj, 00026 PsnBroadcastManager & aBroadcastManager, 00027 PsnSharedMemoryManager & aMemoryManager) : 00028 PsnMirrorObjectHandle(obj) , 00029 _myBroadcastManager(aBroadcastManager) , 00030 _myMemoryManager(aMemoryManager) 00031 { 00032 //cerr<<"creation d'un miroir pour "<<obj.getName()<<endl; 00033 } 00034 00035 PsnMomeMirrorObjectHandle::~PsnMomeMirrorObjectHandle() { 00036 00037 } 00038 00039 00040 void PsnMomeMirrorObjectHandle::receiveEvent (const PsEvent & event) { 00041 #ifdef _DEBUGEVT 00042 cerr<<"PsnMomeMirrorObjectHandle::receiveEvent "<<&_myMemoryManager<<" "<<event<<endl; 00043 #endif 00044 //install _myMemoryManager as default memoryManager 00045 HeapStackTop toto(&_myMemoryManager); 00046 // copy the event 00047 PsEvent * copy = event.clone() ; 00048 //broadcast the event 00049 _myBroadcastManager.sendEvent(getSimulatedObject().getObjectDescriptor().getProcess(), 00050 _myMemoryManager.globalAddressToLocal(copy)); 00051 #ifdef _DEBUGEVT 00052 cerr<<"PsnMomeMirrorObjectHandle::receiveEvent "<<copy<<" "<<_myMemoryManager.globalAddressToLocal(copy)<<endl; 00053 cerr<<*copy<<endl; 00054 #endif 00055 } 00056 00057 00058 00059 void PsnMomeMirrorObjectHandle::receiveEvent (PsEvent * event) { 00060 #ifdef _DEBUGEVT 00061 cerr<<"PsnMomeMirrorObjectHandle::receiveEvent (PsEvent * event)"<<endl; 00062 #endif 00063 receiveEvent(*event) ; 00064 delete event ; 00065 } 00066 00067 00068 00069 bool PsnMomeMirrorObjectHandle::receiveRegistrationForSignal(const PsEventIdentifier & sig,const PsName & abonne) { 00070 //install _myMemoryManager as default memoryManager 00071 HeapStackTop toto(&_myMemoryManager); 00072 //create a message for our referential 00073 PsValuedEvent<PsEventIdentifier> * mess = new PsValuedEvent<PsEventIdentifier> ("MaskSubscribeSignal", 00074 getSimulatedObject().getSimulatedDate(), 00075 abonne, 00076 getSimulatedObject().getName(), 00077 sig); 00078 //broadcast the event 00079 _myBroadcastManager.sendEvent(getSimulatedObject().getObjectDescriptor().getProcess(), 00080 _myMemoryManager.globalAddressToLocal(mess)); 00081 return true; 00082 } 00083 00084 #endif
| Documentation generated on Mon Nov 25 15:25:00 2002 |
Generated with doxygen 1.2.12 by Dimitri van Heesch , 1997-2001 |