MAK RTIspy API Documentation for HLA Evolved
 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 
33 #include "mtl/fedReader13.h"
34 #include "mtl/fedReader1516.h"
35 #include "mtl/fedReader1516e.h"
36 
37 class DtSyncPointMsg;
39 class DtSaveStatusMsg;
40 class DtRestoreStatusMsg;
41 class DtSaveFinishedMsg;
42 class DtSaveInitiateMsg;
43 class DtRestoreReplyMsg;
44 class DtRestoreEndMsg;
46 class DtRestoreMsg;
48 class DtNameReservedMsg;
49 
50 namespace vrlmod
51 {
52  class DtThreadedObject;
53 }
54 
66 {
67 public:
68 
72  DtConnectionMgr* connMgr,
73  DtBoost::shared_ptr<DtRtiAssistantLrcClient> assistantClient);
74 
76  virtual ~DtRtiExecFederateMgr();
77 
78 private:
79 
82 
85 
86 public:
87 
90 
91 
93  virtual void createFederationExecution(
94  const char* executionName, const char* timeImplName,
95 #ifdef DtIFSPEC1516E
96  const std::vector<DtString>& fomModules,
97  const char* mimModule);
98 #else
99  const char* fed);
100 #endif
101 
103  virtual void destroyFederationExecution(
104  const char* executionName);
105 
106 #ifdef DtIFSPEC1516E
107 
108  virtual void listFederationExecutions();
109 #endif
110 
112 #ifdef DtIFSPEC1516
113  virtual rti1516::FederateHandle joinFederationExecution (
114  const char* yourName,
115  const char* executionName,
116  rti1516::FederateAmbassador* federateAmbassadorReference,
117  unsigned long flags);
118 #elif defined(DtIFSPEC1516E)
119  virtual rti1516e::FederateHandle joinFederationExecution (
120  const char* federateName,
121  const char* yourName,
122  const char* executionName,
123  const std::vector<DtString>& fomModules,
124  unsigned long flags);
125 #else
126 
127  virtual RTI::FederateHandle joinFederationExecution (
128  const char* yourName,
129  const char* executionName,
130  RTI::FederateAmbassador* federateAmbassadorReference,
131  unsigned long flags);
132 #endif
133 
134 
136 #ifdef DtIFSPEC1516
137  virtual void resignFederationExecution(
138  rti1516::ResignAction theAction);
139 #elif defined(DtIFSPEC1516E)
140  virtual void resignFederationExecution(
141  rti1516e::ResignAction theAction);
142 #else
143  virtual void resignFederationExecution(
144  RTI::ResignAction theAction);
145 #endif
146 
147 
150 
151 
153 #ifdef DtIFSPEC1516
155  char const * label,
156  rti1516::VariableLengthData const & theTag);
157 #elif defined(DtIFSPEC1516E)
159  char const * label,
160  rti1516e::VariableLengthData const & theTag);
161 #else
163  char const * label,
164  char const * theTag);
165 #endif
166 
168 #ifdef DtIFSPEC1516
170  char const * label,
171  rti1516::VariableLengthData const & theTag,
172  DtFederateHandleSet const & syncSet);
173 #elif defined(DtIFSPEC1516E)
175  char const * label,
176  rti1516e::VariableLengthData const & theTag,
177  DtFederateHandleSet const & syncSet);
178 #else
180  char const * label,
181  char const * theTag,
182  DtFederateHandleSet const & syncSet);
183 #endif
184 
185 
187  virtual void synchronizationPointAchieved(char const * label, bool successfully=true);
189 
192 
193 
194 #ifdef DtIFSPEC1516
195 
196  virtual void requestFederationSave (char const * label,
197  rti1516::LogicalTime const * time=NULL);
198 
200  virtual void queryFederationSaveStatus();
201 
203  virtual void queryFederationRestoreStatus();
204 #elif defined(DtIFSPEC1516E)
205 
206  virtual void requestFederationSave (char const * label,
207  rti1516e::LogicalTime const * time=NULL);
208 
210  virtual void queryFederationSaveStatus();
211 
213  virtual void queryFederationRestoreStatus();
214 
216  virtual void abortFederationSave();
217 
219  virtual void abortFederationRestore();
220 #else
221 
223  virtual void requestFederationSave (char const * label,
224  RTI::FedTime const * time=NULL);
225 #endif
226 
228  virtual void federateSaveBegun ();
229 
231  virtual void federateSaveComplete ();
232 
234  virtual void federateSaveNotComplete ();
235 
237  virtual void requestFederationRestore ( const char *label);
238 
240  virtual void federateRestoreComplete ();
241 
243  virtual void federateRestoreNotComplete ();
245 
247  std::map<DtString, DtSynchronousFileDistributor*>& distributors();
248  DtSynchronousFileDistributor* joinDistributor();
249  DtSynchronousFileDistributor* joinDistributor() const;
250 
252  virtual void init();
253 
254 protected:
255 
257  virtual void initRidTester();
258 
260  virtual void initializeDistributor( const char* executionName );
261 
263  virtual void waitForCreateResponse( const char* executionName );
264 
266  virtual void waitForJoinResponse( const char* executionName,
267  std::vector<MAKRti::DtString> &joinModules );
268 
270  virtual void waitForResignResponse(bool serviceCall = true);
271 
273  virtual void waitForReserveNameResponse(bool serviceCall = true);
274 
277  bool checkJoinResponse();
278 
280  virtual void initializeTimeFactory();
281 
283  virtual void initializeFOM( const char* executionName );
284 
285 
288  virtual void postJoinInit(
289  const char* yourName,
290  const char* executionName,
291  const char* federateName
292 #ifdef DtIFSPEC1516
293  , rti1516::FederateAmbassador* federateAmbassadorReference);
294 #elif defined(DtIFSPEC1516E)
295  );
296 #else
297  , RTI::FederateAmbassador* federateAmbassadorReference);
298 #endif
299 
302  virtual void postJoinConfirmInit();
303 
305  virtual void handleFailedJoin(unsigned long sourceID,
307 
309  virtual void setDesignatedFederate(bool isDesignated);
310  virtual bool isDesignatedFederate();
311 
314  void appendFomModule(std::vector<MAKRti::DtString>& target,
315  MAKRti::DtString const& source);
316 
319  void appendFomModules(std::vector<MAKRti::DtString>& target,
320  std::vector<MAKRti::DtString> const& source);
321 
323  virtual bool findFedFileNameFromMapping( const MAKRti::DtString execName,
324  const std::vector<MAKRti::DtString>& orig,
325  std::vector<MAKRti::DtString>& namesToUse) const;
326 
328  void testReadFomModules(const DtRIDParameters::DtStringList&,
329  MAKRti::DtString executionName, bool isMim = false);
330 
332  virtual void mergeFomModules(const std::vector<MAKRti::DtString>* fomModules);
333 
337 
338 
340  virtual void processSyncPointMsg(const DtSyncPointMsg& msg);
341 
343  virtual void processDesignatedFederateMsg(const DtDesignatedFederateMsg& msg);
344 
346  virtual void processFomModuleFileRequestMsg(const DtFomModuleRequestMsg& msg);
347 
349  virtual void processCreateResponseMsg(const DtCreateResponseMsg& msg);
350 
351 #ifdef DtIFSPEC1516E
352 
353  virtual void processReportFederationsMsg(const DtReportFederationsMsg& msg);
354 #endif
355 
357  virtual void processJoinResponseMsg(const DtJoinResponseMsg& msg);
358 
360  virtual void processDestroyResponseMsg(const DtDestroyResponseMsg& msg);
361 
363  virtual void processSaveInitiate(const DtSaveInitiateMsg& msg);
364 
366  virtual void processSaveInitiate(const char* label);
367 
369  virtual void requestImmediateSave(const char *label);
370 
372  virtual void processSaveResponse(const DtSaveResponseMsg& msg);
373 
375  virtual void processSaveFinished(const DtSaveFinishedMsg& msg);
376 
378  virtual void processRestoreReply(const DtRestoreReplyMsg& msg);
379 
381  virtual void processRestoreEnd(const DtRestoreEndMsg& msg);
382 
384  virtual void processRestoreInitiate(const DtRestoreInitiateMsg& msg);
385 
387  virtual void processRestore(const DtRestoreMsg& msg);
388 
389 #if defined(DtIFSPEC1516) || defined(DtIFSPEC1516E)
390 
391  virtual void processSaveStatusMsg(const DtSaveStatusMsg& msg);
392 
394  virtual void processRestoreStatusMsg(const DtRestoreStatusMsg& msg);
395 #endif
396 
399  virtual void processNewFomClassesMsg(const DtNewFomClassesMsg& msg);
400 
402  virtual void processResignResponseMsg(const DtResignRespMsg& msg);
403 
405  virtual void processRegisterNameMsg(const DtNameReservedMsg& msg);
406 
408 
410  virtual void testSaveProgress();
411 
413  virtual void applyRidParameters();
414 
419  virtual void processNewFomClasses(const DtNewFomClassesMsg& msg);
420 
421 
424 
425 
427  virtual void sendCreateMsg(MAKRti::DtString const & fedExNameVal,
428  MAKRti::DtString const & timeImplName, const std::vector<unsigned int> & moduleCrcs,
429  MAKRti::DtFomType fedType, MAKRti::DtString const &momModuleName,
430  const std::vector<MAKRti::DtString>& fomModules, unsigned int momModuleCrc);
431 
433  virtual void sendDestroyMsg(const char* name);
434 
436  virtual void sendJoinMsg(
437  unsigned long sourceID, unsigned short requestID, const char* fedType,
438  const char* fedExName, const char* fedName,
439  const std::vector<MAKRti::DtString>& fomModules,
440  const unsigned long flags, const std::vector<unsigned int>& joinModulesCrcs);
441 
443  virtual void sendJoinConfirmMsg(
444  unsigned long sourceID, DtJoinConfirmMsg::errorCodes errorCode);
445 
446 #ifdef DtIFSPEC1516
447 
448  virtual void sendSyncPointMsg(DtSyncMsgType kind, DtFederateHandle& id,
449  char const * name,
450  rti1516::VariableLengthData const* tag = NULL,
451  DtFederateHandleSet const * set = NULL);
452 #ifdef DtTIME
453 
455  virtual void sendSaveRequestTsoMsg(char const * label,
456  rti1516::LogicalTime const * time);
457 #endif
458 #elif defined(DtIFSPEC1516E)
459 
460  virtual void sendSyncPointMsg(DtSyncMsgType kind, DtFederateHandle& id,
461  char const * name,
462  rti1516e::VariableLengthData const* tag = NULL,
463  DtFederateHandleSet const * set = NULL);
464 #ifdef DtTIME
465 
467  virtual void sendSaveRequestTsoMsg(char const * label,
468  rti1516e::LogicalTime const * time);
469 #endif
470 #else
471 
472  virtual void sendSyncPointMsg(DtSyncMsgType kind, DtFederateHandle& id,
473  char const * name,
474  char const * tag = NULL,
475  DtFederateHandleSet const * set = NULL);
476 #ifdef DtTIME
477 
478  virtual void sendSaveRequestTsoMsg(char const * label,
479  RTI::FedTime const * time);
480 #endif
481 #endif
482 
484  virtual void sendSaveRequestMsg(unsigned long requestID, const char *label);
485 
487  virtual void sendSaveBegunMsg();
488 
490  virtual void sendSaveCompleteMsg(const char *label, bool success);
491 
493  virtual void sendRestoreRequestMsg(const char *label);
494 
496  virtual void sendRestoreBegunMsg(const char *label, DtResponseFlag response);
497 
499  virtual void sendRestoreCompleteMsg(const char *label, bool success);
501 
504 
505 
508  virtual void initiateSave();
509 
512 #ifdef DtIFSPEC1516
513  virtual void initiateTimedSave(rti1516::LogicalTime const& saveTime);
514 #elif defined(DtIFSPEC1516E)
515  virtual void initiateTimedSave(rti1516e::LogicalTime const& saveTime);
516 #else
517  virtual void initiateTimedSave(RTI::FedTime const& saveTime);
518 #endif
519 
522  virtual bool saveLRC(DtRtiSaveFile& saveFile);
523 
525  virtual bool save(DtRtiSaveFile& file);
526 
529  virtual void prepareToRestoreLRC();
530 
533  virtual bool restoreLRC(DtRtiSaveFile& saveFile);
534 
536  virtual void prepareToRestore();
537 
539  virtual bool restore( DtRtiSaveFile& file );
541 
543  virtual void posttick();
544 
545 public:
546 
549 
550 
552  static void processSyncPointMsg(const DtSyncPointMsg& msg, void* usr);
553 
555  static void processDesignatedFederateMsg(const DtDesignatedFederateMsg& msg, void* usr);
556 
558  static void processFomModuleFileRequestMsg( const DtFomModuleRequestMsg& msg, void* usr);
559 
561  static void processCreateResponseMsg(const DtCreateResponseMsg& msg, void* usr);
562 
563 #ifdef DtIFSPEC1516E
564 
565  static void processReportFederationsMsg(const DtReportFederationsMsg& msg, void* usr);
566 #endif
567 
569  static void processJoinResponseMsg(const DtJoinResponseMsg& msg, void* usr);
570 
572  static void processDestroyResponseMsg(const DtDestroyResponseMsg& msg, void* usr);
573 
574 #if defined(DtIFSPEC1516) || defined(DtIFSPEC1516E)
575 
576  static void processSaveStatusMsg(const DtSaveStatusMsg& msg, void* usr);
577 
579  static void processRestoreStatusMsg(const DtRestoreStatusMsg& msg, void* usr);
580 #endif
581 
584  static void processNewFomClassesMsg(const DtNewFomClassesMsg& msg, void* usr);
585 
587  static void processResignResponseMsg(const DtResignRespMsg& msg, void* usr);
588 
590  static void processRegisterNameMsg(const DtNameReservedMsg& msg, void* usr);
591 
593 
594 
596  static DtFederateMgr* create(DtRIDParameters* params,
597  DtRtiAmbassadorBaseImplementor* ambImplPtr,
598  DtConnectionMgr* connMgr,
599  DtBoost::shared_ptr<DtRtiAssistantLrcClient> assistantClient);
600 
601 protected:
602 
604  std::map<DtString, DtSynchronousFileDistributor*> myDistributors;
605 
608 
611 
614 
617 
621 
623  MAKRti:: DtString myCreateResponseErrorString;
624 
627 
630 
633 
635  MAKRti::DtString myDestroyExecutionName;
636 
638  std::map<DtString, bool> myFedFileRequests;
639 
641  std::vector<MAKRti::DtString> myFomModuleRequests;
642 
644  unsigned short myJoinRequestID;
645 
647  unsigned long mySaveRequestID;
648 
651 
656  MAKRti::DtHashList mySyncPoints;
657 
659 #if defined(DtIFSPEC1516) || defined(DtIFSPEC1516E)
660  std::wstring* myFailedSyncPointLabel;
661 #else
663 #endif
664 
669 
673 
674 
678 
681  std::map<MAKRti::DtString, DtFileInformation*> myTakenFiles;
682 
684  std::list<DtNewFomClassesMsg*> myNewFomClassMsgs;
685 
686  void populateWithUnknownFoms(std::vector<DtString> & mods, std::vector<DtString> & requestedMods);
687  bool isFomAvailable(const DtString & fomName);
688  void getCrcsOfFoms( std::vector<unsigned int> & moduleCrcs, const std::vector<MAKRti::DtString> & creationFomModuleNames );
690 };
691 
692 #endif
693 
694 
695 

Document ID: Generated on Mon Mar 21 09:41:37 EDT 2016 from SVN revision 163228
Copyright © 2005-2015 VT MÄK Inc. All Rights Reserved (www.mak.com)