VR-Link API Documentation for DIS
interactionHLA.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1992-2010 VT MAK
3 ** All rights reserved.
4 *********************************************************************/
5 
6 #ifndef interactionHLA_H_
7 #define interactionHLA_H_
8 
9 
10 
11 #if DtHLA
12 
13 
14 
16 
17 #include <vlutil/vlTimeStampType.h>
18 #include <vlutil/vlTime.h>
19 #include <vlutil/vlString.h>
20 
21 
22 class DT_DLL_VL DtInterClassDesc;
24 class DT_DLL_VL DtList;
25 
33 {
34 public:
35 
37  DtInteraction();
38 
40  virtual ~DtInteraction();
41 
43  DtInteraction(const DtInteraction& orig);
44 
46  DtInteraction& operator=(const DtInteraction& orig);
47 
48 #if DtHLA_1516
49 
50  virtual const RTI::ParameterHandleValueMap& phvm() const = 0;
51 #else
52 
53  virtual const RTI::ParameterHandleValuePairSet& phvps() const = 0;
54 #endif
55 
56 #if DtHLA_1516
57 
58  virtual void setFromPhvm(const RTI::ParameterHandleValueMap& pvList)=0;
59 #else
60 
61  virtual void setFromPhvps(const RTI::ParameterHandleValuePairSet& pvList)=0;
62 #endif
63 
72  virtual void setExConn(DtExerciseConn* exConn,
73  DtInterClassDesc* classDesc = 0);
74 
76  virtual RTI::InteractionClassHandle interactionClassHandle() const;
77 
79  virtual char* interactionClassName() const;
80 
82  virtual int numParameters() const;
83 
86  virtual bool neededByFederation() const;
87 
89  virtual void print() const;
90 
92  virtual void printToStream(std::ostream& stream) const;
93 
95  virtual void printHeader() const;
96 
98  virtual void printHeaderToStream(std::ostream& stream) const;
99 
101  virtual void printData() const;
102 
104  virtual void printDataToString(DtString& buff) const;
105 
107  virtual void printDataToStream(std::ostream& stream) const;
108 
110  virtual void printParams(bool withHex) const;
111 
113  virtual void printParamsToStream(std::ostream& stream, bool withHex) const;
114 
116  virtual const char* name() const = 0;
117 
119  virtual DtExerciseConn* exerciseConn() const;
120 
123  virtual DtInterClassDesc* classDesc() const;
124 
126  virtual bool customTagSet() const;
127 
128 
129 #if DtHLA_1516
130 
131  virtual void setCustomTag(const RTI::VariableLengthData& a_tag);
133  virtual void setTag(const RTI::VariableLengthData& tag);
135  virtual const RTI::VariableLengthData &tag() const;
136 #else
137 
138  virtual void setCustomTag(const DtString& a_tag);
140  virtual void setTag(const DtString& tag);
142  virtual const DtString& tag() const;
143 #endif
144 
150 #if DtHLA_1516
151  virtual const RTI::RegionHandleSet* conveyedRegion() const;
152  virtual void setConveyedRegion(const RTI::RegionHandleSet* sentRegionHandleSet);
153 #else
154  virtual const RTI::Region* conveyedRegion() const;
155  virtual void setConveyedRegion(const RTI::Region* region);
156 #endif
157 
158 #if DtHLA_1516_EVOLVED
159 
160 
161 
162 
163 
164  virtual void setProducingFederateHandle(RTI::FederateHandle federateHandle);
165 
167  virtual RTI::FederateHandle producingFederateHandle() const;
168 
171  virtual const DtString& producingFederateName() const;
172 #endif
173 
174 
178  virtual void setTimeStamp(DtTime time,
180 
183  virtual DtTime timeStamp() const;
184 
186  virtual DtTimeStampType timeStampType() const;
187 
192  virtual DtTime guessTimeValid(DtTime referenceTime) const;
193 
198 #if DtHLA_1516
199  virtual void setFedTime(const RTI::LogicalTime &ft);
200 #else
201  virtual void setFedTime(const RTI::FedTime &ft);
202 #endif
203 
207 #if DtHLA_1516
208  virtual const RTI::LogicalTime *fedTime() const;
209 #else
210  virtual const RTI::FedTime *fedTime() const;
211 #endif
212 
213 #if DtHLA_1516
214 
215 
216  virtual void setMessageRetractionHandle(const RTI::MessageRetractionHandle &handle);
217 
219  virtual RTI::MessageRetractionHandle messageRetractionHandle() const;
220 
221 #else
222 
223 
224  virtual void setEventRetractionHandle(const RTI::EventRetractionHandle &handle);
225 
227  virtual RTI::EventRetractionHandle eventRetractionHandle() const;
228 #endif
229 
230 
231 public:
232 
236  static void setTagIsAsciiTime(bool val);
237  static bool tagIsAsciiTime();
238 
241  static void addCallback(DtExerciseConn* conn,
242  const DtList* classes, DtReceiveInteractionCb cb, void* usr,
243  DtDDMRegionSP region = DtDDMRegionSP());
244  static void removeCallback(DtExerciseConn* conn,
245  const DtList* classes, DtReceiveInteractionCb cb, void* usr,
246  DtDDMRegionSP region = DtDDMRegionSP());
247 
249  static void addCallback(DtExerciseConn* conn,
250  const char* className, DtReceiveInteractionCb cb, void* usr,
251  DtDDMRegionSP region = DtDDMRegionSP());
252  static void removeCallback(DtExerciseConn* conn,
253  const char* className, DtReceiveInteractionCb cb, void* usr,
254  DtDDMRegionSP region = DtDDMRegionSP());
255 
256 protected:
257 
260  virtual char* interactionClassToUse(
261  DtExerciseConn* exConn) const;
262 
266 #if DtHLA_1516
267  virtual RTI::ParameterHandleValueMap &privPvList() const;
268 #else
269  virtual RTI::ParameterHandleValuePairSet* privPvList() const;
270 #endif
271 
279  DtInteraction* self() const;
280 
281 protected:
282 
283  DtInterClassDesc* myClassDesc;
284  DtExerciseConn* myExConn;
285  DtTime myTime;
286  DtTimeStampType myTimeType;
287 
288 #if DtHLA_1516
289  RTI::LogicalTime *myFedTime;
290  RTI::ParameterHandleValueMap myPvList;
291  RTI::MessageRetractionHandle myRetractionHandle;
292  RTI::VariableLengthData myTag;
293  const RTI::RegionHandleSet* myConveyedRegion;
294 #if DtHLA_1516_EVOLVED
295  mutable DtString myProducingFederateName;
296  RTI::FederateHandle myProducingFederateHandle;
297 #endif
298 #else
299  DtString myTag;
300  RTI::ParameterHandleValuePairSet* myPvList;
301  int myPvListMaxSize;
302  RTI::FedTime *myFedTime;
303  RTI::EventRetractionHandle myRetractionHandle;
304  const RTI::Region* myConveyedRegion;
305 #endif
306 
307  bool myCustomTagSet;
308 
309 
310 protected:
311 
312  static bool theTagIsAsciiTime;
313 };
314 
315 DT_DLL_VL std::ostream & operator << (std::ostream &str, const DtInteraction &inter);
316 
317 #include "interClassDesc.h"
318 
319 inline RTI::InteractionClassHandle
320  DtInteraction::interactionClassHandle() const
321 {
322  return myClassDesc->handle();
323 }
324 
325 inline char* DtInteraction::interactionClassName() const
326 {
327  return (char*) (myClassDesc ? myClassDesc->name() : 0);
328 }
329 
330 inline int DtInteraction::numParameters() const
331 {
332  return myClassDesc ? myClassDesc->numParameters() : 0;
333 }
334 
335 inline DtInteraction* DtInteraction::self() const
336 {
337  return (DtInteraction*) this;
338 }
339 
340 inline DtExerciseConn* DtInteraction::exerciseConn() const
341 {
342  return myExConn;
343 }
344 
345 inline DtInterClassDesc* DtInteraction::classDesc() const
346 {
347  return myClassDesc;
348 }
349 
350 inline void DtInteraction::printData() const
351 {
352 }
353 
354 inline void DtInteraction::printDataToString(DtString& buff) const
355 {
356 }
357 
358 inline void DtInteraction::printDataToStream(std::ostream& stream) const
359 {
360 }
361 
362 #if DtHLA_1516
363 inline void DtInteraction::setMessageRetractionHandle(
364  const RTI::MessageRetractionHandle &handle)
365 {
366  myRetractionHandle = handle;
367 }
368 
369 inline RTI::MessageRetractionHandle DtInteraction::messageRetractionHandle() const
370 {
371  return myRetractionHandle;
372 }
373 
374 #else
375 inline void DtInteraction::setEventRetractionHandle(
376  const RTI::EventRetractionHandle &handle)
377 {
378  myRetractionHandle = handle;
379 }
380 
381 inline RTI::EventRetractionHandle DtInteraction::eventRetractionHandle() const
382 {
383  return myRetractionHandle;
384 }
385 #endif
386 
387 #endif
388 #endif
389 
390 

Document ID: Generated on Wed Oct 23 22:25:48 EDT 2013 from SVN revision 132765
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)