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

PsDistributedController.h

Go to the documentation of this file.
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 #ifndef PsDistributedControllerHEADER
00019 #define PsDistributedControllerHEADER
00020 
00021 
00022 #include <PsController.h>
00023 
00024 #include "PsnDuplicatedObjectHandle.h"
00025 
00026 class PsDuplicatedObject ;
00027 class PsnMirrorObjectHandle ;
00028 class PsnSimulationTree ;
00029 
00037 class PsDistributedController : public PsController 
00038 {
00039 public:
00041    PsDistributedController(PsObjectDescriptor & initialObjects, const PsDate & initialDate);
00042 
00044    virtual ~PsDistributedController();
00045 
00050    virtual PsSimulatedObject * getPointerToSimulatedObjectNamed (const PsName & objectName );
00051    
00053    virtual void dispatchEvent(PsEvent * event);
00054 
00055 
00056 
00058    virtual bool processEvent ( PsEvent * event ) ;
00059  
00061    virtual void purgeMemoryFromOldEvents ( const PsDate & dateOfOldestKept );
00062 
00063 
00065    virtual void broadcastEventsForSignal ( PsEvent & event, const PsEventIdentifier & sigId ) ;
00066 
00067 
00073    virtual bool receiveRegistrationForSignal(const PsEventIdentifier & sigId, 
00074                                   const PsName & registrant, 
00075                                   const PsEventIdentifier & eventId);
00076 
00077 
00082    virtual bool receiveCancellationForSignal ( const PsEventIdentifier & sigId , 
00083                                               const PsName & registrant ) ;
00084 
00085 protected:
00090    virtual PsnMirrorObjectHandle * newPsnMirrorObjectHandle (PsSimulatedObject & obj) = 0 ;
00091 
00092 
00097    virtual PsnDuplicatedObjectHandle * newPsnDuplicatedObjectHandle (PsSimulatedObject & obj) = 0 ;
00098 
00099 
00101    virtual void deleteObjectHandle ( PsnObjectHandle * objectHandle ) ;
00102 
00104    virtual void createControlledObjects (const PsObjectDescriptor * subTree) ;
00105 
00107    virtual void createObject(const PsObjectDescriptor & newObjectDescription, const PsName & fathersName) ;
00108 
00110    virtual void processNewObjectDeclaration ( PsObjectDescriptor & declaration, const PsDate & declarationDate ) ;
00111 
00115    virtual PsnMirrorObjectHandle * createMirrorObject ( PsObjectDescriptor * objectDescription );
00116 
00117 
00119    virtual PsnDuplicatedObjectHandle * createDuplicatedObject( PsObjectDescriptor * objectDescription );
00120 
00121    typedef hash_map<PsName,PsnMirrorObjectHandle *,PsName::hashFunctionObject > MirrorObjectsContainerType ;
00122 
00125    MirrorObjectsContainerType _mirrorObjectsMap ;
00126 
00129    PsNameToPointerMap<PsnDuplicatedObjectHandle> _duplicatedObjectsMap;
00130 
00131 
00136    virtual void processStartEventOf(PsnReferenceObjectHandle * objectHandle) ;
00137 
00139    PsNameToPointerMap<PsnReferenceObjectHandle> tableDesNonInitialises ;
00140 
00142    PsNameToPointerMap<PsnReferenceObjectHandle> tableDesInitialises ;
00143 
00145    PsName _processName ;
00146 
00148    list<pair<PsEventIdentifier, pair <PsEvent *, PsDate> > > _broadcastedSignals ;
00149 
00150 protected:
00151    class RegistrationData : public PsType 
00152    {
00153    public:
00154       RegistrationData() {} ;
00155 
00156       RegistrationData (const PsEventIdentifier & sig,
00157                         const PsName & registrant, 
00158                         const PsEventIdentifier & eventId) ;
00159 
00160       virtual ~RegistrationData() ;
00161 
00163       virtual void unpack (PsIncomingSynchronisationMessage &) ;
00164       
00166       virtual void pack (PsOutgoingSynchronisationMessage &) const ;
00167 
00168       virtual void extract(istream & in) ;
00169 
00170       virtual void insertInStream (ostream & out) const ;
00171 
00172       virtual PsPolatorNT * createPolator() ;
00173 
00174       PsEventIdentifier _sig ;
00175       PsName _registrant ;
00176       PsEventIdentifier _eventId ;
00177    }; 
00178 
00179 
00180 
00181    class CancellationData : public PsType
00182    {
00183    public:
00184       CancellationData(){};
00185 
00186       CancellationData  ( const PsEventIdentifier & sigId , const PsName & registrant ) ;
00187 
00188       virtual ~CancellationData() ;
00189 
00191       virtual void unpack (PsIncomingSynchronisationMessage &) ;
00192       
00194       virtual void pack (PsOutgoingSynchronisationMessage &) const ;
00195 
00196       virtual void extract(istream & in) ;
00197 
00198       virtual void insertInStream (ostream & out) const ;
00199 
00200       virtual PsPolatorNT * createPolator() ;
00201 
00202       PsEventIdentifier _sigId ;
00203 
00204       PsName _registrant ;
00205    };
00206 };
00207 
00208 #endif
00209 

logo OpenMask

Documentation generated on Mon Nov 25 15:24:59 2002

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