MAK RTIspy API Documentation for HLA 1.3
 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 
17 #include "rtiMsConfig.h"
18 #include <vlutil/vlString.h>
19 #include <vlutil/vlTime.h>
20 #include <vlutil/vlFedTarget.h>
21 #include <vlutil/vlMutex.h>
22 #include <metadata.h>
23 #include <vector>
24 #include <list>
25 
26 #ifdef DtIFSPEC1516
27 #include "RTI/RTIambassador.h"
28 #include "RTI/LogicalTimeFactory.h"
29 #include "RTI/Enums.h"
30 using namespace rti1516;
31 #elif defined(DtIFSPEC1516E)
32 #include "RTI/RTIambassador.h"
33 #include "RTI/LogicalTimeFactory.h"
34 #include "RTI/Enums.h"
35 using namespace rti1516e;
36 #else
37 #ifdef DtIFSPEC13DLC
38 #include "RTI13.h"
39 #define RTI rti13
40 #else
41 #include "RTI.hh"
42 #endif
43 #endif
44 
45 class DtFederateMgr;
46 class DtConnectionMgr;
48 class DtRIDParameters;
49 class DtInteractionMsg;
50 class DtPhvps;
51 class DtSubInterMsg;
52 class DtUnsubInterMsg;
58 class DtResignMsg;
59 
60 
61 
62 
65 
67 {
68 protected:
69 
70  typedef enum DtInitiatorByType_e { DtInitiatedByExec, DtInitiatedByAssistant } DtInitiatorByType;
71  typedef std::multimap<DtMetadataType, MAKRti::DtTime> DtTimeStampMap;
72  typedef std::map<unsigned int, DtTimeStampMap > DtTestToTimeStampMap;
73 
75  {
77  trialID(0),
78  federateHandle(0),
79  initiatorType (DtInitiatedByAssistant),
80  numInteractions(0),
81  payLoadSize(0),
82  period(.1),
83  continuous(false)
84  { };
85 
86  unsigned int trialID;
87  unsigned int federateHandle;
89  unsigned int numInteractions;
90  unsigned int payLoadSize;
91  MAKRti::DtTime period;
92  bool continuous;
93  };
94 
95 public:
96 
98  DtTestManager(bool initiallyEnabled);
99 
101  DtTestManager(DtFederateMgr* fedMgr, bool initiallyEnabled);
102 
104  virtual ~DtTestManager();
105 
106 
108  DtRIDParameters* params();
109 
111  DtRIDParameters* params() const;
112 
114  DtFederateMgr* fedMgr();
115 
117  DtFederateMgr* fedMgr() const;
118 
119 #ifdef DtIFSPEC1516
120  rti1516::RTIambassador* rtiAmb();
122 
124  rti1516::RTIambassador* rtiAmb() const;
125 #elif defined(DtIFSPEC1516E)
126  rti1516e::RTIambassador* rtiAmb();
128 
130  rti1516e::RTIambassador* rtiAmb() const;
131 #else
132  RTI::RTIambassador* rtiAmb();
134 
136  RTI::RTIambassador* rtiAmb() const;
137 #endif
138 
140  virtual DtConnectionMgr* connectMgr();
141 
143  virtual DtConnectionMgr* connectMgr() const;
144 
146  virtual MAKRti::DtTime time() const;
147 
150  virtual void postJoinInit();
151 
153  virtual void resign();
154 
156  virtual void tick(unsigned long tickCount);
157 
159  virtual float averageTickPeriod() const;
160 
162  virtual void enableNetworkTesting();
163 
165  virtual void disableNetworkTesting();
166 
168  virtual bool networkTestingEnabled() const;
169 
171  void processResign(const DtResignMsg& msg);
172 
176  virtual bool receiveInteraction(DtInteractionClassHandle classHandle, const DtPhvps & params);
177 
179  virtual bool testMgrCurrentlySending() const;
180 
182  virtual bool queueMsgForSend(DtRtiMsg& msg ) const;
183 
186  virtual void setTestMgrCurrentlySending( bool isSending,
187  unsigned int testID = 0 );
188 
190  virtual bool addSendTimeStampMetaDataIfNecessary( DtRtiMsg& msg );
191 
193  virtual bool addReceiveTimeStampIfNecessary( DtRtiMsg& msg );
194 
200  virtual bool addAsyncQueueMsgOnRecieve(DtRtiMsg& msg);
201 
203  virtual bool isTestInteractionClassHandle(DtInteractionClassHandle classHandle);
204 
206  virtual void sendStatusMessages() const;
207 
208 protected:
209 
211  virtual void processSub( const DtSubInterMsg& msg );
212 
214  virtual void processUnsub( const DtUnsubInterMsg& msg );
215 
219  virtual void processChangeLatencyTestStatus(const DtAssistantChangeLatencyTestModeMsg& testMsg);
220  virtual void processChangeLatencyTestStatus(const DtChangeLatencyTestModeMsg& testMsg);
221 
223  virtual void changeLatencyTestRequestByType( bool initiateTest, bool continuousCommand,
224  bool stopContinuous, bool observing, DtInitiatorByType type, MAKRti::DtTime period,
225  unsigned int numInteractions, unsigned int payloadSize );
226 
229  virtual void initiateLatencyTest();
230 
232  virtual void processLatencyTest();
233 
234  // Upon netread - get the testID from the metadata.
235  virtual bool getTestIDFromMetaData( DtRtiMsg& msg, unsigned int& testID) const;
236 
238  virtual void addKnownFederate(DtFederateHandle subscribedFed);
239 
241  virtual void removeKnownFederate(DtFederateHandle unsubscribedFed);
242 
244  virtual bool atLeastOneKnownFederate() const;
245 
247  virtual bool isKnownFederateHandle(DtFederateHandle handle) const;
248 
253  virtual void addSendInteractionTimeStamp( unsigned int testID );
254 
260  virtual void addNetSendTimeStamp( unsigned int testID, DtRtiMsg& msg );
261 
267  virtual void addNetReceiveTimeStamp( unsigned int testID, const DtRtiMsg& msg );
268 
273  virtual void addReceiveInteractionTimeStamp( unsigned int testID, MAKRti::DtTime timeToUse );
274 
278  virtual void removeKnowledgeOfTestId( unsigned int testID );
279 
284  virtual void addAsyncQueueMsgTimeStamp( unsigned int& testID, const DtRtiMsg& msg );
285 
287  MAKRti::DtTransportType transportTypeForTestID( unsigned int testID );
288 
293 
295  virtual unsigned int lastSentTestID() const;
296 
298  virtual void setLastSentTestID( unsigned int testID );
299 
301  virtual bool sendSingleLatencyInteraction(unsigned int testID,
302  DtFederateHandle recipient,
303  MAKRti::DtTransportType transport,
304  unsigned int payload );
305 
308  virtual bool addMetadataIfNecessary( DtRtiMsg& msg, unsigned int& testID ) const;
309 
311  virtual bool shouldAddMetadataToMessage( DtRtiMsg& msg ) const;
312 
314  virtual bool isInitiatorOfTestID( unsigned int testID ) const;
315 
317  virtual void calculateTickTime(unsigned long tickCount );
318 
324  virtual bool sendInteraction(unsigned int testID,
325  DtInteractionClassHandle handle, const DtPhvps& params, unsigned int payloadSize );
326 
327 protected:
328 
330  static void processSub( const DtSubInterMsg& msg, void* usr );
331 
333  static void processUnsub( const DtUnsubInterMsg& msg, void* usr );
334 
336  static void queueLatencyTestRequest( const DtAssistantChangeLatencyTestModeMsg& testMsg, void* usr );
337 
341  static void processChangeLatencyTestStatus( const DtAssistantChangeLatencyTestModeMsg& testMsg, void* usr );
342  static void processChangeLatencyTestStatus( const DtChangeLatencyTestModeMsg& testMsg, void* usr );
343 
344 private:
346  DtTestManager(DtTestManager const& orig);
347 
349  DtTestManager& operator= (DtTestManager const& orig);
350 
351 protected:
352 
355 
358 
361 
364 
366  MAKRti::DtClock myClock;
367 
372 
374  std::set<DtInitiatorByType> myObservers;
375 
378 
384 
388 
390  unsigned int myCurrentTrialID;
391 
393  unsigned int myInitiatedTrialID;
395 
396  // Send subscribe when we learn about new federates so they can know about us
398 
402 
404  std::list<DtTrialDetails> myTrialsToInitiate;
405 
410  std::set<DtFederateHandle> myListOfKnownFederates;
411 
414 
416  unsigned long myInitialTickCount;
417 
420 
422  unsigned long mySecondTickCount;
423 
426 
428  bool myEnabled;
429 
432 
435 
439 
440 };
441 
442 #endif
virtual Boolean tick(TickTime minimum, TickTime maximum)
virtual EventRetractionHandle sendInteraction(InteractionClassHandle theInteraction, const ParameterHandleValuePairSet &theParameters, const FedTime &theTime, const char *theTag)
MAKRti::DtClock myClock
Keep track of time.
Definition: testManager.h:366
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:387
DtInitiatorLatencyTest runs network connectivity tests between local RTI components.
Definition: initiatorLatencyTest.h:38
unsigned int payLoadSize
Definition: testManager.h:90
std::map< unsigned int, DtTimeStampMap > DtTestToTimeStampMap
Definition: testManager.h:72
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:393
std::multimap< DtMetadataType, MAKRti::DtTime > DtTimeStampMap
Definition: testManager.h:71
A class provided by the HLA C++ Interface Specification which federates use to communicate with the R...
float mySecondTickTime
the second tick time we&#39;re using for avgTickPeriod.
Definition: testManager.h:419
DtTrialDetails()
Definition: testManager.h:76
DtFederateMgr * myFedMgr
The federate manager.
Definition: testManager.h:354
Definition: resignMsg.h:36
Definition: testManager.h:74
bool mySendSubscribe
Definition: testManager.h:397
DtLatencyTestInteraction holds the data needed to send a test latency interaction.
Definition: testInteraction.h:165
DtLatencyTestInteraction * myLatencyInteraction
The latency test interaction.
Definition: testManager.h:363
bool mySendingInteraction
Set when testMgr sends a message, is cleared by accessor when connectMgr checks whether the last mess...
Definition: testManager.h:383
DtHandle DtInteractionClassHandle
Definition: internalTypes.h:35
DtMutex myRecipientMutex
Definition: testManager.h:438
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:401
DtTestMgrFedAmbWrapper is installed by the testManager and serves to catch testInteraction messages f...
Definition: testMgrFedAmbWrapper.h:42
DtMutex myInitiatorMutex
lock for the initiator test
Definition: testManager.h:437
MAKRti::DtTime period
Definition: testManager.h:91
unsigned long myInitialTickCount
the earliest tick count we&#39;re using for avgTickPeriod.
Definition: testManager.h:416
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:84
unsigned int federateHandle
Definition: testManager.h:87
enum DtTestManager::DtInitiatorByType_e DtInitiatorByType
unsigned long mySecondTickCount
the second tick count we&#39;re using for avgTickPeriod.
Definition: testManager.h:422
Instances of DtConnectionMgr manage the communication objects that the RTI will use to either communi...
Definition: connectMgr.h:60
DtRtiMsg is the base class for messages between RTI components.
Definition: rtiMsg.h:45
DtHandle DtFederateHandle
Definition: internalTypes.h:29
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:371
DtInitiatorByType initiatorType
Definition: testManager.h:88
std::list< DtTrialDetails > myTrialsToInitiate
List of trials to initiate.
Definition: testManager.h:404
Definition: unsubIntMsg.h:23
DtRecipientLatencyTest * myRecipientTest
Handles receiving tests from other federates.
Definition: testManager.h:360
unsigned myNumTestReportsGenerated
The number of test reports this federate has generated.
Definition: testManager.h:434
unsigned int myCurrentTrialID
What is the current trial number.
Definition: testManager.h:390
DtFederateHandle myInitiatedFedHandle
Definition: testManager.h:394
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:428
bool continuous
Definition: testManager.h:92
Definition: subInterMsg.h:22
unsigned myNumInitiatedTests
The number of tests this federate has initiated.
Definition: testManager.h:431
std::set< DtInitiatorByType > myObservers
list of observers.
Definition: testManager.h:374
bool myRunningContinuous
Are we currently running a continuous test?
Definition: testManager.h:369
#define DT_DLL_LRC
Definition: rtiMsConfig.h:126
DtInitiatorByType_e
Definition: testManager.h:70
float myAverageTickPeriod
The average period between ticks.
Definition: testManager.h:425
DtTestToTimeStampMap myCompletedAveragedInitiatedTests
Storage of my completed initiated tests.
Definition: testManager.h:377
float myInitialTickTime
the earliest tick time we&#39;re using for avgTickPeriod.
Definition: testManager.h:413
DtTestManager runs network connectivity tests between local RTI components.
Definition: testManager.h:66
unsigned int numInteractions
Definition: testManager.h:89
DtInitiatorLatencyTest * myInitiatorTest
Handles initiating tests with other federates.
Definition: testManager.h:357
std::set< DtFederateHandle > myListOfKnownFederates
Our list of known federates (not including self).
Definition: testManager.h:410
DtInteractionMsg is a message type that represents an HLA Interaction.
Definition: interactMsg.h:27

Document ID: Generated on Mon Sep 7 15:40:32 EDT 2020 from SVN revision 217499
Copyright © 2005-2020 MAK Technologies Inc. All Rights Reserved (www.mak.com)