MAK RTIspy API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
exec.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 1998 MaK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: exec.h,v $ $Revision: 1.27 $ $State: Exp $
7 *******************************************************************************/
8 
11 
12 #ifndef VXWORKS
13 
14 #ifndef DtRtiExec_H_
15 #define DtRtiExec_H_
16 
17 #include "rtiMsConfig.h"
18 #include <map>
19 #include <string>
20 #include <list>
21 #include <vlThreadedObject.h>
22 #include <vlutil/vlTime.h>
23 #include <vlutil/vlList.h>
24 #include <vlutil/vlUtil.h>
25 #include <vlutil/vlPrint.h>
26 #include <vlutil/vlInetAddr.h>
27 
28 #include <creRespMsg.h>
29 #include <desRespMsg.h>
30 #include <joinRespMsg.h>
31 #include <execHandshakeMsg.h>
33 #include <rtiUtil.h>
35 
36 
40 class DtCreateMsg;
41 class DtDestroyMsg;
44 class DtJoinMsg;
45 class DtDisconnectMsg;
46 class DtReconnectMsg;
48 class DtFedExec;
49 class DtRIDParameters;
52 
54 typedef std::shared_ptr<DtExtendedRtiMsgForwarder> DtRtiMsgForwarderSP;
55 
56 
59 
60 namespace RTI_API
61 {
62  class Authorizer;
63 }
64 
65 class DtRtiExec;
66 
68 typedef DtRtiExec* (*DtRtiExecCreator)(DtRIDParameters* p,
69  std::shared_ptr<DtFilePrinter> logPrinter,
70  bool autoExit, const DtRtiConnectionInfoDataPair& connInfo );
71 
73 typedef void (*DtFedExCbFn)(DtFedExec* exec, void* usr);
74 
76 typedef void (*DtTickCbFn)(void* usr);
77 typedef void (*DtTickWithExecCbFn)(const DtRtiExec& exec, void* usr);
78 
80 typedef void (*DtLogFileNameCbFn)(const DtFilename& file, void* usr);
81 
84 {
85 public:
86  DtFedExCallbackInfo(DtFedExCbFn fn, void* data) :
87  myData(data), myFn(fn) {}
88 
89  void* myData;
91 };
92 
95 {
96 public:
97  DtTickCallbackInfo(DtTickCbFn fn, void* data, DtTime interval) :
98  myData(data), myFn(fn), myInterval(interval), myNextExecutionTime(0) {}
99 
100  bool operator<(const DtTickCallbackInfo& other) const
101  {
102  return ( myData < other.myData ||
103  myData == other.myData && myFn < other.myFn );
104  }
105 
106  void* myData;
108  DtTime myInterval;
110 };
111 
114 {
115 public:
116  DtTickWithExecCallbackInfo(DtTickWithExecCbFn fn, void* data, DtTime interval) :
117  myData(data), myFn(fn), myInterval(interval), myNextExecutionTime(0) {}
118 
119  bool operator<(const DtTickWithExecCallbackInfo& other) const
120  {
121  return ( myData < other.myData ||
122  myData == other.myData && myFn < other.myFn );
123  }
124 
125  void* myData;
127  DtTime myInterval;
129 };
130 
133 {
134 public:
136  myData(data), myFn(fn) {}
137 
138  bool operator<(const DtLogFileNameCallbackInfo& other) const
139  {
140  return ( myData < other.myData ||
141  myData == other.myData && myFn < other.myFn );
142  }
143 
144  void* myData;
146 };
147 
149 {
150 protected:
151 
154  std::shared_ptr<DtFilePrinter> logPrinter,
155  bool autoExit,
156  const DtRtiConnectionInfoDataPair& connInfo );
157 
158 public:
159 
161  virtual ~DtRtiExec();
162 
163  virtual void shutdownForwarderIfCreated();
164 
165  virtual void shutdownFederationShadow(DtHandle handle, const DtString& name);
166 
168  virtual void checkVersion(const DtString& version) const;
169 
171 
172  virtual void processCreate(const DtCreateMsg& msg);
173  virtual void processDestroy(const DtDestroyMsg& msg);
174  virtual void processListFederations(const DtListFederationsMsg& msg);
175  virtual void processListFederationMembers(const DtListFederationMembersMsg& msg);
176  virtual void processJoin(const DtJoinMsg& msg);
178  virtual void processDisconnect(const DtDisconnectMsg& msg);
179  virtual void processQueueFull( const DtQueueFullMsg& msg );
181  virtual void processReconnect(const DtReconnectMsg& msg);
183 
187  virtual DtFedExec* createFedEx(
188  DtConnectionMgr* connMgr, const std::vector<unsigned int> & crcs, const char* fedExName,
189  std::string const & timeImplName, MAKRti::DtFomType fedType,
190  const std::vector<DtString>& fedFileName, const DtString& momModuleName,
191  int fedExHandle, DtRIDParameters* params, unsigned int momModuleCrc);
192 
195  DtConnectionMgr* connectMgr();
196 
198  virtual bool exists(const DtString& fedExName);
199 
200 
205  virtual void destroyFederationByName( const DtString& fullFedexName,
206  bool sendDestroyResponse = true,
207  bool forceDestroy = false );
208 
209 
214  int processQuit();
215 
217  virtual void listFederates();
218 
220  virtual void parseDeleteCommand( const DtString& command,
221  unsigned int& handle,
222  DtString& federationName ) const;
223 
224  virtual int deleteFederate( unsigned int handle,
225  const DtString& federationName );
226 
228  virtual void processUpdateNotifyLevel( DtNotifyLevelType level );
229 
231  virtual void exit();
232 
234  virtual void enableLogging();
235 
237  virtual RTI_API::Authorizer* authorizer();
238 
241  DtFedExec* fedExec(const DtString& fedExName);
242  const DtFedExec* fedExec(const DtString& fedExName) const;
243 
245  const std::map<DtString, DtFedExec*>& fedExecs() const;
246 
248  const DtRIDParameters& params() const;
249 
251  virtual void run();
252 
257  virtual bool tick( bool noCallbacks = false );
258 
260  virtual void wait(DtTime intervalInSeconds);
261 
263 
264  virtual void addFedExCreatedCallback(DtFedExCbFn fn, void* usr);
265  virtual void removeFedExCreatedCallback(DtFedExCbFn fn, void* usr);
266 
267  virtual void addFedExDestroyedCallback(DtFedExCbFn fn, void* usr);
268  virtual void removeFedExDestroyedCallback(DtFedExCbFn fn, void* usr);
269 
270  virtual void addLogFileNameUpdatedCallback(DtLogFileNameCbFn fn, void* usr);
271  virtual void removeLogFileNameUpdatedCallback(DtLogFileNameCbFn fn, void* usr);
272 
274  virtual void addTickCallback(DtTickCbFn fn, void* usr, DtTime interval );
275  virtual void removeTickCallback(DtTickCbFn fn, void* usr );
276 
279  virtual void addTickCallback(DtTickWithExecCbFn fn, void* usr, DtTime interval );
280  virtual void removeTickCallback(DtTickWithExecCbFn fn, void* usr );
282 
284 
285  virtual void sendCreateResponseMsg(const unsigned long destinationID, DtCreateResponseFlag flag,
286  MAKRti::DtString const & errorString);
287  virtual void sendDestroyResponseMsg(const char* fedExName, DtDestroyResponseFlag flag);
288  virtual void sendReportFederationsMsg(unsigned long destId,
289  const std::vector<DtString>& federationNames, const std::vector<DtString>& timeImplNames);
290  virtual void sendReportFederationMembersMsg(unsigned long destId, DtString federationName,
292  virtual void sendJoinResponseMsg(
293  unsigned long destinationIDValue,unsigned short requestID, unsigned int crc,
294  DtFederateHandle handle, const char* fedName, int fedExHandle, const char* fedExName,
295  const DtString& momModule, const std::vector<DtString>& fedFileName,
296  unsigned long flags, bool allowNetworkTesting,
297  MAKRti::DtString const & errorString,
300 
305  virtual void ridRequestCb( const DtRidTestRequestMsg& msg);
306 
307 public:
308 
310  static DtRtiExec* create(DtRIDParameters* p,
311  std::shared_ptr<DtFilePrinter> logPrinter,
312  bool autoExit = false,
314 
318  static void setCreatorFunction(DtRtiExecCreator fn);
319 
321 
322  static void processRtiExecHandshakeMsg(const DtRtiExecHandshakeMsg& msg, void* usr);
323  static void processCreate(const DtCreateMsg& msg, void *usr);
324  static void processDestroy(const DtDestroyMsg& msg, void* usr);
325  static void processListFederations(const DtListFederationsMsg& msg, void* usr);
326  static void processListFederationMembers(const DtListFederationMembersMsg& msg, void* usr);
327  static void processJoin(const DtJoinMsg& msg, void* usr);
328  static void processDisconnect(const DtDisconnectMsg& msg, void* usr);
329  static void processQueueFull( const DtQueueFullMsg& msg, void* usr);
330  static void processReconnect(const DtReconnectMsg& msg, void* usr);
331  static void ridRequestCb( const DtRidTestRequestMsg& msg, void* usr );
333 
334  static bool shutdownSignalCaught();
335  static void caughtShutdownSignal();
336 
337 protected:
338 
341  void cleanupConstructorException();
342 
345  virtual void rtiExecToForwarderHandshake();
346 
348  virtual void sendRtiExecHandshakeMsg( DtHandle destId, DtRtiExecHandshakeMsg::DtHandshakeStatus status );
349 
351  virtual void processRtiExecHandshakeMsg( const DtRtiExecHandshakeMsg& msg );
352 
354  virtual void performMulticastDiscovery( bool reliableTransportDisabled );
355 
357  virtual void removeDroppedFederateConnections();
358 
360  {
363  ForwarderStartupFailed
364  };
367  virtual DtStartRtiForwarderResult startRtiForwarder(const DtRIDParameters* params);
368 
370  virtual bool startFederationShadow(DtHandle federationHandle, const DtString& federationName);
371 
373  virtual bool authorizeFederationOperation(const DtCreateMsg& msg, DtString& errorMessage);
374 
375 protected:
376 
377  typedef std::map< unsigned long, DtTime > DtConnIdToTimeMap;
379 
381  std::map<DtString, DtFedExec*> myExecByName;
382  std::map<DtFederationHandle, DtFedExec*> myExecByHandle;
383  DtString lineOfInput;
384 
388  unsigned int myHandleForDelete;
389 
396 
398  std::list<DtTickCallbackInfo> myTickCallbacks;
399 
401  std::list<DtTickWithExecCallbackInfo> myTickWithExecCallbacks;
402 
404  std::list<DtLogFileNameCallbackInfo> myLogFileNameCallbacks;
405 
406  DtClock myClock;
409 
412 
414 
419 
422 
425 
427  std::shared_ptr<DtFilePrinter> myLogPrinter;
428 
430 
431  DtString myHostname;
432 
433  DtUniquePtr<RTI_API::Authorizer> myAuthorizer;
434 
435 
436 protected:
437 
439 };
440 
442 {
443  return myConnectionMgr;
444 }
445 
446 inline const DtRIDParameters& DtRtiExec::params() const
447 {
448  return *myParams;
449 }
450 
451 #endif
452 
453 #endif
454 
DtTickCallbackInfo(DtTickCbFn fn, void *data, DtTime interval)
Definition: exec.h:97
DtConnectionMgr * myConnectionMgr
Definition: exec.h:380
bool myPendingDelete
Definition: exec.h:391
virtual Boolean tick(TickTime minimum, TickTime maximum)
DtRtiExecHandshakeMsg::DtHandshakeStatus myHandshakeStatus
Definition: exec.h:407
static bool theShutdownSignalCaught
Definition: exec.h:378
Definition: extendedRtiMsgForwarder.h:30
std::map< DtString, DtFedExec * > myExecByName
Definition: exec.h:381
Sent by Federates to request testing of the RID file from RtiExec.
Definition: ridTestRequestMsg.h:29
std::shared_ptr< DtExtendedRtiMsgForwarder > DtRtiMsgForwarderSP
Smart pointer to forwarder needed for vlThreads.
Definition: exec.h:51
DtTickWithExecCbFn myFn
Definition: exec.h:126
Definition: createMsg.h:24
DtDestroyResponseFlag
Definition: desRespMsg.h:23
Definition: exec.h:362
Info for tick callbacks.
Definition: exec.h:94
This class manages the RTI&#39;s start-up configuration using both MTL variables and functions.
Definition: RIDparams.h:87
std::shared_ptr< DtFilePrinter > myLogPrinter
Printer which prints output to a log file.
Definition: exec.h:427
Definition: fedTimeFactory.h:73
bool operator<(const DtLogFileNameCallbackInfo &other) const
Definition: exec.h:138
This file contains the declaration of DtRtiConnectionInfo.
Info for log file name callbacks.
Definition: exec.h:132
std::pair< DtRtiConnectionInfo, DtRtiAssociatedConnectionData > DtRtiConnectionInfoDataPair
Pair of connection with associated data.
Definition: assistantConnectionInfo.h:29
Definition: fedex.h:117
Definition: joinMsg.h:27
std::list< DtTickCallbackInfo > myTickCallbacks
List of tick callbacks.
Definition: exec.h:398
DtFedExCbFn myFn
Definition: exec.h:90
std::map< unsigned long, DtTime > DtConnIdToTimeMap
Definition: exec.h:377
void * myData
Definition: exec.h:106
DtTime myInterval
Definition: exec.h:127
void(* DtFedExCbFn)(DtFedExec *exec, void *usr)
Create/Destroy federation callback function signature.
Definition: exec.h:73
bool myExitCommanded
Flag indicating that an exit command was received.
Definition: exec.h:424
void(* DtTickWithExecCbFn)(const DtRtiExec &exec, void *usr)
Definition: exec.h:77
Definition: queueFullMsg.h:21
DtTime myNextExecutionTime
Definition: exec.h:128
bool myAutoExit
Definition: exec.h:421
DtLogFileNameCbFn myFn
Definition: exec.h:145
bool operator<(const DtTickCallbackInfo &other) const
Definition: exec.h:100
DtForwarderFaultManager * myFaultManager
Definition: exec.h:411
Definition: listFederationMembersMsg.h:20
errorCodes
error codes for the errorValue flag
Definition: joinRespMsg.h:32
bool operator<(const DtTickWithExecCallbackInfo &other) const
Definition: exec.h:119
DtTime myNextExecutionTime
Definition: exec.h:109
std::list< DtLogFileNameCallbackInfo > myLogFileNameCallbacks
List of log file name update callbacks.
Definition: exec.h:404
void(* DtTickCbFn)(void *usr)
Tick callback function signatures.
Definition: exec.h:76
std::list< DtTickWithExecCallbackInfo > myTickWithExecCallbacks
List of tick callbacks with DtRtiExec reference.
Definition: exec.h:401
DtUniquePtr< RTI_API::Authorizer > myAuthorizer
Definition: exec.h:433
Definition: listFederationsMsg.h:22
DtString myFederationNameForDelete
Definition: exec.h:387
Instances of DtConnectionMgr manage the communication objects that the RTI will use to either communi...
Definition: connectMgr.h:67
Definition: destroyMsg.h:30
bool myFedNameForDeleteComplete
Definition: exec.h:386
DtHandle DtFederateHandle
Definition: internalTypes.h:46
DtList myCreateCallbacks
Definition: exec.h:394
bool myCreatedRtiForwarder
Definition: exec.h:390
DtHandshakeStatus
Definition: execHandshakeMsg.h:26
DtConnIdToTimeMap myDisconnectedFederates
Map of dropped Federate to timestamp of drop.
Definition: exec.h:418
void * myData
Definition: exec.h:144
DtMulitcastDiscoveryMgr * myMcastDiscoveryMgr
Definition: exec.h:413
unsigned int myHandleForDelete
Definition: exec.h:388
DtRIDParameters * myParams
Definition: exec.h:420
DtCreateResponseFlag
Definition: creRespMsg.h:23
The DtMulitcastDiscoveryMgr can act as either a Requester or a Responder.
Definition: multicastDiscoveryMgr.h:33
int myFreeFedExHandle
Definition: exec.h:393
Info for tick callbacks with DtRtiExec reference.
Definition: exec.h:113
DtStartRtiForwarderResult
Definition: exec.h:359
DtRtiExec *(* DtRtiExecCreator)(DtRIDParameters *p, std::shared_ptr< DtFilePrinter > logPrinter, bool autoExit, const DtRtiConnectionInfoDataPair &connInfo)
DtRtiExec creator callback signature.
Definition: exec.h:68
bool myPendingQuit
Definition: exec.h:392
DtList myDestroyCallbacks
Definition: exec.h:395
Definition: exec.h:148
void(* DtLogFileNameCbFn)(const DtFilename &file, void *usr)
Log file name update callback function signature.
Definition: exec.h:80
DtTime myNextHeartbeat
Definition: exec.h:408
DtConnectionMgr * connectMgr()
Returns the connection manager Not virtual because referenced in both ctors and dtors.
Definition: exec.h:441
Definition: disconnectMsg.h:21
The DtForwarderFaultManager class tracks federates and forwarders within the RTI&#39;s forwarding network...
Definition: forwarderFaultManager.h:30
Info for fed ex callbacks.
Definition: exec.h:83
DtTime myInterval
Definition: exec.h:108
Definition: reconnectMsg.h:22
DtTickCbFn myFn
Definition: exec.h:107
DtTickWithExecCallbackInfo(DtTickWithExecCbFn fn, void *data, DtTime interval)
Definition: exec.h:116
unsigned long DtHandle
The internal types.
Definition: internalTypes.h:41
DtFedExCallbackInfo(DtFedExCbFn fn, void *data)
Definition: exec.h:86
void * myData
Definition: exec.h:89
DtLogFileNameCallbackInfo(DtLogFileNameCbFn fn, void *data)
Definition: exec.h:135
DtRtiConnectionInfoDataPair myConnInfo
Definition: exec.h:429
static DtRtiExecCreator theCreator
Definition: exec.h:438
Definition: joinRespMsg.h:33
std::map< DtFederationHandle, DtFedExec * > myExecByHandle
Definition: exec.h:382
DtRtiMsgForwarderSP myRtiForwarder
Definition: exec.h:410
Definition: execHandshakeMsg.h:23
Defines a ThreadedObject which can run a DtRunnable object in a thread.
void * myData
Definition: exec.h:125
DtString lineOfInput
Definition: exec.h:383
std::vector< DtFederateNameTypePair > DtFederateList
Definition: reportFederationMembersMsg.h:24
DtClock myClock
Definition: exec.h:406
#define DT_DLL_EXEC
Definition: rtiMsConfig.h:152
bool myHandleForDeleteComplete
Definition: exec.h:385
DtString myHostname
Definition: exec.h:431
const DtRIDParameters & params() const
Returns a handle to the current RID Params.
Definition: exec.h:446

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)