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

PsnSvm.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 PsSvmHEADER
00019 #define PsSvmHEADER
00020 
00021 #include <set>
00022 #include <string>
00023 
00024 #include <Psn.h>
00025 #include <PsList.h>
00026 #include <PsNameToPointerMap.h>
00027 class PsnScenario;
00028 #include "PsnSvmLink.h"
00029 class PsnProcess;
00030 class PsController ;
00031 class PsPvmController ;
00032 class PsnPvmOutgoingMessage ;
00033 class PsnPvmMulticastMessage ;
00034 
00041 class PsnSvm
00042 {
00043 public:
00044   
00049    PsnSvm (PsNameToPointerMap<PsnProcess> * tab, const PsDate & latence) ;
00050 
00051 
00053    virtual ~PsnSvm () ;
00054 
00055 
00058    virtual void init (const PsDate & initialSimulationDate );
00059 
00060 
00064    virtual void syncDistributedSites() ;
00065 
00066 
00068    virtual void connectToDistributedSimulation ( );
00069 
00070 
00074    virtual void createDistributedSimulation(const PsDate & initialSimulationDate) ;
00075 
00076 
00078    virtual void broadcast ( PsnPvmMessage::MessageTag, PsnPvmMulticastMessage * message = NULL ) ;
00079    
00080 
00084    virtual void synchronizeOn ( PsPvmController & , PsnPvmMessage::MessageTag tag ) ;
00085    
00086 
00091    virtual void disconnectFromDistributedSimulation( const PsDate & deconnexionDate );
00092    
00093   
00095    virtual const PsName & getSiteName() const ;
00096 
00097 
00099    virtual PsnSvmLink * getLinkToProcessNamed(const  PsName & processName );
00100 
00101 
00103    virtual PsnProcess * getProcessDescriptorNamed(const PsName & processName );
00104 
00105 
00110    void processReceivedMessages(PsPvmController & parsingController, const PsnPvmMessage::MessageTag tag);
00111    
00112    
00117    void waitAndProcessMessages(PsPvmController & parsingController, const PsnPvmMessage::MessageTag tag);
00118  
00119  
00124    void waitForMessage(PsPvmController & parsingController, const PsnPvmMessage::MessageTag tag);
00125  
00126    
00132    void waitForMessageFrom(PsPvmController & parsingController,
00133                        const PsName & processName,
00134                        const PsnPvmMessage::MessageTag tag );
00135 
00136 
00137 
00142    void synchroniseReceiveAndProcessMessages(PsPvmController & parsingController, const PsnPvmMessage::MessageTag tag);
00143 
00144 
00150    PsnProcess * waitForAnswerToBlockingRequest (PsPvmController & parsingController, PsnPvmMessage::MessageTag tag) ;
00151    
00155    void sendCurrentBuffersWithTag(const PsnPvmMessage::MessageTag tag);
00156 
00157 
00160    void timestampCurrentSendBuffers (const PsDate & date) ;
00161 
00162    
00164    virtual const PsDate & getSynchronisationLatency() ;
00165 
00166 protected:
00168    virtual void addNewWorkstation(const PsName & m) = 0;
00169    
00170 
00172    virtual void removeWorkstation(const PsName & m) = 0;
00173 
00174 
00176    virtual int spawnProcess (PsnProcess * p) = 0;
00177 
00178 
00182    virtual PsnSvmLink * createSvmLink(const int & d = 0) = 0;
00183 
00184 
00188    virtual int getParentSiteId() = 0;
00189    
00190 
00193    virtual int getSiteId () = 0 ;
00194 
00195 
00200    virtual void groupBarrier (string groupName, int numberToJoin) = 0 ; 
00201 
00202 
00204    virtual void broadcastToGroup (string groupName, PsnPvmMessage::MessageTag ) = 0 ;
00205    
00206 
00208    virtual void initBeforeMessagePacking() = 0 ; 
00209 
00210 
00216    virtual int nonblockingReceive (PsnPvmMessage::MessageTag tag) = 0 ; 
00217 
00218 
00223    virtual pair<PsnPvmMessage::MessageTag, int> waitForAnyRequests (PsnPvmIncomingMessage & receiveBuffer) = 0;
00224 
00225 
00230    virtual void joinSvmGroup (string & groupName) = 0;
00231 
00232 
00234    virtual void serveNameRequestsUntilEnd () ; 
00235 
00236 
00238    PsNameToPointerMap<PsnProcess> * _processTable ;
00239    
00241    map<int,PsnProcess *> _idToProcessTable ;
00242    
00245    int _siteId; 
00246    
00247 
00249    PsnSvmLink * _linkToCentralSite ; 
00250    
00251 
00253    PsName _siteName ; 
00254 
00255 
00258    int _numberOfSlaves ;
00259 
00260 
00263    const PsDate _synchronisationLatency ;
00264 
00265 
00267    static string _slaveGroupName;
00268 
00269 
00271    static string _masterSiteName ;
00272 }; 
00273 
00274 
00275 #endif
00276 

logo OpenMask

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

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