MAK RTIspy API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 "resignRespMsg.h"
31 #include <vector>
32 #include <set>
33 
34 #include "mtl/fedReader13.h"
35 #include "mtl/fedReader1516.h"
36 #include "mtl/fedReader1516e.h"
37 
38 class DtSyncPointMsg;
40 class DtSaveStatusMsg;
41 class DtRestoreStatusMsg;
42 class DtSaveFinishedMsg;
43 class DtSaveInitiateMsg;
44 class DtRestoreReplyMsg;
45 class DtRestoreEndMsg;
47 class DtRestoreMsg;
49 class DtNameReservedMsg;
50 
51 namespace vrlmod
52 {
53  class DtThreadedObject;
54 }
55 
67 {
68 public:
69 
73  DtConnectionMgr* connMgr,
74  DtBoost::shared_ptr<DtRtiAssistantLrcClient> assistantClient);
75 
77  virtual ~DtRtiExecFederateMgr();
78 
79 private:
80 
83 
86 
87 public:
88 
91 
92 
94  virtual void createFederationExecution(
95  const char* executionName, const char* timeImplName,
96 #ifdef DtIFSPEC1516E
97  const std::vector<DtString>& fomModules,
98  const char* mimModule);
99 #else
100  const char* fed);
101 #endif
102 
104  virtual void destroyFederationExecution(
105  const char* executionName);
106 
107 #ifdef DtIFSPEC1516E
108 
109  virtual void listFederationExecutions();
110 #endif
111 
113 #ifdef DtIFSPEC1516
115  const char* yourName,
116  const char* executionName,
117  rti1516::FederateAmbassador* federateAmbassadorReference,
118  unsigned long flags);
119 #elif defined(DtIFSPEC1516E)
121  const char* federateName,
122  const char* yourName,
123  const char* executionName,
124  const std::vector<DtString>& fomModules,
125  unsigned long flags);
126 #else
127 
129  const char* yourName,
130  const char* executionName,
131  RTI::FederateAmbassador* federateAmbassadorReference,
132  unsigned long flags);
133 #endif
134 
135 
137 #ifdef DtIFSPEC1516
138  virtual void resignFederationExecution(
139  rti1516::ResignAction theAction);
140 #elif defined(DtIFSPEC1516E)
141  virtual void resignFederationExecution(
142  rti1516e::ResignAction theAction);
143 #else
144  virtual void resignFederationExecution(
145  RTI::ResignAction theAction);
146 #endif
147 
148 
151 
152 
154 #ifdef DtIFSPEC1516
156  char const * label,
157  rti1516::VariableLengthData const & theTag);
158 #elif defined(DtIFSPEC1516E)
160  char const * label,
161  rti1516e::VariableLengthData const & theTag);
162 #else
164  char const * label,
165  char const * theTag);
166 #endif
167 
169 #ifdef DtIFSPEC1516
171  char const * label,
172  rti1516::VariableLengthData const & theTag,
173  DtFederateHandleSet const & syncSet);
174 #elif defined(DtIFSPEC1516E)
176  char const * label,
177  rti1516e::VariableLengthData const & theTag,
178  DtFederateHandleSet const & syncSet);
179 #else
181  char const * label,
182  char const * theTag,
183  DtFederateHandleSet const & syncSet);
184 #endif
185 
186 
188  virtual void synchronizationPointAchieved(char const * label, bool successfully=true);
190 
193 
194 
195 #ifdef DtIFSPEC1516
196 
197  virtual void requestFederationSave (char const * label,
198  rti1516::LogicalTime const * time=NULL);
199 
201  virtual void queryFederationSaveStatus();
202 
204  virtual void queryFederationRestoreStatus();
205 #elif defined(DtIFSPEC1516E)
206 
207  virtual void requestFederationSave (char const * label,
208  rti1516e::LogicalTime const * time=NULL);
209 
211  virtual void queryFederationSaveStatus();
212 
214  virtual void queryFederationRestoreStatus();
215 
217  virtual void abortFederationSave();
218 
220  virtual void abortFederationRestore();
221 #else
222 
224  virtual void requestFederationSave (char const * label,
225  RTI::FedTime const * time=NULL);
226 #endif
227 
229  virtual void federateSaveBegun ();
230 
232  virtual void federateSaveComplete ();
233 
235  virtual void federateSaveNotComplete ();
236 
238  virtual void requestFederationRestore ( const char *label);
239 
241  virtual void federateRestoreComplete ();
242 
244  virtual void federateRestoreNotComplete ();
246 
249  DtSynchronousFileDistributor* distributor(const char* executionName);
250 
252 
253  DtSynchronousFileDistributor* joinDistributor();
254  DtSynchronousFileDistributor* joinDistributor() const;
256 
258  virtual void init();
259 
260 protected:
261 
263  virtual void initRidTester();
264 
266  virtual void waitForCreateResponse( const char* executionName );
267 
269  virtual void waitForJoinResponse( const char* executionName,
270  std::vector<MAKRti::DtString> &joinModules );
271 
273  virtual void waitForResignResponse(bool serviceCall = true);
274 
276  virtual void waitForReserveNameResponse(bool serviceCall = true);
277 
279  void handleFailedJoinResponse(bool timedOutDueToCreation);
280 
282  virtual void initializeTimeFactory();
283 
285  virtual void initializeFOM( const char* executionName );
286 
287 
290  virtual void postJoinInit(
291  const char* yourName,
292  const char* executionName,
293  const char* federateName
294 #ifdef DtIFSPEC1516
295  , rti1516::FederateAmbassador* federateAmbassadorReference);
296 #elif defined(DtIFSPEC1516E)
297  );
298 #else
299  , RTI::FederateAmbassador* federateAmbassadorReference);
300 #endif
301 
304  virtual void postJoinConfirmInit();
305 
307  virtual void handleFailedJoin(unsigned long sourceID,
309 
311  virtual void setDesignatedFederate(bool isDesignated);
312  virtual bool isDesignatedFederate();
313 
316  void appendFomModule(std::vector<MAKRti::DtString>& target,
317  MAKRti::DtString const& source);
318 
321  void appendFomModules(std::vector<MAKRti::DtString>& target,
322  std::vector<MAKRti::DtString> const& source);
323 
325  virtual bool findFedFileNameFromMapping( const MAKRti::DtString execName,
326  const std::vector<MAKRti::DtString>& orig,
327  std::vector<MAKRti::DtString>& namesToUse) const;
328 
330  void testReadFomModules(const DtRIDParameters::DtStringList&,
331  MAKRti::DtString executionName, bool isMim = false);
332 
334  virtual void mergeFomModules(const std::vector<MAKRti::DtString>* fomModules);
335 
339 
340 
342  virtual void processSyncPointMsg(const DtSyncPointMsg& msg);
343 
345  virtual void processDesignatedFederateMsg(const DtDesignatedFederateMsg& msg);
346 
348  virtual void processFomModuleFileRequestMsg(const DtFomModuleRequestMsg& msg);
349 
351  virtual void processCreateResponseMsg(const DtCreateResponseMsg& msg);
352 
353 #ifdef DtIFSPEC1516E
354 
355  virtual void processReportFederationsMsg(const DtReportFederationsMsg& msg);
356 #endif
357 
359  virtual void processJoinResponseMsg(const DtJoinResponseMsg& msg);
360 
362  virtual void processDestroyResponseMsg(const DtDestroyResponseMsg& msg);
363 
365  virtual void processSaveInitiate(const DtSaveInitiateMsg& msg);
366 
368  virtual void processSaveInitiate(const char* label);
369 
371  virtual void requestImmediateSave(const char *label);
372 
374  virtual void processSaveResponse(const DtSaveResponseMsg& msg);
375 
377  virtual void processSaveFinished(const DtSaveFinishedMsg& msg);
378 
380  virtual void processRestoreReply(const DtRestoreReplyMsg& msg);
381 
383  virtual void processRestoreEnd(const DtRestoreEndMsg& msg);
384 
386  virtual void processRestoreInitiate(const DtRestoreInitiateMsg& msg);
387 
389  virtual void processRestore(const DtRestoreMsg& msg);
390 
391 #if defined(DtIFSPEC1516) || defined(DtIFSPEC1516E)
392 
393  virtual void processSaveStatusMsg(const DtSaveStatusMsg& msg);
394 
396  virtual void processRestoreStatusMsg(const DtRestoreStatusMsg& msg);
397 #endif
398 
401  virtual void processNewFomClassesMsg(const DtNewFomClassesMsg& msg);
402 
404  virtual void processResignResponseMsg(const DtResignRespMsg& msg);
405 
407  virtual void processRegisterNameMsg(const DtNameReservedMsg& msg);
408 
410 
412  virtual void testSaveProgress();
413 
415  virtual void applyRidParameters();
416 
421  virtual void processNewFomClasses(const DtNewFomClassesMsg& msg);
422 
423 
426 
427 
429  virtual void sendCreateMsg(MAKRti::DtString const & fedExNameVal,
430  MAKRti::DtString const & timeImplName, const std::vector<unsigned int> & moduleCrcs,
431  MAKRti::DtFomType fedType, MAKRti::DtString const &momModuleName,
432  const std::vector<MAKRti::DtString>& fomModules, unsigned int momModuleCrc);
433 
435  virtual void sendDestroyMsg(const char* name);
436 
438  virtual void sendJoinMsg(
439  unsigned long sourceID, unsigned short requestID, const char* fedType,
440  const char* fedExName, const char* fedName,
441  const std::vector<MAKRti::DtString>& fomModules,
442  const unsigned long flags, const std::vector<unsigned int>& joinModulesCrcs);
443 
445  virtual void sendJoinConfirmMsg(
446  unsigned long sourceID, DtJoinConfirmMsg::errorCodes errorCode);
447 
448 #ifdef DtIFSPEC1516
449 
450  virtual void sendSyncPointMsg(DtSyncMsgType kind, DtFederateHandle& id,
451  char const * name,
452  rti1516::VariableLengthData const* tag = NULL,
453  DtFederateHandleSet const * set = NULL);
454 #ifdef DtTIME
455 
457  virtual void sendSaveRequestTsoMsg(char const * label,
458  rti1516::LogicalTime const * time);
459 #endif
460 #elif defined(DtIFSPEC1516E)
461 
462  virtual void sendSyncPointMsg(DtSyncMsgType kind, DtFederateHandle& id,
463  char const * name,
464  rti1516e::VariableLengthData const* tag = NULL,
465  DtFederateHandleSet const * set = NULL);
466 #ifdef DtTIME
467 
469  virtual void sendSaveRequestTsoMsg(char const * label,
470  rti1516e::LogicalTime const * time);
471 #endif
472 #else
473 
474  virtual void sendSyncPointMsg(DtSyncMsgType kind, DtFederateHandle& id,
475  char const * name,
476  char const * tag = NULL,
477  DtFederateHandleSet const * set = NULL);
478 #ifdef DtTIME
479 
480  virtual void sendSaveRequestTsoMsg(char const * label,
481  RTI::FedTime const * time);
482 #endif
483 #endif
484 
486  virtual void sendSaveRequestMsg(unsigned long requestID, const char *label);
487 
489  virtual void sendSaveBegunMsg();
490 
492  virtual void sendSaveCompleteMsg(const char *label, bool success);
493 
495  virtual void sendRestoreRequestMsg(const char *label);
496 
498  virtual void sendRestoreBegunMsg(const char *label, DtResponseFlag response);
499 
501  virtual void sendRestoreCompleteMsg(const char *label, bool success);
503 
506 
507 
510  virtual void initiateSave();
511 
514 #ifdef DtIFSPEC1516
515  virtual void initiateTimedSave(rti1516::LogicalTime const& saveTime);
516 #elif defined(DtIFSPEC1516E)
517  virtual void initiateTimedSave(rti1516e::LogicalTime const& saveTime);
518 #else
519  virtual void initiateTimedSave(RTI::FedTime const& saveTime);
520 #endif
521 
524  virtual bool saveLRC(DtRtiSaveFile& saveFile);
525 
527  virtual bool save(DtRtiSaveFile& file);
528 
531  virtual void prepareToRestoreLRC();
532 
535  virtual bool restoreLRC(DtRtiSaveFile& saveFile);
536 
538  virtual void prepareToRestore();
539 
541  virtual bool restore( DtRtiSaveFile& file );
543 
545  virtual void posttick();
546 
547 public:
548 
551 
552 
554  static void processSyncPointMsg(const DtSyncPointMsg& msg, void* usr);
555 
557  static void processDesignatedFederateMsg(const DtDesignatedFederateMsg& msg, void* usr);
558 
560  static void processFomModuleFileRequestMsg( const DtFomModuleRequestMsg& msg, void* usr);
561 
563  static void processCreateResponseMsg(const DtCreateResponseMsg& msg, void* usr);
564 
565 #ifdef DtIFSPEC1516E
566 
567  static void processReportFederationsMsg(const DtReportFederationsMsg& msg, void* usr);
568 #endif
569 
571  static void processJoinResponseMsg(const DtJoinResponseMsg& msg, void* usr);
572 
574  static void processDestroyResponseMsg(const DtDestroyResponseMsg& msg, void* usr);
575 
576 #if defined(DtIFSPEC1516) || defined(DtIFSPEC1516E)
577 
578  static void processSaveStatusMsg(const DtSaveStatusMsg& msg, void* usr);
579 
581  static void processRestoreStatusMsg(const DtRestoreStatusMsg& msg, void* usr);
582 #endif
583 
586  static void processNewFomClassesMsg(const DtNewFomClassesMsg& msg, void* usr);
587 
589  static void processResignResponseMsg(const DtResignRespMsg& msg, void* usr);
590 
592  static void processRegisterNameMsg(const DtNameReservedMsg& msg, void* usr);
593 
595 
596 
598  static DtFederateMgr* create(DtRIDParameters* params,
599  DtRtiAmbassadorBaseImplementor* ambImplPtr,
600  DtConnectionMgr* connMgr,
601  DtBoost::shared_ptr<DtRtiAssistantLrcClient> assistantClient);
602 
603 protected:
604 
606  std::map<DtString, DtSynchronousFileDistributor*> myDistributors;
607 
610 
613 
616 
619 
623 
625  MAKRti:: DtString myCreateResponseErrorString;
626 
629 
632 
635 
637  MAKRti::DtString myDestroyExecutionName;
638 
640  std::map<DtString, bool> myFedFileRequests;
641 
643  std::vector<MAKRti::DtString> myFomModuleRequests;
644 
646  unsigned short myJoinRequestID;
647 
649  unsigned long mySaveRequestID;
650 
653 
658  std::set<DtString> mySyncPoints;
659 
661 #if defined(DtIFSPEC1516) || defined(DtIFSPEC1516E)
662  std::wstring* myFailedSyncPointLabel;
663 #else
665 #endif
666 
671 
675 
676 
680 
683  std::map<MAKRti::DtString, DtFileInformation*> myTakenFiles;
684 
686  std::list<DtNewFomClassesMsg*> myNewFomClassMsgs;
687 
688  void populateWithUnknownFoms(std::vector<DtString> & mods, std::vector<DtString> & requestedMods);
689  bool isFomAvailable(const DtString & fomName);
690  void getCrcsOfFoms( std::vector<unsigned int> & moduleCrcs, const std::vector<MAKRti::DtString> & creationFomModuleNames );
692  MAKRti::DtString myHostname;
693 
694 };
695 
696 #endif
697 
698 
699 

Document ID: Generated on Fri Sep 27 00:57:56 EDT 2019 from SVN revision 201708
Copyright © 2005-2018 VT MÄK Inc. All Rights Reserved (www.mak.com)