MAK RTIspy API Documentation for HLA Evolved
 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>
32 #include <rtiUtil.h>
34 
35 
39 class DtCreateMsg;
40 class DtDestroyMsg;
42 class DtJoinMsg;
43 class DtDisconnectMsg;
44 class DtReconnectMsg;
46 class DtFedExec;
47 class DtRIDParameters;
50 
52 typedef DtBoost::shared_ptr<DtExtendedRtiMsgForwarder> DtRtiMsgForwarderSP;
53 
54 
57 
58 class DtRtiExec;
59 
61 typedef DtRtiExec* (*DtRtiExecCreator)(DtRIDParameters* p,
62  DtBoost::shared_ptr<DtFilePrinter> logPrinter,
63  bool autoExit, const DtRtiConnectionInfoDataPair& connInfo );
64 
66 typedef void (*DtFedExCbFn)(DtFedExec* exec, void* usr);
67 
69 typedef void (*DtTickCbFn)(void* usr);
70 typedef void (*DtTickWithExecCbFn)(const DtRtiExec& exec, void* usr);
71 
73 typedef void (*DtLogFileNameCbFn)(const DtFilename& file, void* usr);
74 
77 {
78 public:
79  DtFedExCallbackInfo(DtFedExCbFn fn, void* data) :
80  myData(data), myFn(fn) {}
81 
82  void* myData;
84 };
85 
88 {
89 public:
90  DtTickCallbackInfo(DtTickCbFn fn, void* data, DtTime interval) :
91  myData(data), myFn(fn), myInterval(interval), myNextExecutionTime(0) {}
92 
93  bool operator<(const DtTickCallbackInfo& other) const
94  {
95  return ( myData < other.myData ||
96  myData == other.myData && myFn < other.myFn );
97  }
98 
99  void* myData;
101  DtTime myInterval;
103 };
104 
107 {
108 public:
109  DtTickWithExecCallbackInfo(DtTickWithExecCbFn fn, void* data, DtTime interval) :
110  myData(data), myFn(fn), myInterval(interval), myNextExecutionTime(0) {}
111 
112  bool operator<(const DtTickWithExecCallbackInfo& other) const
113  {
114  return ( myData < other.myData ||
115  myData == other.myData && myFn < other.myFn );
116  }
117 
118  void* myData;
120  DtTime myInterval;
122 };
123 
126 {
127 public:
129  myData(data), myFn(fn) {}
130 
131  bool operator<(const DtLogFileNameCallbackInfo& other) const
132  {
133  return ( myData < other.myData ||
134  myData == other.myData && myFn < other.myFn );
135  }
136 
137  void* myData;
139 };
140 
142 {
143 protected:
144 
147  DtBoost::shared_ptr<DtFilePrinter> logPrinter,
148  bool autoExit,
149  const DtRtiConnectionInfoDataPair& connInfo );
150 
151 public:
152 
154  virtual ~DtRtiExec();
155 
156  virtual void shutdownForwarderIfCreated();
157 
159  virtual void checkVersion(const DtString& version) const;
160 
162  virtual void processCreate(const DtCreateMsg& msg);
163 
165  virtual void processDestroy(const DtDestroyMsg& msg);
166 
168  virtual void processListFederations(const DtListFederationsMsg& msg);
169 
171  virtual void processJoin(const DtJoinMsg& msg);
172 
175  virtual void processDisconnect(const DtDisconnectMsg& msg);
176 
178  virtual void processQueueFull( const DtQueueFullMsg& msg );
179 
182  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 
238  DtFedExec* fedExec(const DtString& fedExName);
239  const DtFedExec* fedExec(const DtString& fedExName) const;
240 
242  const std::map<DtString, DtFedExec*>& fedExecs() const;
243 
245  const DtRIDParameters& params() const;
246 
248  virtual void run();
249 
254  virtual bool tick( bool noCallbacks = false );
255 
257  virtual void wait(DtTime intervalInSeconds);
258 
261  virtual void addFedExCreatedCallback(DtFedExCbFn fn, void* usr);
262  virtual void removeFedExCreatedCallback(DtFedExCbFn fn, void* usr);
263 
266  virtual void addFedExDestroyedCallback(DtFedExCbFn fn, void* usr);
267  virtual void removeFedExDestroyedCallback(DtFedExCbFn fn, void* usr);
268 
271  virtual void addLogFileNameUpdatedCallback(DtLogFileNameCbFn fn, void* usr);
272  virtual void removeLogFileNameUpdatedCallback(DtLogFileNameCbFn fn, void* usr);
273 
276  virtual void addTickCallback(DtTickCbFn fn, void* usr, DtTime interval );
277  virtual void removeTickCallback(DtTickCbFn fn, void* usr );
278 
282  virtual void addTickCallback(DtTickWithExecCbFn fn, void* usr, DtTime interval );
283  virtual void removeTickCallback(DtTickWithExecCbFn fn, void* usr );
284 
286  virtual void sendCreateResponseMsg(const unsigned long destinationID,
287  DtCreateResponseFlag flag, MAKRti::DtString const & errorString);
288  virtual void sendDestroyResponseMsg(
289  const char* fedExName, DtDestroyResponseFlag flag);
290  virtual void sendReportFederationsMsg(unsigned long destId,
291  const std::vector<DtString>& federationNames,
292  const std::vector<DtString>& timeImplNames);
293  virtual void sendJoinResponseMsg(
294  unsigned long destinationIDValue,unsigned short requestID, unsigned int crc,
295  DtFederateHandle handle, const char* fedName, int fedExHandle, const char* fedExName,
296  const DtString& momModule, const std::vector<DtString>& fedFileName,
297  unsigned long flags, bool allowNetworkTesting,
298  MAKRti::DtString const & errorString,
300 
305  virtual void ridRequestCb( const DtRidTestRequestMsg& msg);
306 
307 public:
308 
310  static DtRtiExec* create(DtRIDParameters* p,
311  DtBoost::shared_ptr<DtFilePrinter> logPrinter,
312  bool autoExit = false,
314 
318  static void setCreatorFunction(DtRtiExecCreator fn);
319 
321  static void processRtiExecHandshakeMsg(const DtRtiExecHandshakeMsg& msg,
322  void* usr);
323 
325  static void processCreate(const DtCreateMsg& msg,
326  void *usr);
327 
329  static void processDestroy(const DtDestroyMsg& msg,
330  void* usr);
331 
333  static void processListFederations(const DtListFederationsMsg& msg,
334  void* usr);
335 
337  static void processJoin(const DtJoinMsg& msg,
338  void* usr);
339 
341  static void processDisconnect(const DtDisconnectMsg& msg,
342  void* usr);
343 
345  static void processQueueFull( const DtQueueFullMsg& msg,
346  void* usr);
347 
349  static void processReconnect(const DtReconnectMsg& msg,
350  void* usr);
351 
353  static void ridRequestCb( const DtRidTestRequestMsg& msg, void* usr );
354  static bool shutdownSignalCaught();
355  static void caughtShutdownSignal();
356 
357 protected:
358 
361  void cleanupConstructorException();
362 
365  virtual void rtiExecToForwarderHandshake();
366 
368  virtual void sendRtiExecHandshakeMsg( DtHandle destId, DtRtiExecHandshakeMsg::DtHandshakeStatus status );
369 
371  virtual void processRtiExecHandshakeMsg( const DtRtiExecHandshakeMsg& msg );
372 
374  virtual void performMulticastDiscovery( bool reliableTransportDisabled );
375 
377  virtual void removeDroppedFederateConnections();
378 
380  {
383  ForwarderStartupFailed
384  };
387  virtual DtStartRtiForwarderResult startRtiForwarder(const DtRIDParameters* params);
388 
389 protected:
390 
391  typedef std::map< unsigned long, DtTime > DtConnIdToTimeMap;
393 
395  std::map<DtString, DtFedExec*> myExecByName;
396  std::map<DtFederationHandle, DtFedExec*> myExecByHandle;
397  DtString lineOfInput;
398 
402  unsigned int myHandleForDelete;
403 
410 
412  std::list<DtTickCallbackInfo> myTickCallbacks;
413 
415  std::list<DtTickWithExecCallbackInfo> myTickWithExecCallbacks;
416 
418  std::list<DtLogFileNameCallbackInfo> myLogFileNameCallbacks;
419 
420  DtClock myClock;
423 
426 
428 
433 
436 
439 
441  DtBoost::shared_ptr<DtFilePrinter> myLogPrinter;
442 
444 
445  DtString myHostname;
446 
447 
448 protected:
449 
451 };
452 
454 {
455  return myConnectionMgr;
456 }
457 
458 inline const DtRIDParameters& DtRtiExec::params() const
459 {
460  return *myParams;
461 }
462 
463 #endif
464 
465 #endif
466 
DtTickCallbackInfo(DtTickCbFn fn, void *data, DtTime interval)
Definition: exec.h:90
DtConnectionMgr * myConnectionMgr
Definition: exec.h:394
bool myPendingDelete
Definition: exec.h:405
DtRtiExecHandshakeMsg::DtHandshakeStatus myHandshakeStatus
Definition: exec.h:421
static bool theShutdownSignalCaught
Definition: exec.h:392
Definition: extendedRtiMsgForwarder.h:30
std::map< DtString, DtFedExec * > myExecByName
Definition: exec.h:395
Sent by Federates to request testing of the RID file from RtiExec.
Definition: ridTestRequestMsg.h:29
DtTickWithExecCbFn myFn
Definition: exec.h:119
Definition: createMsg.h:24
DtDestroyResponseFlag
Definition: desRespMsg.h:23
Definition: exec.h:382
Info for tick callbacks.
Definition: exec.h:87
This class manages the RTI&#39;s start-up configuration using both MTL variables and functions.
Definition: RIDparams.h:87
DtBoost::shared_ptr< DtExtendedRtiMsgForwarder > DtRtiMsgForwarderSP
Smart pointer to forwarder needed for vlThreads.
Definition: exec.h:49
!DtIFSPEC1516
Definition: fedTimeFactory.h:190
bool operator<(const DtLogFileNameCallbackInfo &other) const
Definition: exec.h:131
This file contains the declaration of DtRtiConnectionInfo.
Info for log file name callbacks.
Definition: exec.h:125
std::pair< DtRtiConnectionInfo, DtRtiAssociatedConnectionData > DtRtiConnectionInfoDataPair
Pair of connection with associated data.
Definition: assistantConnectionInfo.h:29
Definition: fedex.h:134
Definition: joinMsg.h:27
std::list< DtTickCallbackInfo > myTickCallbacks
List of tick callbacks.
Definition: exec.h:412
DtFedExCbFn myFn
Definition: exec.h:83
std::map< unsigned long, DtTime > DtConnIdToTimeMap
Definition: exec.h:391
void * myData
Definition: exec.h:99
DtTime myInterval
Definition: exec.h:120
void(* DtFedExCbFn)(DtFedExec *exec, void *usr)
Create/Destroy federation callback function signature.
Definition: exec.h:66
bool myExitCommanded
Flag indicating that an exit command was received.
Definition: exec.h:438
void(* DtTickWithExecCbFn)(const DtRtiExec &exec, void *usr)
Definition: exec.h:70
Definition: queueFullMsg.h:21
DtTime myNextExecutionTime
Definition: exec.h:121
bool myAutoExit
Definition: exec.h:435
DtLogFileNameCbFn myFn
Definition: exec.h:138
bool operator<(const DtTickCallbackInfo &other) const
Definition: exec.h:93
DtForwarderFaultManager * myFaultManager
Definition: exec.h:425
errorCodes
error codes for the errorValue flag
Definition: joinRespMsg.h:31
bool operator<(const DtTickWithExecCallbackInfo &other) const
Definition: exec.h:112
DtTime myNextExecutionTime
Definition: exec.h:102
std::list< DtLogFileNameCallbackInfo > myLogFileNameCallbacks
List of log file name update callbacks.
Definition: exec.h:418
void(* DtTickCbFn)(void *usr)
Tick callback function signatures.
Definition: exec.h:69
std::list< DtTickWithExecCallbackInfo > myTickWithExecCallbacks
List of tick callbacks with DtRtiExec reference.
Definition: exec.h:415
Definition: listFederationsMsg.h:22
DtString myFederationNameForDelete
Definition: exec.h:401
Instances of DtConnectionMgr manage the communication objects that the RTI will use to either communi...
Definition: connectMgr.h:60
Definition: destroyMsg.h:30
bool myFedNameForDeleteComplete
Definition: exec.h:400
DtHandle DtFederateHandle
Definition: internalTypes.h:29
DtList myCreateCallbacks
Definition: exec.h:408
bool myCreatedRtiForwarder
Definition: exec.h:404
DtHandshakeStatus
Definition: execHandshakeMsg.h:26
DtConnIdToTimeMap myDisconnectedFederates
Map of dropped Federate to timestamp of drop.
Definition: exec.h:432
void * myData
Definition: exec.h:137
DtMulitcastDiscoveryMgr * myMcastDiscoveryMgr
Definition: exec.h:427
unsigned int myHandleForDelete
Definition: exec.h:402
DtRIDParameters * myParams
Definition: exec.h:434
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:407
Info for tick callbacks with DtRtiExec reference.
Definition: exec.h:106
DtStartRtiForwarderResult
Definition: exec.h:379
bool myPendingQuit
Definition: exec.h:406
DtList myDestroyCallbacks
Definition: exec.h:409
Definition: exec.h:141
void(* DtLogFileNameCbFn)(const DtFilename &file, void *usr)
Log file name update callback function signature.
Definition: exec.h:73
DtTime myNextHeartbeat
Definition: exec.h:422
DtConnectionMgr * connectMgr()
Returns the connection manager Not virtual because referenced in both ctors and dtors.
Definition: exec.h:453
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:76
DtTime myInterval
Definition: exec.h:101
Definition: reconnectMsg.h:22
DtTickCbFn myFn
Definition: exec.h:100
DtTickWithExecCallbackInfo(DtTickWithExecCbFn fn, void *data, DtTime interval)
Definition: exec.h:109
DtRtiExec *(* DtRtiExecCreator)(DtRIDParameters *p, DtBoost::shared_ptr< DtFilePrinter > logPrinter, bool autoExit, const DtRtiConnectionInfoDataPair &connInfo)
DtRtiExec creator callback signature.
Definition: exec.h:61
unsigned long DtHandle
The internal types.
Definition: internalTypes.h:25
DtFedExCallbackInfo(DtFedExCbFn fn, void *data)
Definition: exec.h:79
void * myData
Definition: exec.h:82
DtLogFileNameCallbackInfo(DtLogFileNameCbFn fn, void *data)
Definition: exec.h:128
DtRtiConnectionInfoDataPair myConnInfo
Definition: exec.h:443
static DtRtiExecCreator theCreator
Definition: exec.h:450
Definition: joinRespMsg.h:32
std::map< DtFederationHandle, DtFedExec * > myExecByHandle
Definition: exec.h:396
DtRtiMsgForwarderSP myRtiForwarder
Definition: exec.h:424
Definition: execHandshakeMsg.h:23
Defines a ThreadedObject which can run a DtRunnable object in a thread.
void * myData
Definition: exec.h:118
void RTI_EXPORT checkVersion(const MAKRti::DtString &version)
Called by the exec application to make sure that the RTI Version matches.
DtBoost::shared_ptr< DtFilePrinter > myLogPrinter
Printer which prints output to a log file.
Definition: exec.h:441
DtString lineOfInput
Definition: exec.h:397
DtClock myClock
Definition: exec.h:420
#define DT_DLL_EXEC
Definition: rtiMsConfig.h:123
bool myHandleForDeleteComplete
Definition: exec.h:399
DtString myHostname
Definition: exec.h:445
const DtRIDParameters & params() const
Returns a handle to the current RID Params.
Definition: exec.h:458

Document ID: Generated on Thu May 11 15:55:32 EDT 2023 from SVN revision 254743
Copyright © 2005-2020 MAK Technologies Inc. All Rights Reserved (www.mak.com)