MAK RTIspy API Documentation for HLA 1516
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
testManager.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2008 VT MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: testManager.h,v $ $Revision: 1.17 $ $State: Exp $
7 *******************************************************************************/
8 
12 
13 #ifndef DtTestManager_H_
14 #define DtTestManager_H_
15 
16 #include <rtiMsConfig.h>
17 #include <rtiApiTypes.h>
18 #if !defined(DtIFSPEC13)
19 #include <RTI/RTIambassador.h>
20 #endif
21 
22 #include <vlutil/vlString.h>
23 #include <vlutil/vlTime.h>
24 #include <vlutil/vlFedTarget.h>
25 #include <vlutil/vlMutex.h>
26 
27 #include <metadata.h>
28 #include <vector>
29 #include <list>
30 
31 class DtFederateMgr;
32 class DtConnectionMgr;
34 class DtRIDParameters;
35 class DtInteractionMsg;
36 class DtPhvps;
37 class DtSubInterMsg;
38 class DtUnsubInterMsg;
44 class DtResignMsg;
45 
46 
49 
51 {
52 protected:
53 
54  typedef enum DtInitiatorByType_e { DtInitiatedByExec, DtInitiatedByAssistant } DtInitiatorByType;
55  typedef std::multimap<DtMetadataType, MAKRti::DtTime> DtTimeStampMap;
56  typedef std::map<unsigned int, DtTimeStampMap > DtTestToTimeStampMap;
57 
59  {
61  trialID(0),
62  federateHandle(0),
63  initiatorType (DtInitiatedByAssistant),
64  numInteractions(0),
65  payLoadSize(0),
66  period(.1),
67  continuous(false)
68  { };
69 
70  unsigned int trialID;
71  unsigned int federateHandle;
73  unsigned int numInteractions;
74  unsigned int payLoadSize;
75  MAKRti::DtTime period;
76  bool continuous;
77  };
78 
79 public:
80 
82  DtTestManager(bool initiallyEnabled);
83 
85  DtTestManager(DtFederateMgr* fedMgr, bool initiallyEnabled);
86 
88  virtual ~DtTestManager();
89 
90 
92  DtRIDParameters* params();
93 
95  DtRIDParameters* params() const;
96 
98  DtFederateMgr* fedMgr();
99 
101  DtFederateMgr* fedMgr() const;
102 
104  RTI_API::RTIambassador* rtiAmb();
105 
107  RTI_API::RTIambassador* rtiAmb() const;
108 
110  virtual DtConnectionMgr* connectMgr();
111 
113  virtual DtConnectionMgr* connectMgr() const;
114 
116  virtual MAKRti::DtTime time() const;
117 
120  virtual void postJoinInit();
121 
123  virtual void resign();
124 
126  virtual void tick(unsigned long tickCount);
127 
129  virtual float averageTickPeriod() const;
130 
132  virtual void enableNetworkTesting();
133 
135  virtual void disableNetworkTesting();
136 
138  virtual bool networkTestingEnabled() const;
139 
141  void processResign(const DtResignMsg& msg);
142 
146  virtual bool receiveInteraction(DtInteractionClassHandle classHandle, const DtPhvps & params);
147 
149  virtual bool testMgrCurrentlySending() const;
150 
152  virtual bool queueMsgForSend(DtRtiMsg& msg ) const;
153 
156  virtual void setTestMgrCurrentlySending( bool isSending,
157  unsigned int testID = 0 );
158 
160  virtual bool addSendTimeStampMetaDataIfNecessary( DtRtiMsg& msg );
161 
163  virtual bool addReceiveTimeStampIfNecessary( DtRtiMsg& msg );
164 
170  virtual bool addAsyncQueueMsgOnRecieve(DtRtiMsg& msg);
171 
173  virtual bool isTestInteractionClassHandle(DtInteractionClassHandle classHandle);
174 
176  virtual void sendStatusMessages() const;
177 
178 protected:
179 
181  virtual void processSub( const DtSubInterMsg& msg );
182 
184  virtual void processUnsub( const DtUnsubInterMsg& msg );
185 
189  virtual void processChangeLatencyTestStatus(const DtAssistantChangeLatencyTestModeMsg& testMsg);
190  virtual void processChangeLatencyTestStatus(const DtChangeLatencyTestModeMsg& testMsg);
191 
193  virtual void changeLatencyTestRequestByType( bool initiateTest, bool continuousCommand,
194  bool stopContinuous, bool observing, DtInitiatorByType type, MAKRti::DtTime period,
195  unsigned int numInteractions, unsigned int payloadSize );
196 
199  virtual void initiateLatencyTest();
200 
202  virtual void processLatencyTest();
203 
204  // Upon netread - get the testID from the metadata.
205  virtual bool getTestIDFromMetaData( DtRtiMsg& msg, unsigned int& testID) const;
206 
208  virtual void addKnownFederate(DtFederateHandle subscribedFed);
209 
211  virtual void removeKnownFederate(DtFederateHandle unsubscribedFed);
212 
214  virtual bool atLeastOneKnownFederate() const;
215 
217  virtual bool isKnownFederateHandle(DtFederateHandle handle) const;
218 
223  virtual void addSendInteractionTimeStamp( unsigned int testID );
224 
230  virtual void addNetSendTimeStamp( unsigned int testID, DtRtiMsg& msg );
231 
237  virtual void addNetReceiveTimeStamp( unsigned int testID, const DtRtiMsg& msg );
238 
243  virtual void addReceiveInteractionTimeStamp( unsigned int testID, MAKRti::DtTime timeToUse );
244 
248  virtual void removeKnowledgeOfTestId( unsigned int testID );
249 
254  virtual void addAsyncQueueMsgTimeStamp( unsigned int& testID, const DtRtiMsg& msg );
255 
257  MAKRti::DtTransportType transportTypeForTestID( unsigned int testID );
258 
263 
265  virtual unsigned int lastSentTestID() const;
266 
268  virtual void setLastSentTestID( unsigned int testID );
269 
271  virtual bool sendSingleLatencyInteraction(unsigned int testID,
272  DtFederateHandle recipient,
273  MAKRti::DtTransportType transport,
274  unsigned int payload );
275 
278  virtual bool addMetadataIfNecessary( DtRtiMsg& msg, unsigned int& testID ) const;
279 
281  virtual bool shouldAddMetadataToMessage( DtRtiMsg& msg ) const;
282 
284  virtual bool isInitiatorOfTestID( unsigned int testID ) const;
285 
287  virtual void calculateTickTime(unsigned long tickCount );
288 
294  virtual bool sendInteraction(unsigned int testID,
295  DtInteractionClassHandle handle, const DtPhvps& params, unsigned int payloadSize );
296 
297 protected:
298 
300  static void processSub( const DtSubInterMsg& msg, void* usr );
301 
303  static void processUnsub( const DtUnsubInterMsg& msg, void* usr );
304 
306  static void queueLatencyTestRequest( const DtAssistantChangeLatencyTestModeMsg& testMsg, void* usr );
307 
311  static void processChangeLatencyTestStatus( const DtAssistantChangeLatencyTestModeMsg& testMsg, void* usr );
312  static void processChangeLatencyTestStatus( const DtChangeLatencyTestModeMsg& testMsg, void* usr );
313 
314 private:
316  DtTestManager(DtTestManager const& orig);
317 
319  DtTestManager& operator= (DtTestManager const& orig);
320 
321 protected:
322 
325 
328 
331 
334 
336  MAKRti::DtClock myClock;
337 
342 
344  std::set<DtInitiatorByType> myObservers;
345 
348 
354 
358 
360  unsigned int myCurrentTrialID;
361 
363  unsigned int myInitiatedTrialID;
365 
366  // Send subscribe when we learn about new federates so they can know about us
368 
372 
374  std::list<DtTrialDetails> myTrialsToInitiate;
375 
381 
384 
386  unsigned long myInitialTickCount;
387 
390 
392  unsigned long mySecondTickCount;
393 
396 
398  bool myEnabled;
399 
402 
405 
409 
410 };
411 
412 #endif
MAKRti::DtClock myClock
Keep track of time.
Definition: testManager.h:336
This class manages the RTI&#39;s start-up configuration using both MTL variables and functions.
Definition: RIDparams.h:87
unsigned int myTestIDOfLastSentInteraction
The testID of the currently running initiated test.
Definition: testManager.h:357
DtInitiatorLatencyTest runs network connectivity tests between local RTI components.
Definition: initiatorLatencyTest.h:38
unsigned int payLoadSize
Definition: testManager.h:74
std::map< unsigned int, DtTimeStampMap > DtTestToTimeStampMap
Definition: testManager.h:56
This file contains the declaration of the DtRtiMetadata class which provides a framework for subclass...
unsigned int myInitiatedTrialID
What trials am I waiting to complete?
Definition: testManager.h:363
std::multimap< DtMetadataType, MAKRti::DtTime > DtTimeStampMap
Definition: testManager.h:55
float mySecondTickTime
the second tick time we&#39;re using for avgTickPeriod.
Definition: testManager.h:389
DtTrialDetails()
Definition: testManager.h:60
DtFederateMgr * myFedMgr
The federate manager.
Definition: testManager.h:324
Definition: resignMsg.h:36
Definition: testManager.h:58
bool mySendSubscribe
Definition: testManager.h:367
DtLatencyTestInteraction holds the data needed to send a test latency interaction.
Definition: testInteraction.h:164
DtLatencyTestInteraction * myLatencyInteraction
The latency test interaction.
Definition: testManager.h:333
bool mySendingInteraction
Set when testMgr sends a message, is cleared by accessor when connectMgr checks whether the last mess...
Definition: testManager.h:353
DtHandle DtInteractionClassHandle
Definition: internalTypes.h:52
DtMutex myRecipientMutex
Definition: testManager.h:408
virtual void receiveInteraction(InteractionClassHandle theInteraction, const ParameterHandleValuePairSet &theParameters, const FedTime &theTime, const char *theTag, EventRetractionHandle theHandle)=0
6.7
DtTestMgrFedAmbWrapper * myTestFedAmbWrapper
Catches calls to ReceiveInteraction to prevent testInteractions from being delivered to the user...
Definition: testManager.h:371
DtTestMgrFedAmbWrapper is installed by the testManager and serves to catch testInteraction messages f...
Definition: testMgrFedAmbWrapper.h:45
DtMutex myInitiatorMutex
lock for the initiator test
Definition: testManager.h:407
MAKRti::DtTime period
Definition: testManager.h:75
unsigned long myInitialTickCount
the earliest tick count we&#39;re using for avgTickPeriod.
Definition: testManager.h:386
Instances of DtFederateMgr process federation-level messages (such as create, destroy, join, resign, and sync points) and manages the objects responsible for handling general communication, objects, interactions, the FOM, MOM, and data distribution mmg.
Definition: fedMgr.h:93
unsigned int federateHandle
Definition: testManager.h:71
enum DtTestManager::DtInitiatorByType_e DtInitiatorByType
unsigned long mySecondTickCount
the second tick count we&#39;re using for avgTickPeriod.
Definition: testManager.h:392
Instances of DtConnectionMgr manage the communication objects that the RTI will use to either communi...
Definition: connectMgr.h:67
DtRtiMsg is the base class for messages between RTI components.
Definition: rtiMsg.h:34
DtHandle DtFederateHandle
Definition: internalTypes.h:46
The DtAssistantChangeLatencyTestModeMsg defines a wrapper for the RTI Assistant initiate latency test...
Definition: assistantChangeLatencyTestModeMsg.h:36
DtTrialDetails myContinuousDetails
If so what are the details of the continuous test?
Definition: testManager.h:341
DtInitiatorByType initiatorType
Definition: testManager.h:72
std::list< DtTrialDetails > myTrialsToInitiate
List of trials to initiate.
Definition: testManager.h:374
Definition: unsubIntMsg.h:23
DtRecipientLatencyTest * myRecipientTest
Handles receiving tests from other federates.
Definition: testManager.h:330
unsigned myNumTestReportsGenerated
The number of test reports this federate has generated.
Definition: testManager.h:404
unsigned int myCurrentTrialID
What is the current trial number.
Definition: testManager.h:360
DtFederateHandle myInitiatedFedHandle
Definition: testManager.h:364
The DtChangeLatencyTestModeMsg defines a wrapper for the change latency test message used to command ...
Definition: changeLatencyTestModeMsg.h:35
DtRecipientLatencyTest runs network connectivity tests between local RTI components.
Definition: recipientLatencyTest.h:24
bool myEnabled
Is network testing enabled?
Definition: testManager.h:398
DtFederateHandleStdSet myListOfKnownFederates
Our list of known federates (not including self).
Definition: testManager.h:380
bool continuous
Definition: testManager.h:76
Definition: subInterMsg.h:22
This file contains the rti1516e::RTIambassador class.
unsigned myNumInitiatedTests
The number of tests this federate has initiated.
Definition: testManager.h:401
std::set< DtInitiatorByType > myObservers
list of observers.
Definition: testManager.h:344
bool myRunningContinuous
Are we currently running a continuous test?
Definition: testManager.h:339
#define DT_DLL_LRC
Definition: rtiMsConfig.h:155
DtInitiatorByType_e
Definition: testManager.h:54
Definition: pHandValSet.h:38
float myAverageTickPeriod
The average period between ticks.
Definition: testManager.h:395
DtTestToTimeStampMap myCompletedAveragedInitiatedTests
Storage of my completed initiated tests.
Definition: testManager.h:347
float myInitialTickTime
the earliest tick time we&#39;re using for avgTickPeriod.
Definition: testManager.h:383
DtTestManager runs network connectivity tests between local RTI components.
Definition: testManager.h:50
unsigned int numInteractions
Definition: testManager.h:73
DtInitiatorLatencyTest * myInitiatorTest
Handles initiating tests with other federates.
Definition: testManager.h:327
std::set< DtFederateHandle > DtFederateHandleStdSet
Definition: internalTypes.h:47
DtInteractionMsg is a message type that represents an HLA Interaction.
Definition: interactMsg.h:26

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)