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 "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  std::map<DtString, DtSynchronousFileDistributor*> distributors() const;
247  DtSynchronousFileDistributor* joinDistributor();
248  DtSynchronousFileDistributor* joinDistributor() const;
249 
251  virtual void init();
252 
253 protected:
254 
256  virtual void initRidTester();
257 
259  virtual void initializeDistributor( const char* executionName );
260 
262  virtual void waitForCreateResponse( const char* executionName );
263 
265  virtual void waitForJoinResponse( const char* executionName,
266  std::vector<MAKRti::DtString> &joinModules );
267 
269  virtual void waitForResignResponse();
270 
272  void 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 
296  virtual void handleFailedJoin(unsigned long sourceID,
298 
300  virtual void setDesignatedFederate(bool isDesignated);
301  virtual bool isDesignatedFederate();
302 
305  void appendFomModule(std::vector<MAKRti::DtString>& target,
306  MAKRti::DtString const& source);
307 
310  void appendFomModules(std::vector<MAKRti::DtString>& target,
311  std::vector<MAKRti::DtString> const& source);
312 
314  virtual bool findFedFileNameFromMapping( const MAKRti::DtString execName,
315  const std::vector<MAKRti::DtString>& orig,
316  std::vector<MAKRti::DtString>& namesToUse) const;
317 
319  void testReadFomModules(const DtRIDParameters::DtStringList&,
320  MAKRti::DtString executionName, bool isMim = false);
321 
323  virtual void mergeFomModules(const std::vector<MAKRti::DtString>* fomModules);
324 
328 
329 
331  virtual void processSyncPointMsg(const DtSyncPointMsg& msg);
332 
334  virtual void processDesignatedFederateMsg(const DtDesignatedFederateMsg& msg);
335 
337  virtual void processFomModuleFileRequestMsg(const DtFomModuleRequestMsg& msg);
338 
340  virtual void processCreateResponseMsg(const DtCreateResponseMsg& msg);
341 
342 #ifdef DtIFSPEC1516E
343 
344  virtual void processReportFederationsMsg(const DtReportFederationsMsg& msg);
345 #endif
346 
348  virtual void processJoinResponseMsg(const DtJoinResponseMsg& msg);
349 
351  virtual void processDestroyResponseMsg(const DtDestroyResponseMsg& msg);
352 
354  virtual void processSaveInitiate(const DtSaveInitiateMsg& msg);
355 
357  virtual void processSaveInitiate(const char* label);
358 
360  virtual void requestImmediateSave(const char *label);
361 
363  virtual void processSaveResponse(const DtSaveResponseMsg& msg);
364 
366  virtual void processSaveFinished(const DtSaveFinishedMsg& msg);
367 
369  virtual void processRestoreReply(const DtRestoreReplyMsg& msg);
370 
372  virtual void processRestoreEnd(const DtRestoreEndMsg& msg);
373 
375  virtual void processRestoreInitiate(const DtRestoreInitiateMsg& msg);
376 
378  virtual void processRestore(const DtRestoreMsg& msg);
379 
380 #if defined(DtIFSPEC1516) || defined(DtIFSPEC1516E)
381 
382  virtual void processSaveStatusMsg(const DtSaveStatusMsg& msg);
383 
385  virtual void processRestoreStatusMsg(const DtRestoreStatusMsg& msg);
386 #endif
387 
390  virtual void processNewFomClassesMsg(const DtNewFomClassesMsg& msg);
391 
393  virtual void processResignResponseMsg(const DtResignRespMsg& msg);
394 
396 
398  virtual void testSaveProgress();
399 
401  virtual void applyRidParameters();
402 
407  virtual void processNewFomClasses(const DtNewFomClassesMsg& msg);
408 
409 
412 
413 
415  virtual void sendCreateMsg(MAKRti::DtString const & fedExNameVal,
416  MAKRti::DtString const & timeImplName, const std::vector<unsigned int> & moduleCrcs,
417  MAKRti::DtFomType fedType, MAKRti::DtString const &momModuleName,
418  const std::vector<MAKRti::DtString>& fomModules, unsigned int momModuleCrc);
419 
421  virtual void sendDestroyMsg(const char* name);
422 
424  virtual void sendJoinMsg(
425  unsigned long sourceID, unsigned short requestID, const char* fedType,
426  const char* fedExName, const char* fedName,
427  const std::vector<MAKRti::DtString>& fomModules,
428  const unsigned long flags, const std::vector<unsigned int>& joinModulesCrcs);
429 
431  virtual void sendJoinConfirmMsg(
432  unsigned long sourceID, DtJoinConfirmMsg::errorCodes errorCode);
433 
434 #ifdef DtIFSPEC1516
435 
436  virtual void sendSyncPointMsg(DtSyncMsgType kind, DtFederateHandle& id,
437  char const * name,
438  rti1516::VariableLengthData const* tag = NULL,
439  DtFederateHandleSet const * set = NULL);
440 #ifdef DtTIME
441 
443  virtual void sendSaveRequestTsoMsg(char const * label,
444  rti1516::LogicalTime const * time);
445 #endif
446 #elif defined(DtIFSPEC1516E)
447 
448  virtual void sendSyncPointMsg(DtSyncMsgType kind, DtFederateHandle& id,
449  char const * name,
450  rti1516e::VariableLengthData const* tag = NULL,
451  DtFederateHandleSet const * set = NULL);
452 #ifdef DtTIME
453 
455  virtual void sendSaveRequestTsoMsg(char const * label,
456  rti1516e::LogicalTime const * time);
457 #endif
458 #else
459 
460  virtual void sendSyncPointMsg(DtSyncMsgType kind, DtFederateHandle& id,
461  char const * name,
462  char const * tag = NULL,
463  DtFederateHandleSet const * set = NULL);
464 #ifdef DtTIME
465 
466  virtual void sendSaveRequestTsoMsg(char const * label,
467  RTI::FedTime const * time);
468 #endif
469 #endif
470 
472  virtual void sendSaveRequestMsg(unsigned long requestID, const char *label);
473 
475  virtual void sendSaveBegunMsg();
476 
478  virtual void sendSaveCompleteMsg(const char *label, bool success);
479 
481  virtual void sendRestoreRequestMsg(const char *label);
482 
484  virtual void sendRestoreBegunMsg(const char *label, DtResponseFlag response);
485 
487  virtual void sendRestoreCompleteMsg(const char *label, bool success);
489 
492 
493 
496  virtual void initiateSave();
497 
500 #ifdef DtIFSPEC1516
501  virtual void initiateTimedSave(rti1516::LogicalTime const& saveTime);
502 #elif defined(DtIFSPEC1516E)
503  virtual void initiateTimedSave(rti1516e::LogicalTime const& saveTime);
504 #else
505  virtual void initiateTimedSave(RTI::FedTime const& saveTime);
506 #endif
507 
510  virtual bool saveLRC(DtRtiSaveFile& saveFile);
511 
513  virtual bool save(DtRtiSaveFile& file);
514 
517  virtual void prepareToRestoreLRC();
518 
521  virtual bool restoreLRC(DtRtiSaveFile& saveFile);
522 
524  virtual void prepareToRestore();
525 
527  virtual bool restore( DtRtiSaveFile& file );
529 
531  virtual void posttick();
532 
533 public:
534 
537 
538 
540  static void processSyncPointMsg(const DtSyncPointMsg& msg, void* usr);
541 
543  static void processDesignatedFederateMsg(const DtDesignatedFederateMsg& msg, void* usr);
544 
546  static void processFomModuleFileRequestMsg( const DtFomModuleRequestMsg& msg, void* usr);
547 
549  static void processCreateResponseMsg(const DtCreateResponseMsg& msg, void* usr);
550 
551 #ifdef DtIFSPEC1516E
552 
553  static void processReportFederationsMsg(const DtReportFederationsMsg& msg, void* usr);
554 #endif
555 
557  static void processJoinResponseMsg(const DtJoinResponseMsg& msg, void* usr);
558 
560  static void processDestroyResponseMsg(const DtDestroyResponseMsg& msg, void* usr);
561 
562 #if defined(DtIFSPEC1516) || defined(DtIFSPEC1516E)
563 
564  static void processSaveStatusMsg(const DtSaveStatusMsg& msg, void* usr);
565 
567  static void processRestoreStatusMsg(const DtRestoreStatusMsg& msg, void* usr);
568 #endif
569 
572  static void processNewFomClassesMsg(const DtNewFomClassesMsg& msg, void* usr);
573 
575  static void processResignResponseMsg(const DtResignRespMsg& msg, void* usr);
576 
578 
579 
581  static DtFederateMgr* create(DtRIDParameters* params,
582  DtRtiAmbassadorBaseImplementor* ambImplPtr,
583  DtConnectionMgr* connMgr,
584  DtBoost::shared_ptr<DtRtiAssistantLrcClient> assistantClient);
585 
586 protected:
587 
589  std::map<DtString, DtSynchronousFileDistributor*> myDistributors;
590 
593 
596 
599 
602 
604  MAKRti:: DtString myCreateResponseErrorString;
605 
608 
611 
614 
616  MAKRti::DtString myDestroyExecutionName;
617 
620 
622  std::vector<MAKRti::DtString> myFomModuleRequests;
623 
625  unsigned short myJoinRequestID;
626 
628  unsigned long mySaveRequestID;
629 
632 
637  MAKRti::DtHashList mySyncPoints;
638 
640 #if defined(DtIFSPEC1516) || defined(DtIFSPEC1516E)
641  std::wstring* myFailedSyncPointLabel;
642 #else
644 #endif
645 
650 
654 
655 
659 
662  std::map<MAKRti::DtString, DtFileInformation*> myTakenFiles;
663 
665  std::list<DtNewFomClassesMsg*> myNewFomClassMsgs;
666 
667  DtFedReader13 * myFedReader13;
668  DtFedReader1516 * myFedReader1516;
669  DtFedReader1516e * myFedReader1516e;
670  DtFedReader * getReader( DtFomType theFomType );
671 
672  MAKRti::DtFilename myStandardMimPath;
673 
674  void populateWithUnknownFoms(std::vector<DtString> & mods, std::vector<DtString> & requestedMods);
675  bool isFomAvailable(const DtString & fomName);
676  void getCrcsOfFoms( std::vector<unsigned int> & moduleCrcs, const std::vector<MAKRti::DtString> & creationFomModuleNames );
678  MAKRti::DtFilename & getStandardMimPath();
679 };
680 
681 #endif
682 
683 
684 

Document ID: Generated on Fri Mar 14 19:08:55 EDT 2014 from SVN revision 137085
Copyright © 2005-2014 VT MÄK Inc. All Rights Reserved (www.mak.com)