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

PsnReferenceObjectHandle.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 PsnReferenceObjectHandleHEADER
00019 #define PsnReferenceObjectHandleHEADER
00020 
00021 #include <PsnObjectHandle.h>
00022 #include <PsNameToPointerMap.h>
00023 #include <PsNumericType.h>
00024 #include <PsPair.h>
00025 #include "PsnSignalDispatcher.h"
00026 
00027 class PsController ;
00028 class PsEventListener ;
00029 #include "PsEventIdentifier.h"
00030 
00036 class PsnReferenceObjectHandle: public PsnObjectHandle
00037 {
00038 public:
00043    PsnReferenceObjectHandle (PsSimulatedObject & object, PsController & controller);
00044    
00045 
00051    PsnReferenceObjectHandle (PsSimulatedObject & object, PsController & controller, PsnSignalDispatcher * signalDispatcher);
00052 
00055    virtual ~PsnReferenceObjectHandle () ;
00056    
00059    virtual void init () ;
00060 
00063    virtual void compute() ;
00064 
00066    virtual void processEvents () ;
00067 
00071    virtual void receiveEvent (const PsEvent & event) ;
00072 
00076    virtual void receiveEvent (PsEvent * event) ;
00077 
00081    virtual void registerEventListenerForEvent ( PsEventListener & eventListener, 
00082                                                 const PsEventIdentifier & eventId ) ;
00083 
00088    virtual void sendEventsForSignal ( PsEvent & event , const PsEventIdentifier & sigId ) ;
00089 
00090 
00095    virtual bool receiveRegistrationForSignal ( const PsEventIdentifier & sigId, 
00096                                                const PsName & registrant, 
00097                                                const PsEventIdentifier & eventId ) ;
00098 
00099 
00103    virtual bool cancelRegistrationForSignal ( const PsEventIdentifier & sigId, 
00104                                                const PsName & registrant ) ;
00105 
00107    virtual void insertInStream (ostream & = cout) const;
00108 
00110    virtual void extract (istream & = cin);
00111    
00118    friend bool operator < (const PsnReferenceObjectHandle &,
00119                           const PsnReferenceObjectHandle &);
00122    friend bool operator <= (const PsnReferenceObjectHandle &,
00123                            const PsnReferenceObjectHandle &);
00126    friend bool operator > (const PsnReferenceObjectHandle &,
00127                           const PsnReferenceObjectHandle &);
00130    friend bool operator >= (const PsnReferenceObjectHandle &,
00131                             const PsnReferenceObjectHandle &);
00132    
00134 
00136    enum SimulatedObjectComputingState { initial, running, suspended, stopped, destroyed } ;
00137 
00139    virtual const SimulatedObjectComputingState & getComputingState() const ;
00140 
00141 protected:
00143   friend class PsController;
00144 
00146    friend class PsnScheduler ;
00147 
00149    SimulatedObjectComputingState _computingState; 
00150 
00152    PsController & _controller ;
00153 
00155    virtual list <PsEvent *> & getCurrentEventList() ;
00156 
00158    virtual void switchEventList () ;
00159 
00161    PsDate _dateOfLastEventManagement ;
00162 
00164    PsDate _dateOfLastActivation ;
00165 
00167    list <PsEvent *> * * _eventList ;
00168 
00170    unsigned int _currentWritableEventList ;
00171 
00173    PsnMutexLock _mutexForListEvt ;
00174 
00176    bool _isInObjectNeedingActivationList[2]; 
00177 
00178 
00180    typedef hash_map< const PsEventIdentifier, 
00181       list < PsEventListener *> *, 
00182       PsEventIdentifier::hashFunctionObject, 
00183       equal_to<const PsEventIdentifier> > virtualEventTableType ;
00184 
00186    virtualEventTableType _virtualEventTable ;
00187 
00189    PsnSignalDispatcher * _signalDispatcher ;
00190 
00191 }; // PsnReferenceObjectHandle
00192 
00199 bool operator < (const PsnReferenceObjectHandle &,
00200                         const PsnReferenceObjectHandle &);
00203 bool operator <= (const PsnReferenceObjectHandle &,
00204                   const PsnReferenceObjectHandle &);
00207 bool operator > (const PsnReferenceObjectHandle &,
00208                         const PsnReferenceObjectHandle &);
00211 bool operator >= (const PsnReferenceObjectHandle &,
00212                          const PsnReferenceObjectHandle &);
00213    
00215 
00216 #endif
00217 
00218 
00219 
00220 
00221 
00222 

logo OpenMask

Documentation generated on Mon Nov 25 15:25:01 2002

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