MAK RTIspy API Documentation for HLA 4
 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 
21 #include <queue>
22 
26 class DtJoinMsg;
27 class DtJoinResponseMsg;
28 class DtJoinConfirmMsg;
29 class DtResignMsg;
31 class DtRegObjMsg;
32 class DtMultiRegObjMsg;
33 class DtAssocPubRegMsg;
34 class DtDeleteRoMsg;
35 class DtDeleteTsoMsg;
36 class DtOwnershipMsg;
37 
38 class DtFederationShadow;
39 class DtFederateShadow;
41 class DtConnectionMgr;
42 class DtFomModuleManager;
43 class DtRIDParameters;
44 
46 typedef DtFederationShadow* (*DtFederationShadowCreator)(DtHandle federationHandle, const MAKRti::DtString& federationName,
47  DtRIDParameters* p, std::shared_ptr<DtFilePrinter> logPrinter);
48 
49 
55 {
56 protected:
57 
59  DtFederationShadow(DtHandle federationHandle, const MAKRti::DtString& federationName, DtRIDParameters* p,
60  std::shared_ptr<DtFilePrinter> logPrinter);
61 
62 public:
63 
65  virtual ~DtFederationShadow();
66 
68  virtual DtHandle federationHandle() const;
69 
71  virtual const MAKRti::DtString& name() const;
72 
74  DtConnectionMgr* connectMgr();
75 
77  virtual DtFomModuleManager* fomManager();
78 
80  const DtRIDParameters& params() const;
81 
83  virtual void checkVersion(const MAKRti::DtString& version) const;
84 
86  virtual void processUpdateNotifyLevel(DtNotifyLevelType level);
87 
89  virtual void exit();
90 
95  int processQuit();
96 
98  virtual DtResignAction resignAction() const;
99 
101  virtual void run();
102 
103 public:
104 
106  static DtFederationShadow* create(DtHandle federationHandle, const MAKRti::DtString& federationName, DtRIDParameters* p,
107  std::shared_ptr<DtFilePrinter> logPrinter);
108 
111  static void setCreatorFunction(DtFederationShadowCreator fn);
112 
113  static bool shutdownSignalCaught();
114  static void caughtShutdownSignal();
115 
117  static const MAKRti::DtString& shutDownStatement();
118 
120  static const MAKRti::DtString& readyStatement();
121 
122 protected:
123 
125  virtual DtFederateShadow* federateShadow(DtHandle federateHandle);
126 
129  virtual void cleanupConstructorException();
130 
132  virtual void wait(DtTime intervalInSeconds);
133 
138  virtual bool tick(bool noCallbacks = false);
139 
141  virtual bool processJoinFoms(const DtJoinResponseMsg& msg);
142 
144  virtual void sendFederationShadowHandshakeMsg(DtHandle destinationId,
146 
148  virtual void federationShadowToForwarderHandshake();
149 
151 
152  virtual bool queueMessage(const DtRtiMsg& msg);
153  virtual DtRtiMsg* popMessageQueue();
154  virtual void processQueuedMessages(DtRtiMsg* nextMessage);
156 
158 
159  static void processFederationShadowHandshakeMsg(const DtFederationShadowHandshakeMsg& msg, void* usr);
160  virtual void processFederationShadowHandshakeMsg(const DtFederationShadowHandshakeMsg& msg);
161 
162  virtual void processFederationShadowShutdownMsg(const DtFederationShadowShutdownMsg& msg);
163  static void processFederationShadowShutdownMsg(const DtFederationShadowShutdownMsg& msg, void* usr);
164 
165  virtual void processCreateResponseMsg(const DtCreateResponseMsg& msg);
166  static void processCreateResponseMsg(const DtCreateResponseMsg& msg, void* usr);
167 
168  virtual void processJoinMsg(const DtJoinMsg& msg);
169  static void processJoinMsg(const DtJoinMsg& msg, void* usr);
170 
171  virtual void processJoinResponseMsg(const DtJoinResponseMsg& msg);
172  virtual void doProcessJoinResponseMsg(const DtJoinResponseMsg& msg);
173  static void processJoinResponseMsg(const DtJoinResponseMsg& msg, void* usr);
174 
175  virtual void processJoinConfirmMsg(const DtJoinConfirmMsg& msg);
176  static void processJoinConfirmMsg(const DtJoinConfirmMsg& msg, void* usr);
177 
178  virtual void processResignMsg(const DtResignMsg& msg);
179  static void processResignMsg(const DtResignMsg& msg, void* usr);
180 
181  virtual void processResignDirectiveMsg(const DtResignDirectiveMsg& msg);
182  static void processResignDirectiveMsg(const DtResignDirectiveMsg& msg, void* usr);
183 
184  virtual void processRegObjMsg(const DtRegObjMsg& msg);
185  static void processRegObjMsg(const DtRegObjMsg& msg, void* usr);
186 
187  virtual void processMultiRegObjMsg(const DtMultiRegObjMsg& msg);
188  static void processMultiRegObjMsg(const DtMultiRegObjMsg& msg, void* usr);
189 
190  virtual void processAssocPubRegMsg(const DtAssocPubRegMsg& msg);
191  static void processAssocPubRegMsg(const DtAssocPubRegMsg& msg, void* usr);
192 
193  virtual void processDeleteRoMsg(const DtDeleteRoMsg& msg);
194  static void processDeleteRoMsg(const DtDeleteRoMsg& msg, void* usr);
195 
196  virtual void processDeleteTsoMsg(const DtDeleteTsoMsg& msg);
197  static void processDeleteTsoMsg(const DtDeleteTsoMsg& msg, void* usr);
198 
199  virtual void processOwnershipMsg(const DtOwnershipMsg& msg);
200  static void processOwnershipMsg(const DtOwnershipMsg& msg, void* usr);
202 
204  inline DtFederateShadow* federate(DtFederateHandle federateHandle);
205 
206 protected:
207 
208  typedef std::map<DtHandle, DtFederateShadow*> FederateShadowByHandleMap;
210 
212  std::shared_ptr<DtFilePrinter> myLogPrinter;
213 
215 
218 
220  DtResignAction myResignAction;
221 
224 
225  DtClock myClock;
226  MAKRti::DtString myFederationName;
230 
234  std::set<DtFederateHandle> myJoinedFederates;
235 
239 
241 
242  std::queue<DtRtiMsg*> myBufferedMessages;
245 
246 protected:
247 
250  static const MAKRti::DtString theShutDownStatement;
251  static const MAKRti::DtString theReadyStatement;
252 
253 };
254 
256 {
257  return myConnectionMgr;
258 }
259 
261 {
262  return *myParams;
263 }
264 
266 {
267  FederateShadowByHandleMap::iterator findFed = myFederatesByHandle.find(federateHandle);
268  return findFed != myFederatesByHandle.end() ? findFed->second : nullptr;
269 }
DtConnectionMgr * connectMgr()
Return the connection manager.
Definition: federationShadow.h:255
DtFederationShadow *(* DtFederationShadowCreator)(DtHandle federationHandle, const MAKRti::DtString &federationName, DtRIDParameters *p, std::shared_ptr< DtFilePrinter > logPrinter)
DtFederationShadow creator callback signature.
Definition: federationShadow.h:46
Definition: federationShadowShutdownMsg.h:17
FederateShadowByHandleMap myFederatesByConnection
List of federates.
Definition: federationShadow.h:232
Instances of DtFederationShadow implement a central server responsible for keeping track of the owner...
Definition: federationShadow.h:54
Definition: joinRespMsg.h:28
DtFederationHandle myFederationHandle
Definition: federationShadow.h:227
Definition: joinConfMsg.h:24
DtHandle DtFederationHandle
Definition: internalTypes.h:44
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:225
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:251
Definition: resignMsg.h:36
DtFederateShadow * federate(DtFederateHandle federateHandle)
Return the federate with the given handle; null if does not exist.
Definition: federationShadow.h:265
Definition: resignDirectiveMsg.h:24
static DtFederationShadowCreator theCreator
Definition: federationShadow.h:248
DtResignAction myResignAction
Automatic resign action for federates that crash or forced to resign.
Definition: federationShadow.h:220
DtFederationShadowHandshakeMsg::HandshakeStatus myHandshakeStatus
Definition: federationShadow.h:229
std::set< DtFederateHandle > myJoinedFederates
Definition: federationShadow.h:234
Definition: creRespMsg.h:36
bool myExitCommanded
Flag indicating that an exit command was received.
Definition: federationShadow.h:237
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:217
DtRtiMsg is the base class for messages between RTI components.
Definition: rtiMsg.h:34
DtHandle DtFederateHandle
Definition: internalTypes.h:46
DtConnectionMgr * myConnectionMgr
Definition: federationShadow.h:214
std::map< DtHandle, DtFederateShadow * > FederateShadowByHandleMap
Definition: federationShadow.h:208
Distributes fomModule files from initiating federate to RtiExec and then from RtiExec to all joining ...
Definition: synchronousFileDistributor.h:27
DtFederateHandle myFederateHandle
Definition: federationShadow.h:228
bool myProcessingJoinResponse
Manage concurrent processing of joining federates.
Definition: federationShadow.h:243
Definition: regObjMsg.h:25
unsigned long DtHandle
The internal types.
Definition: internalTypes.h:41
static const MAKRti::DtString theShutDownStatement
Definition: federationShadow.h:250
DtSynchronousFileDistributor * myFomDistributor
The Fed File Distributor of the joined federation execution.
Definition: federationShadow.h:223
bool myPendingQuit
Definition: federationShadow.h:238
std::queue< DtRtiMsg * > myBufferedMessages
Manage concurrent processing of joining federates.
Definition: federationShadow.h:242
MAKRti::DtString myFederationName
Definition: federationShadow.h:226
Definition: federationShadowHandshakeMsg.h:18
Definition: multiRegObjMsg.h:21
const DtRIDParameters & params() const
Return the RID parameters.
Definition: federationShadow.h:260
The declaration of internal types.
std::shared_ptr< DtFilePrinter > myLogPrinter
Printer which prints output to a log file.
Definition: federationShadow.h:212
static bool theShutdownSignalCaught
Definition: federationShadow.h:249
DtRIDParameters * myParams
Definition: federationShadow.h:209
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:233

Document ID: Generated on Wed Jul 8 16:20:32 EDT 2026 from SVN revision 291616
Copyright © 2005-2025 MAK Technologies Inc. All Rights Reserved (www.mak.com)