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 OMKSvmHEADER 00019 #define OMKSvmHEADER 00020 00021 #include <cassert> 00022 #include <string> 00023 #include <list> 00024 00025 #include <OMKNameToPointerMap.h> 00026 #include "OMKSvmLink.h" 00027 00028 namespace OMK 00029 { 00030 class Scenario ; 00031 class Process ; 00032 class Controller ; 00033 class PvmController ; 00034 class PvmOutgoingMessage ; 00035 class PvmMulticastMessage ; 00036 00043 class OMKPVM_API Svm 00044 { 00045 public: 00046 00051 Svm (NameToPointerMap<Process> * tab, const Date & latence, const Date & timeOut, const int deadReckoningInterval, const bool yieldNeeded) ; 00052 00053 00055 virtual ~Svm () ; 00056 00057 00060 virtual void init (const Date & initialSimulationDate ); 00061 00062 00066 virtual void syncDistributedSites() ; 00067 00068 00070 virtual void connectToDistributedSimulation ( ); 00071 00072 00076 virtual void createDistributedSimulation(const Date & initialSimulationDate) ; 00077 00078 00080 virtual void broadcast ( PvmMessage::MessageTag, PvmMulticastMessage * message = NULL ) ; 00081 00082 00086 virtual void synchronizeOn ( PvmController & , PvmMessage::MessageTag tag ) ; 00087 00088 00093 virtual void disconnectFromDistributedSimulation( const Date & deconnexionDate ); 00094 00095 00097 virtual const Name & getSiteName() const ; 00098 00099 00101 virtual SvmLink * getLinkToProcessNamed(const Name & processName ); 00102 00103 00105 virtual Process * getProcessDescriptorNamed(const Name & processName ); 00106 00107 00108 //------------------chadi ajout 1/3 ------------------------- 00109 00110 virtual Process * testIfDisconnectedProcessNamed(const Name & processName ); 00111 00112 virtual void testIfNewProcessAdded() ; 00113 00114 PvmIncomingMessage * npp ; 00115 00116 Date dateVar ; 00117 //------------------fin chadi ajout 1/3------------------------ 00118 00119 00120 00121 00126 virtual void processReceivedMessages(PvmController & parsingController, const PvmMessage::MessageTag tag); 00127 00128 00133 virtual void waitAndProcessMessages(PvmController & parsingController, const PvmMessage::MessageTag tag); 00134 00135 00140 virtual void waitForMessage(PvmController & parsingController, const PvmMessage::MessageTag tag); 00141 00142 00148 virtual void waitForMessageFrom(PvmController & parsingController, 00149 const Name & processName, 00150 const PvmMessage::MessageTag tag ); 00151 00152 00153 00158 virtual void synchroniseReceiveAndProcessMessages(PvmController & parsingController, const PvmMessage::MessageTag tag); 00159 virtual void relaxedSynchroniseReceiveAndProcessMessages(PvmController & parsingController, const PvmMessage::MessageTag tag); 00160 00161 00167 virtual Process * waitForAnswerToBlockingRequest (PvmController & parsingController, PvmMessage::MessageTag tag) ; 00168 00172 virtual void sendCurrentBuffersWithTag(const PvmMessage::MessageTag tag); 00173 00174 00177 virtual void timestampCurrentSendBuffers (const Date & date) ; 00178 00179 00181 virtual const Date & getSynchronisationLatency() ; 00182 00183 00184 //----------------------chadi ajout 2/3 ---------------------------- 00185 00186 // gestion de la liste des deconnectes 00187 virtual void addToDisconnectedTable ( Name& , Process* ); //( NameToPointerMap<Process>::iterator ); 00188 virtual void removeFromDisconnectedTable ( NameToPointerMap<Process>::iterator ); 00189 virtual bool disconnectedProcess(Name&); 00190 bool _troubleFlag; 00191 virtual bool getTroubleFlag() ; 00192 virtual bool disconnectedTableIsEmpty(); 00193 virtual void addNewSiteToSimulation ( const Date & ) ; 00194 virtual void addNewSiteRequest ( const Date & date) ; 00195 // void flushDisconnectedSitesOutgoingBuffer() ; 00196 virtual bool reconnexionEstablished () ; 00197 virtual bool testIfSiteRecovered (Process * p) = 0; 00198 virtual void sendPingMessage () ; 00199 virtual void removeProcessFromActiveTable() ; 00200 virtual void removeProcessProlog() ; 00201 int _simStep ; 00202 // TDTD : pour savoir qui sont les déconnectés 00203 virtual std::list<Name> getDisconnectedProcessusList () ; 00204 virtual std::map<Name, int> getDisconnectedProcessusMap () ; 00205 // fin TDTD 00206 //----------------------fin chadi ajout 2/3 -------------------------- 00207 00208 protected: 00209 00210 // TDTD : pour savoir qui sont les déconnectés 00211 std::list<Name> _disconnectedProcessusList ; 00212 std::map<Name, int> _disconnectedProcessusMap ; 00213 // fin TDTD 00214 00216 virtual void addNewWorkstation(const Name & m) = 0; 00217 00218 00220 virtual void removeWorkstation(const Name & m) = 0; 00221 00222 00224 virtual int spawnProcess (Process * p) = 0; 00225 00226 00230 virtual SvmLink * createSvmLink(const int & d = 0) = 0; 00231 00232 00236 virtual int getParentSiteId() = 0; 00237 00238 00241 virtual int getSiteId () = 0 ; 00242 00243 00248 virtual void groupBarrier (std::string groupName, int numberToJoin) = 0 ; 00249 00250 00252 virtual void broadcastToGroup (std::string groupName, PvmMessage::MessageTag ) = 0 ; 00253 00254 00256 virtual void initBeforeMessagePacking() = 0 ; 00257 00258 00264 virtual int nonblockingReceive (PvmMessage::MessageTag tag) = 0 ; 00265 00266 00271 virtual std::pair<PvmMessage::MessageTag, int> waitForAnyRequests (PvmIncomingMessage & receiveBuffer) = 0; 00272 00273 00278 virtual void joinSvmGroup (std::string & groupName) = 0; 00279 00280 00282 virtual void serveNameRequestsUntilEnd () ; 00283 00284 00286 NameToPointerMap<Process> * _processTable ; 00287 00288 //-------------------chadi ajout 3/3 --------------------------- 00289 00290 std::vector<int> processSiteIds ; 00291 00292 NameToPointerMap<Process> * _disconnectedTable ; 00293 00294 NameToPointerMap<Process> * _activeProcessTable ; 00295 00296 NameToPointerMap<Process> * _temporaryTable ; 00297 00298 NameToPointerMap<Process> aRecevoir ; 00299 00300 bool firstTime ; 00301 //-----------------fin chadi ajout 3/3 ------------------------------ 00302 00303 00305 std::map<int,Process *> _idToProcessTable ; 00306 00309 int _siteId; 00310 00311 00313 SvmLink * _linkToCentralSite ; 00314 00315 00317 Name _siteName ; 00318 00319 00322 int _numberOfSlaves ; 00323 00324 00327 const Date _synchronisationLatency ; 00328 00331 const Date _synchronisationTimeOut ; 00332 00335 const Date _deadReckoningInterval ; 00336 00339 const bool _yieldNeeded ; 00340 00341 00343 static std::string _slaveGroupName; 00344 00345 00347 static std::string _masterSiteName ; 00348 }; 00349 } // namespace OMK 00350 00351 #endif 00352
Documentation generated on Mon Jun 9 11:45:57 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |