MAK RTIspy API Documentation for HLA 1516
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
federationShadow.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2022 MaK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
10 
11 #include <rtiMsConfig.h>
12 
14 #include <internalTypes.h>
15 
16 #include <vlutil/vlPrint.h>
17 #include <vlutil/vlSmartPointers.h>
18 #include <vlutil/vlTime.h>
19 #include <vlutil/vlFedTarget.h>
20 
24 class DtJoinMsg;
25 class DtJoinResponseMsg;
26 class DtJoinConfirmMsg;
27 class DtResignMsg;
29 class DtRegObjMsg;
30 class DtMultiRegObjMsg;
31 class DtAssocPubRegMsg;
32 class DtDeleteRoMsg;
33 class DtDeleteTsoMsg;
34 class DtOwnershipMsg;
35 
36 class DtFederationShadow;
37 class DtFederateShadow;
39 class DtConnectionMgr;
40 class DtFomModuleManager;
41 class DtRIDParameters;
42 
44 typedef DtFederationShadow* (*DtFederationShadowCreator)(DtHandle federationHandle, const MAKRti::DtString& federationName,
45  DtRIDParameters* p, std::shared_ptr<DtFilePrinter> logPrinter);
46 
47 
53 {
54 protected:
55 
57  DtFederationShadow(DtHandle federationHandle, const MAKRti::DtString& federationName, DtRIDParameters* p,
58  std::shared_ptr<DtFilePrinter> logPrinter);
59 
60 public:
61 
63  virtual ~DtFederationShadow();
64 
66  virtual DtHandle federationHandle() const;
67 
69  virtual const MAKRti::DtString& name() const;
70 
72  DtConnectionMgr* connectMgr();
73 
75  virtual DtFomModuleManager* fomManager();
76 
78  const DtRIDParameters& params() const;
79 
81  virtual void checkVersion(const MAKRti::DtString& version) const;
82 
84  virtual void processUpdateNotifyLevel(DtNotifyLevelType level);
85 
87  virtual void exit();
88 
93  int processQuit();
94 
96  virtual DtResignAction resignAction() const;
97 
99  virtual void run();
100 
101 public:
102 
104  static DtFederationShadow* create(DtHandle federationHandle, const MAKRti::DtString& federationName, DtRIDParameters* p,
105  std::shared_ptr<DtFilePrinter> logPrinter);
106 
109  static void setCreatorFunction(DtFederationShadowCreator fn);
110 
111  static bool shutdownSignalCaught();
112  static void caughtShutdownSignal();
113 
115  static const MAKRti::DtString& shutDownStatement();
116 
118  static const MAKRti::DtString& readyStatement();
119 
120 protected:
121 
123  virtual DtFederateShadow* federateShadow(DtHandle federateHandle);
124 
127  virtual void cleanupConstructorException();
128 
130  virtual void wait(DtTime intervalInSeconds);
131 
136  virtual bool tick(bool noCallbacks = false);
137 
139  virtual void processJoinFoms(const DtJoinResponseMsg& msg);
140 
142  virtual void sendFederationShadowHandshakeMsg(DtHandle destinationId,
144 
146  virtual void federationShadowToForwarderHandshake();
147 
149 
150  static void processFederationShadowHandshakeMsg(const DtFederationShadowHandshakeMsg& msg, void* usr);
151  virtual void processFederationShadowHandshakeMsg(const DtFederationShadowHandshakeMsg& msg);
152 
153  virtual void processFederationShadowShutdownMsg(const DtFederationShadowShutdownMsg& msg);
154  static void processFederationShadowShutdownMsg(const DtFederationShadowShutdownMsg& msg, void* usr);
155 
156  virtual void processCreateResponseMsg(const DtCreateResponseMsg& msg);
157  static void processCreateResponseMsg(const DtCreateResponseMsg& msg, void* usr);
158 
159  virtual void processJoinMsg(const DtJoinMsg& msg);
160  static void processJoinMsg(const DtJoinMsg& msg, void* usr);
161 
162  virtual void processJoinResponseMsg(const DtJoinResponseMsg& msg);
163  static void processJoinResponseMsg(const DtJoinResponseMsg& msg, void* usr);
164 
165  virtual void processJoinConfirm(const DtJoinConfirmMsg& msg);
166  static void processJoinConfirm(const DtJoinConfirmMsg& msg, void* usr);
167 
168  virtual void processResign(const DtResignMsg& msg);
169  static void processResign(const DtResignMsg& msg, void* usr);
170 
171  virtual void processResignDirective(const DtResignDirectiveMsg& msg);
172  static void processResignDirective(const DtResignDirectiveMsg& msg, void* usr);
173 
174  virtual void processRegister(const DtRegObjMsg& msg);
175  static void processRegister(const DtRegObjMsg& msg, void* usr);
176 
177  virtual void processMultiRegister(const DtMultiRegObjMsg& msg);
178  static void processMultiRegister(const DtMultiRegObjMsg& msg, void* usr);
179 
180  virtual void processAssocPubReg(const DtAssocPubRegMsg& msg);
181  static void processAssocPubReg(const DtAssocPubRegMsg& msg, void* usr);
182 
183  virtual void processDeleteRo(const DtDeleteRoMsg& msg);
184  static void processDeleteRo(const DtDeleteRoMsg& msg, void* usr);
185 
186  virtual void processDeleteTso(const DtDeleteTsoMsg& msg);
187  static void processDeleteTso(const DtDeleteTsoMsg& msg, void* usr);
188 
189  virtual void processOwnership(const DtOwnershipMsg& msg);
190  static void processOwnership(const DtOwnershipMsg& msg, void* usr);
192 
194  inline DtFederateShadow* federate(DtFederateHandle federateHandle);
195 
196 protected:
197 
198  typedef std::map<DtHandle, DtFederateShadow*> FederateShadowByHandleMap;
200 
202  std::shared_ptr<DtFilePrinter> myLogPrinter;
203 
205 
208 
210  DtResignAction myResignAction;
211 
214 
215  DtClock myClock;
217  MAKRti::DtString myFederationName;
219 
223 
227 
228 protected:
229 
232  static const MAKRti::DtString theShutDownStatement;
233  static const MAKRti::DtString theReadyStatement;
234 
235 };
236 
238 {
239  return myConnectionMgr;
240 }
241 
243 {
244  return *myParams;
245 }
246 
248 {
249  FederateShadowByHandleMap::iterator findFed = myFederatesByHandle.find(federateHandle);
250  return findFed != myFederatesByHandle.end() ? findFed->second : nullptr;
251 }
DtConnectionMgr * connectMgr()
Return the connection manager.
Definition: federationShadow.h:237
DtFederationShadow *(* DtFederationShadowCreator)(DtHandle federationHandle, const MAKRti::DtString &federationName, DtRIDParameters *p, std::shared_ptr< DtFilePrinter > logPrinter)
DtFederationShadow creator callback signature.
Definition: federationShadow.h:44
Definition: federationShadowShutdownMsg.h:17
FederateShadowByHandleMap myFederatesByConnection
List of federates.
Definition: federationShadow.h:221
Instances of DtFederationShadow implement a central server responsible for keeping track of the owner...
Definition: federationShadow.h:52
Definition: joinRespMsg.h:28
Definition: joinConfMsg.h:24
This class manages the RTI&#39;s start-up configuration using both MTL variables and functions.
Definition: RIDparams.h:87
DtClock myClock
Definition: federationShadow.h:215
Definition: federateShadow.h:50
#define DT_DLL_FEDSHDW
Definition: rtiMsConfig.h:159
Definition: joinMsg.h:27
Definition: ownerMsg.h:45
static const MAKRti::DtString theReadyStatement
Definition: federationShadow.h:233
Definition: resignMsg.h:36
DtFederateShadow * federate(DtFederateHandle federateHandle)
Return the federate with the given handle; null if does not exist.
Definition: federationShadow.h:247
Definition: resignDirectiveMsg.h:24
static DtFederationShadowCreator theCreator
Definition: federationShadow.h:230
DtResignAction myResignAction
Automatic resign action for federates that crash or forced to resign.
Definition: federationShadow.h:210
DtFederationShadowHandshakeMsg::HandshakeStatus myHandshakeStatus
Definition: federationShadow.h:218
Definition: creRespMsg.h:36
bool myExitCommanded
Flag indicating that an exit command was received.
Definition: federationShadow.h:225
DtHandle myFederationHandle
Definition: federationShadow.h:216
Instances of DtConnectionMgr manage the communication objects that the RTI will use to either communi...
Definition: connectMgr.h:67
DtFomModuleManager * myFomManager
The FOM Module Manager.
Definition: federationShadow.h:207
DtHandle DtFederateHandle
Definition: internalTypes.h:46
DtConnectionMgr * myConnectionMgr
Definition: federationShadow.h:204
std::map< DtHandle, DtFederateShadow * > FederateShadowByHandleMap
Definition: federationShadow.h:198
Distributes fomModule files from initiating federate to RtiExec and then from RtiExec to all joining ...
Definition: synchronousFileDistributor.h:27
Definition: regObjMsg.h:25
unsigned long DtHandle
The internal types.
Definition: internalTypes.h:41
static const MAKRti::DtString theShutDownStatement
Definition: federationShadow.h:232
DtSynchronousFileDistributor * myFomDistributor
The Fed File Distributor of the joined federation execution.
Definition: federationShadow.h:213
bool myPendingQuit
Definition: federationShadow.h:226
MAKRti::DtString myFederationName
Definition: federationShadow.h:217
Definition: federationShadowHandshakeMsg.h:18
Definition: multiRegObjMsg.h:21
const DtRIDParameters & params() const
Return the RID parameters.
Definition: federationShadow.h:242
The declaration of internal types.
std::shared_ptr< DtFilePrinter > myLogPrinter
Printer which prints output to a log file.
Definition: federationShadow.h:202
static bool theShutdownSignalCaught
Definition: federationShadow.h:231
DtRIDParameters * myParams
Definition: federationShadow.h:199
Definition: fomModuleManager.h:39
Message for sending receive order delete.
Definition: deleteRoMsg.h:23
void RTI_EXPORT checkVersion(const MAKRti::DtString &version)
Called by the exec application to make sure that the RTI Version matches.
HandshakeStatus
Definition: federationShadowHandshakeMsg.h:21
FederateShadowByHandleMap myFederatesByHandle
Definition: federationShadow.h:222

Document ID: Generated on Sun Jul 20 16:15:30 EDT 2025 from SVN revision 277985
Copyright © 2005-2025 MAK Technologies Inc. All Rights Reserved (www.mak.com)