MAK RTIspy API Documentation for HLA Evolved
execFedMgr.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1998 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: execFedMgr.h,v $ $Revision: 1.58 $ $State: Exp $
7 *********************************************************************/
8 
9 #ifndef execFedMgr_H_
10 #define execFedMgr_H_
11 
14 
15 
16 #include "rtiMsConfig.h"
17 #include "fedMgr.h"
18 #include "syncPointMsg.h"
19 #include "resBegMsg.h"
20 #include "creRespMsg.h"
21 #include "desRespMsg.h"
22 #include "joinRespMsg.h"
23 #include "joinConfMsg.h"
24 #include "savRespMsg.h"
25 #include "fomModuleRequestMsg.h"
27 #include "ridFileTester.h"
28 #include "fileDistributor.h"
29 #include "newFomClassesMsg.h"
30 #include <vector>
31 
32 #include "mtl/fedReader13.h"
33 #include "mtl/fedReader1516.h"
34 #include "mtl/fedReader1516e.h"
35 
36 class DtSyncPointMsg;
38 class DtSaveStatusMsg;
39 class DtRestoreStatusMsg;
40 class DtSaveFinishedMsg;
41 class DtSaveInitiateMsg;
42 class DtRestoreReplyMsg;
43 class DtRestoreEndMsg;
45 class DtRestoreMsg;
47 namespace vrlmod
48 {
49  class DtThreadedObject;
50 }
51 
63 {
64 public:
65 
69  DtConnectionMgr* connMgr,
70  DtBoost::shared_ptr<DtRtiAssistantLrcClient> assistantClient);
71 
73  virtual ~DtRtiExecFederateMgr();
74 
75 private:
76 
79 
82 
83 public:
84 
87 
88 
90  virtual void createFederationExecution(
91  const char* executionName, const char* timeImplName,
92 #ifdef DtIFSPEC1516E
93  const std::vector<DtString>& fomModules,
94  const char* mimModule);
95 #else
96  const char* fed);
97 #endif
98 
100  virtual void destroyFederationExecution(
101  const char* executionName);
102 
103 #ifdef DtIFSPEC1516E
104 
105  virtual void listFederationExecutions();
106 #endif
107 
109 #ifdef DtIFSPEC1516
111  const char* yourName,
112  const char* executionName,
113  rti1516::FederateAmbassador* federateAmbassadorReference,
114  unsigned long flags);
115 #elif defined(DtIFSPEC1516E)
117  const char* federateName,
118  const char* yourName,
119  const char* executionName,
120  const std::vector<DtString>& fomModules,
121  unsigned long flags);
122 #else
123 
125  const char* yourName,
126  const char* executionName,
127  RTI::FederateAmbassador* federateAmbassadorReference,
128  unsigned long flags);
129 #endif
130 
131 
133 #ifdef DtIFSPEC1516
134  virtual void resignFederationExecution(
135  rti1516::ResignAction theAction);
136 #elif defined(DtIFSPEC1516E)
137  virtual void resignFederationExecution(
138  rti1516e::ResignAction theAction);
139 #else
140  virtual void resignFederationExecution(
141  RTI::ResignAction theAction);
142 #endif
143 
144 
147 
148 
150 #ifdef DtIFSPEC1516
152  char const * label,
153  rti1516::VariableLengthData const & theTag);
154 #elif defined(DtIFSPEC1516E)
156  char const * label,
157  rti1516e::VariableLengthData const & theTag);
158 #else
160  char const * label,
161  char const * theTag);
162 #endif
163 
165 #ifdef DtIFSPEC1516
167  char const * label,
168  rti1516::VariableLengthData const & theTag,
169  DtFederateHandleSet const & syncSet);
170 #elif defined(DtIFSPEC1516E)
172  char const * label,
173  rti1516e::VariableLengthData const & theTag,
174  DtFederateHandleSet const & syncSet);
175 #else
177  char const * label,
178  char const * theTag,
179  DtFederateHandleSet const & syncSet);
180 #endif
181 
182 
184  virtual void synchronizationPointAchieved(char const * label, bool successfully=true);
186 
189 
190 
191 #ifdef DtIFSPEC1516
192 
193  virtual void requestFederationSave (char const * label,
194  rti1516::LogicalTime const * time=NULL);
195 
197  virtual void queryFederationSaveStatus();
198 
200  virtual void queryFederationRestoreStatus();
201 #elif defined(DtIFSPEC1516E)
202 
203  virtual void requestFederationSave (char const * label,
204  rti1516e::LogicalTime const * time=NULL);
205 
207  virtual void queryFederationSaveStatus();
208 
210  virtual void queryFederationRestoreStatus();
211 
213  virtual void abortFederationSave();
214 
216  virtual void abortFederationRestore();
217 #else
218 
220  virtual void requestFederationSave (char const * label,
221  RTI::FedTime const * time=NULL);
222 #endif
223 
225  virtual void federateSaveBegun ();
226 
228  virtual void federateSaveComplete ();
229 
231  virtual void federateSaveNotComplete ();
232 
234  virtual void requestFederationRestore ( const char *label);
235 
237  virtual void federateRestoreComplete ();
238 
240  virtual void federateRestoreNotComplete ();
242 
244  std::map<DtString, DtSynchronousFileDistributor*> distributors();
245  std::map<DtString, DtSynchronousFileDistributor*> distributors() const;
246  DtSynchronousFileDistributor* joinDistributor();
247  DtSynchronousFileDistributor* joinDistributor() const;
248 
250  virtual void init();
251 
252 protected:
253 
255  virtual void initRidTester();
256 
258  virtual void initializeDistributor( const char* executionName );
259 
261  virtual void waitForCreateResponse( const char* executionName );
262 
264  virtual void waitForJoinResponse( const char* executionName,
265  std::vector<MAKRti::DtString> &joinModules );
266 
268  void checkJoinResponse();
269 
271  virtual void initializeTimeFactory();
272 
274  virtual void initializeFOM( const char* executionName );
275 
276 
279  virtual void postJoinInit(
280  const char* yourName,
281  const char* executionName,
282  const char* federateName
283 #ifdef DtIFSPEC1516
284  , rti1516::FederateAmbassador* federateAmbassadorReference);
285 #elif defined(DtIFSPEC1516E)
286  );
287 #else
288  , RTI::FederateAmbassador* federateAmbassadorReference);
289 #endif
290 
292  virtual void handleFailedJoin(unsigned long sourceID,
294 
296  virtual void setDesignatedFederate(bool isDesignated);
297  virtual bool isDesignatedFederate();
298 
301  void appendFomModule(std::vector<MAKRti::DtString>& target,
302  MAKRti::DtString const& source);
303 
306  void appendFomModules(std::vector<MAKRti::DtString>& target,
307  std::vector<MAKRti::DtString> const& source);
308 
310  virtual bool findFedFileNameFromMapping( const MAKRti::DtString execName,
311  const std::vector<MAKRti::DtString>& orig,
312  std::vector<MAKRti::DtString>& namesToUse) const;
313 
315  void testReadFomModules(const DtRIDParameters::DtStringList&,
316  MAKRti::DtString executionName, bool isMim = false);
317 
319  virtual void mergeFomModules(const std::vector<MAKRti::DtString>* fomModules);
320 
324 
325 
327  virtual void processSyncPointMsg(const DtSyncPointMsg& msg);
328 
330  virtual void processDesignatedFederateMsg(const DtDesignatedFederateMsg& msg);
331 
333  virtual void processFomModuleFileRequestMsg(const DtFomModuleRequestMsg& msg);
334 
336  virtual void processCreateResponseMsg(const DtCreateResponseMsg& msg);
337 
338 #ifdef DtIFSPEC1516E
339 
340  virtual void processReportFederationsMsg(const DtReportFederationsMsg& msg);
341 #endif
342 
344  virtual void processJoinResponseMsg(const DtJoinResponseMsg& msg);
345 
347  virtual void processDestroyResponseMsg(const DtDestroyResponseMsg& msg);
348 
350  virtual void processSaveInitiate(const DtSaveInitiateMsg& msg);
351 
353  virtual void processSaveInitiate(const char* label);
354 
356  virtual void requestImmediateSave(const char *label);
357 
359  virtual void processSaveResponse(const DtSaveResponseMsg& msg);
360 
362  virtual void processSaveFinished(const DtSaveFinishedMsg& msg);
363 
365  virtual void processRestoreReply(const DtRestoreReplyMsg& msg);
366 
368  virtual void processRestoreEnd(const DtRestoreEndMsg& msg);
369 
371  virtual void processRestoreInitiate(const DtRestoreInitiateMsg& msg);
372 
374  virtual void processRestore(const DtRestoreMsg& msg);
375 
376 #if defined(DtIFSPEC1516) || defined(DtIFSPEC1516E)
377 
378  virtual void processSaveStatusMsg(const DtSaveStatusMsg& msg);
379 
381  virtual void processRestoreStatusMsg(const DtRestoreStatusMsg& msg);
382 #endif
383 
386  virtual void processNewFomClassesMsg(const DtNewFomClassesMsg& msg);
388 
390  virtual void testSaveProgress();
391 
393  virtual void applyRidParameters();
394 
399  virtual void processNewFomClasses(const DtNewFomClassesMsg& msg);
400 
401 
404 
405 
407  virtual void sendCreateMsg(MAKRti::DtString const & fedExNameVal,
408  MAKRti::DtString const & timeImplName, const std::vector<unsigned int> & moduleCrcs,
409  MAKRti::DtFomType fedType, MAKRti::DtString const &momModuleName,
410  const std::vector<MAKRti::DtString>& fomModules, unsigned int momModuleCrc);
411 
413  virtual void sendDestroyMsg(const char* name);
414 
416  virtual void sendJoinMsg(
417  unsigned long sourceID, unsigned short requestID, const char* fedType,
418  const char* fedExName, const char* fedName,
419  const std::vector<MAKRti::DtString>& fomModules,
420  const unsigned long flags, const std::vector<unsigned int>& joinModulesCrcs);
421 
423  virtual void sendJoinConfirmMsg(
424  unsigned long sourceID, DtJoinConfirmMsg::errorCodes errorCode);
425 
426 #ifdef DtIFSPEC1516
427 
428  virtual void sendSyncPointMsg(DtSyncMsgType kind, DtFederateHandle& id,
429  char const * name,
430  rti1516::VariableLengthData const* tag = NULL,
431  DtFederateHandleSet const * set = NULL);
432 #ifdef DtTIME
433 
435  virtual void sendSaveRequestTsoMsg(char const * label,
436  rti1516::LogicalTime const * time);
437 #endif
438 #elif defined(DtIFSPEC1516E)
439 
440  virtual void sendSyncPointMsg(DtSyncMsgType kind, DtFederateHandle& id,
441  char const * name,
442  rti1516e::VariableLengthData const* tag = NULL,
443  DtFederateHandleSet const * set = NULL);
444 #ifdef DtTIME
445 
447  virtual void sendSaveRequestTsoMsg(char const * label,
448  rti1516e::LogicalTime const * time);
449 #endif
450 #else
451 
452  virtual void sendSyncPointMsg(DtSyncMsgType kind, DtFederateHandle& id,
453  char const * name,
454  char const * tag = NULL,
455  DtFederateHandleSet const * set = NULL);
456 #ifdef DtTIME
457 
458  virtual void sendSaveRequestTsoMsg(char const * label,
459  RTI::FedTime const * time);
460 #endif
461 #endif
462 
464  virtual void sendSaveRequestMsg(unsigned long requestID, const char *label);
465 
467  virtual void sendSaveBegunMsg();
468 
470  virtual void sendSaveCompleteMsg(const char *label, bool success);
471 
473  virtual void sendRestoreRequestMsg(const char *label);
474 
476  virtual void sendRestoreBegunMsg(const char *label, DtResponseFlag response);
477 
479  virtual void sendRestoreCompleteMsg(const char *label, bool success);
481 
484 
485 
488  virtual void initiateSave();
489 
492 #ifdef DtIFSPEC1516
493  virtual void initiateTimedSave(rti1516::LogicalTime const& saveTime);
494 #elif defined(DtIFSPEC1516E)
495  virtual void initiateTimedSave(rti1516e::LogicalTime const& saveTime);
496 #else
497  virtual void initiateTimedSave(RTI::FedTime const& saveTime);
498 #endif
499 
502  virtual bool saveLRC(DtRtiSaveFile& saveFile);
503 
505  virtual bool save(DtRtiSaveFile& file);
506 
509  virtual void prepareToRestoreLRC();
510 
513  virtual bool restoreLRC(DtRtiSaveFile& saveFile);
514 
516  virtual void prepareToRestore();
517 
519  virtual bool restore( DtRtiSaveFile& file );
521 
523  virtual void posttick();
524 
525 public:
526 
529 
530 
532  static void processSyncPointMsg(const DtSyncPointMsg& msg, void* usr);
533 
535  static void processDesignatedFederateMsg(const DtDesignatedFederateMsg& msg, void* usr);
536 
538  static void processFomModuleFileRequestMsg( const DtFomModuleRequestMsg& msg, void* usr);
539 
541  static void processCreateResponseMsg(const DtCreateResponseMsg& msg, void* usr);
542 
543 #ifdef DtIFSPEC1516E
544 
545  static void processReportFederationsMsg(const DtReportFederationsMsg& msg, void* usr);
546 #endif
547 
549  static void processJoinResponseMsg(const DtJoinResponseMsg& msg, void* usr);
550 
552  static void processDestroyResponseMsg(const DtDestroyResponseMsg& msg, void* usr);
553 
554 #if defined(DtIFSPEC1516) || defined(DtIFSPEC1516E)
555 
556  static void processSaveStatusMsg(const DtSaveStatusMsg& msg, void* usr);
557 
559  static void processRestoreStatusMsg(const DtRestoreStatusMsg& msg, void* usr);
560 #endif
561 
564  static void processNewFomClassesMsg(const DtNewFomClassesMsg& msg, void* usr);
566 
567 
569  static DtFederateMgr* create(DtRIDParameters* params,
570  DtRtiAmbassadorBaseImplementor* ambImplPtr,
571  DtConnectionMgr* connMgr,
572  DtBoost::shared_ptr<DtRtiAssistantLrcClient> assistantClient);
573 
574 protected:
575 
577  std::map<DtString, DtSynchronousFileDistributor*> myDistributors;
578 
581 
584 
586  MAKRti:: DtString myCreateResponseErrorString;
587 
590 
593 
596 
598  MAKRti::DtString myDestroyExecutionName;
599 
602 
604  std::vector<MAKRti::DtString> myFomModuleRequests;
605 
607  unsigned short myJoinRequestID;
608 
610  unsigned long mySaveRequestID;
611 
614 
619  MAKRti::DtHashList mySyncPoints;
620 
622 #if defined(DtIFSPEC1516) || defined(DtIFSPEC1516E)
623  std::wstring* myFailedSyncPointLabel;
624 #else
626 #endif
627 
632 
636 
637 
641 
644  std::map<MAKRti::DtString, DtFileInformation*> myTakenFiles;
645 
647  std::list<DtNewFomClassesMsg*> myNewFomClassMsgs;
648 
649  DtFedReader13 * myFedReader13;
650  DtFedReader1516 * myFedReader1516;
651  DtFedReader1516e * myFedReader1516e;
652  DtFedReader * getReader( DtFomType theFomType );
653 
654  MAKRti::DtFilename myStandardMimPath;
655 
656  void populateWithUnknownFoms(std::vector<DtString> & mods, std::vector<DtString> & requestedMods);
657  bool isFomAvailable(const DtString & fomName);
658  void getCrcsOfFoms( std::vector<unsigned int> & moduleCrcs, const std::vector<MAKRti::DtString> & creationFomModuleNames );
660  MAKRti::DtFilename & getStandardMimPath();
661 };
662 
663 #endif
664 
665 
666 

Document ID: Generated on Tue May 7 16:26:47 EDT 2013 from SVN revision 126903
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)