MAK RTIspy API Documentation for HLA 1516
 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 namespace vrlmod
49 {
50  class DtThreadedObject;
51 }
52 
64 {
65 public:
66 
70  DtConnectionMgr* connMgr,
71  DtBoost::shared_ptr<DtRtiAssistantLrcClient> assistantClient);
72 
74  virtual ~DtRtiExecFederateMgr();
75 
76 private:
77 
80 
83 
84 public:
85 
88 
89 
91  virtual void createFederationExecution(
92  const char* executionName, const char* timeImplName,
93 #ifdef DtIFSPEC1516E
94  const std::vector<DtString>& fomModules,
95  const char* mimModule);
96 #else
97  const char* fed);
98 #endif
99 
101  virtual void destroyFederationExecution(
102  const char* executionName);
103 
104 #ifdef DtIFSPEC1516E
105 
106  virtual void listFederationExecutions();
107 #endif
108 
110 #ifdef DtIFSPEC1516
112  const char* yourName,
113  const char* executionName,
114  rti1516::FederateAmbassador* federateAmbassadorReference,
115  unsigned long flags);
116 #elif defined(DtIFSPEC1516E)
118  const char* federateName,
119  const char* yourName,
120  const char* executionName,
121  const std::vector<DtString>& fomModules,
122  unsigned long flags);
123 #else
124 
126  const char* yourName,
127  const char* executionName,
128  RTI::FederateAmbassador* federateAmbassadorReference,
129  unsigned long flags);
130 #endif
131 
132 
134 #ifdef DtIFSPEC1516
135  virtual void resignFederationExecution(
136  rti1516::ResignAction theAction);
137 #elif defined(DtIFSPEC1516E)
138  virtual void resignFederationExecution(
139  rti1516e::ResignAction theAction);
140 #else
141  virtual void resignFederationExecution(
142  RTI::ResignAction theAction);
143 #endif
144 
145 
148 
149 
151 #ifdef DtIFSPEC1516
153  char const * label,
154  rti1516::VariableLengthData const & theTag);
155 #elif defined(DtIFSPEC1516E)
157  char const * label,
158  rti1516e::VariableLengthData const & theTag);
159 #else
161  char const * label,
162  char const * theTag);
163 #endif
164 
166 #ifdef DtIFSPEC1516
168  char const * label,
169  rti1516::VariableLengthData const & theTag,
170  DtFederateHandleSet const & syncSet);
171 #elif defined(DtIFSPEC1516E)
173  char const * label,
174  rti1516e::VariableLengthData const & theTag,
175  DtFederateHandleSet const & syncSet);
176 #else
178  char const * label,
179  char const * theTag,
180  DtFederateHandleSet const & syncSet);
181 #endif
182 
183 
185  virtual void synchronizationPointAchieved(char const * label, bool successfully=true);
187 
190 
191 
192 #ifdef DtIFSPEC1516
193 
194  virtual void requestFederationSave (char const * label,
195  rti1516::LogicalTime const * time=NULL);
196 
198  virtual void queryFederationSaveStatus();
199 
201  virtual void queryFederationRestoreStatus();
202 #elif defined(DtIFSPEC1516E)
203 
204  virtual void requestFederationSave (char const * label,
205  rti1516e::LogicalTime const * time=NULL);
206 
208  virtual void queryFederationSaveStatus();
209 
211  virtual void queryFederationRestoreStatus();
212 
214  virtual void abortFederationSave();
215 
217  virtual void abortFederationRestore();
218 #else
219 
221  virtual void requestFederationSave (char const * label,
222  RTI::FedTime const * time=NULL);
223 #endif
224 
226  virtual void federateSaveBegun ();
227 
229  virtual void federateSaveComplete ();
230 
232  virtual void federateSaveNotComplete ();
233 
235  virtual void requestFederationRestore ( const char *label);
236 
238  virtual void federateRestoreComplete ();
239 
241  virtual void federateRestoreNotComplete ();
243 
245  std::map<DtString, DtSynchronousFileDistributor*>& distributors();
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  virtual void waitForResignResponse(bool serviceCall = true);
269 
272  bool checkJoinResponse();
273 
275  virtual void initializeTimeFactory();
276 
278  virtual void initializeFOM( const char* executionName );
279 
280 
283  virtual void postJoinInit(
284  const char* yourName,
285  const char* executionName,
286  const char* federateName
287 #ifdef DtIFSPEC1516
288  , rti1516::FederateAmbassador* federateAmbassadorReference);
289 #elif defined(DtIFSPEC1516E)
290  );
291 #else
292  , RTI::FederateAmbassador* federateAmbassadorReference);
293 #endif
294 
297  virtual void postJoinConfirmInit();
298 
300  virtual void handleFailedJoin(unsigned long sourceID,
302 
304  virtual void setDesignatedFederate(bool isDesignated);
305  virtual bool isDesignatedFederate();
306 
309  void appendFomModule(std::vector<MAKRti::DtString>& target,
310  MAKRti::DtString const& source);
311 
314  void appendFomModules(std::vector<MAKRti::DtString>& target,
315  std::vector<MAKRti::DtString> const& source);
316 
318  virtual bool findFedFileNameFromMapping( const MAKRti::DtString execName,
319  const std::vector<MAKRti::DtString>& orig,
320  std::vector<MAKRti::DtString>& namesToUse) const;
321 
323  void testReadFomModules(const DtRIDParameters::DtStringList&,
324  MAKRti::DtString executionName, bool isMim = false);
325 
327  virtual void mergeFomModules(const std::vector<MAKRti::DtString>* fomModules);
328 
332 
333 
335  virtual void processSyncPointMsg(const DtSyncPointMsg& msg);
336 
338  virtual void processDesignatedFederateMsg(const DtDesignatedFederateMsg& msg);
339 
341  virtual void processFomModuleFileRequestMsg(const DtFomModuleRequestMsg& msg);
342 
344  virtual void processCreateResponseMsg(const DtCreateResponseMsg& msg);
345 
346 #ifdef DtIFSPEC1516E
347 
348  virtual void processReportFederationsMsg(const DtReportFederationsMsg& msg);
349 #endif
350 
352  virtual void processJoinResponseMsg(const DtJoinResponseMsg& msg);
353 
355  virtual void processDestroyResponseMsg(const DtDestroyResponseMsg& msg);
356 
358  virtual void processSaveInitiate(const DtSaveInitiateMsg& msg);
359 
361  virtual void processSaveInitiate(const char* label);
362 
364  virtual void requestImmediateSave(const char *label);
365 
367  virtual void processSaveResponse(const DtSaveResponseMsg& msg);
368 
370  virtual void processSaveFinished(const DtSaveFinishedMsg& msg);
371 
373  virtual void processRestoreReply(const DtRestoreReplyMsg& msg);
374 
376  virtual void processRestoreEnd(const DtRestoreEndMsg& msg);
377 
379  virtual void processRestoreInitiate(const DtRestoreInitiateMsg& msg);
380 
382  virtual void processRestore(const DtRestoreMsg& msg);
383 
384 #if defined(DtIFSPEC1516) || defined(DtIFSPEC1516E)
385 
386  virtual void processSaveStatusMsg(const DtSaveStatusMsg& msg);
387 
389  virtual void processRestoreStatusMsg(const DtRestoreStatusMsg& msg);
390 #endif
391 
394  virtual void processNewFomClassesMsg(const DtNewFomClassesMsg& msg);
395 
397  virtual void processResignResponseMsg(const DtResignRespMsg& msg);
398 
400 
402  virtual void testSaveProgress();
403 
405  virtual void applyRidParameters();
406 
411  virtual void processNewFomClasses(const DtNewFomClassesMsg& msg);
412 
413 
416 
417 
419  virtual void sendCreateMsg(MAKRti::DtString const & fedExNameVal,
420  MAKRti::DtString const & timeImplName, const std::vector<unsigned int> & moduleCrcs,
421  MAKRti::DtFomType fedType, MAKRti::DtString const &momModuleName,
422  const std::vector<MAKRti::DtString>& fomModules, unsigned int momModuleCrc);
423 
425  virtual void sendDestroyMsg(const char* name);
426 
428  virtual void sendJoinMsg(
429  unsigned long sourceID, unsigned short requestID, const char* fedType,
430  const char* fedExName, const char* fedName,
431  const std::vector<MAKRti::DtString>& fomModules,
432  const unsigned long flags, const std::vector<unsigned int>& joinModulesCrcs);
433 
435  virtual void sendJoinConfirmMsg(
436  unsigned long sourceID, DtJoinConfirmMsg::errorCodes errorCode);
437 
438 #ifdef DtIFSPEC1516
439 
440  virtual void sendSyncPointMsg(DtSyncMsgType kind, DtFederateHandle& id,
441  char const * name,
442  rti1516::VariableLengthData const* tag = NULL,
443  DtFederateHandleSet const * set = NULL);
444 #ifdef DtTIME
445 
447  virtual void sendSaveRequestTsoMsg(char const * label,
448  rti1516::LogicalTime const * time);
449 #endif
450 #elif defined(DtIFSPEC1516E)
451 
452  virtual void sendSyncPointMsg(DtSyncMsgType kind, DtFederateHandle& id,
453  char const * name,
454  rti1516e::VariableLengthData const* tag = NULL,
455  DtFederateHandleSet const * set = NULL);
456 #ifdef DtTIME
457 
459  virtual void sendSaveRequestTsoMsg(char const * label,
460  rti1516e::LogicalTime const * time);
461 #endif
462 #else
463 
464  virtual void sendSyncPointMsg(DtSyncMsgType kind, DtFederateHandle& id,
465  char const * name,
466  char const * tag = NULL,
467  DtFederateHandleSet const * set = NULL);
468 #ifdef DtTIME
469 
470  virtual void sendSaveRequestTsoMsg(char const * label,
471  RTI::FedTime const * time);
472 #endif
473 #endif
474 
476  virtual void sendSaveRequestMsg(unsigned long requestID, const char *label);
477 
479  virtual void sendSaveBegunMsg();
480 
482  virtual void sendSaveCompleteMsg(const char *label, bool success);
483 
485  virtual void sendRestoreRequestMsg(const char *label);
486 
488  virtual void sendRestoreBegunMsg(const char *label, DtResponseFlag response);
489 
491  virtual void sendRestoreCompleteMsg(const char *label, bool success);
493 
496 
497 
500  virtual void initiateSave();
501 
504 #ifdef DtIFSPEC1516
505  virtual void initiateTimedSave(rti1516::LogicalTime const& saveTime);
506 #elif defined(DtIFSPEC1516E)
507  virtual void initiateTimedSave(rti1516e::LogicalTime const& saveTime);
508 #else
509  virtual void initiateTimedSave(RTI::FedTime const& saveTime);
510 #endif
511 
514  virtual bool saveLRC(DtRtiSaveFile& saveFile);
515 
517  virtual bool save(DtRtiSaveFile& file);
518 
521  virtual void prepareToRestoreLRC();
522 
525  virtual bool restoreLRC(DtRtiSaveFile& saveFile);
526 
528  virtual void prepareToRestore();
529 
531  virtual bool restore( DtRtiSaveFile& file );
533 
535  virtual void posttick();
536 
537 public:
538 
541 
542 
544  static void processSyncPointMsg(const DtSyncPointMsg& msg, void* usr);
545 
547  static void processDesignatedFederateMsg(const DtDesignatedFederateMsg& msg, void* usr);
548 
550  static void processFomModuleFileRequestMsg( const DtFomModuleRequestMsg& msg, void* usr);
551 
553  static void processCreateResponseMsg(const DtCreateResponseMsg& msg, void* usr);
554 
555 #ifdef DtIFSPEC1516E
556 
557  static void processReportFederationsMsg(const DtReportFederationsMsg& msg, void* usr);
558 #endif
559 
561  static void processJoinResponseMsg(const DtJoinResponseMsg& msg, void* usr);
562 
564  static void processDestroyResponseMsg(const DtDestroyResponseMsg& msg, void* usr);
565 
566 #if defined(DtIFSPEC1516) || defined(DtIFSPEC1516E)
567 
568  static void processSaveStatusMsg(const DtSaveStatusMsg& msg, void* usr);
569 
571  static void processRestoreStatusMsg(const DtRestoreStatusMsg& msg, void* usr);
572 #endif
573 
576  static void processNewFomClassesMsg(const DtNewFomClassesMsg& msg, void* usr);
577 
579  static void processResignResponseMsg(const DtResignRespMsg& msg, void* usr);
580 
582 
583 
585  static DtFederateMgr* create(DtRIDParameters* params,
586  DtRtiAmbassadorBaseImplementor* ambImplPtr,
587  DtConnectionMgr* connMgr,
588  DtBoost::shared_ptr<DtRtiAssistantLrcClient> assistantClient);
589 
590 protected:
591 
593  std::map<DtString, DtSynchronousFileDistributor*> myDistributors;
594 
597 
600 
603 
606 
608  MAKRti:: DtString myCreateResponseErrorString;
609 
612 
615 
618 
620  MAKRti::DtString myDestroyExecutionName;
621 
623  std::map<DtString, bool> myFedFileRequests;
624 
626  std::vector<MAKRti::DtString> myFomModuleRequests;
627 
629  unsigned short myJoinRequestID;
630 
632  unsigned long mySaveRequestID;
633 
636 
641  MAKRti::DtHashList mySyncPoints;
642 
644 #if defined(DtIFSPEC1516) || defined(DtIFSPEC1516E)
645  std::wstring* myFailedSyncPointLabel;
646 #else
648 #endif
649 
654 
658 
659 
663 
666  std::map<MAKRti::DtString, DtFileInformation*> myTakenFiles;
667 
669  std::list<DtNewFomClassesMsg*> myNewFomClassMsgs;
670 
671  DtFedReader13 * myFedReader13;
672  DtFedReader1516 * myFedReader1516;
673  DtFedReader1516e * myFedReader1516e;
674  DtFedReader * getReader( DtFomType theFomType );
675 
676 
677  void populateWithUnknownFoms(std::vector<DtString> & mods, std::vector<DtString> & requestedMods);
678  bool isFomAvailable(const DtString & fomName);
679  void getCrcsOfFoms( std::vector<unsigned int> & moduleCrcs, const std::vector<MAKRti::DtString> & creationFomModuleNames );
681 };
682 
683 #endif
684 
685 
686 

Document ID: Generated on Wed Mar 11 20:26:49 EDT 2015 from SVN revision 150939
Copyright © 2005-2015 VT MÄK Inc. All Rights Reserved (www.mak.com)