VR-Link API Documentation for HLA 1.3
hInteraction.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1992-2010 VT MAK
3 ** All rights reserved.
4 *********************************************************************/
5 
6 #ifndef hInteraction_H_
7 #define hInteraction_H_
8 
9 
10 
11 #if DtHLA
12 
13 
14 
15 #include "recIntrCbInfo.h"
16 #include "region.h"
17 
18 #include <vlutil/vlTimeStampType.h>
19 #include <vlutil/vlTime.h>
20 #include <vlutil/vlString.h>
21 
22 
25 class DT_DLL_VL DtList;
26 
34 {
35 public:
36 
38  DtInteraction();
39 
41  virtual ~DtInteraction();
42 
44  DtInteraction(const DtInteraction& orig);
45 
47  DtInteraction& operator=(const DtInteraction& orig);
48 
49 #if DtHLA_1516
50 
51  virtual const RTI::ParameterHandleValueMap& phvm() const = 0;
52 #else
53 
54  virtual const RTI::ParameterHandleValuePairSet& phvps() const = 0;
55 #endif
56 
57 #if DtHLA_1516
58 
59  virtual void setFromPhvm(const RTI::ParameterHandleValueMap& pvList)=0;
60 #else
61 
62  virtual void setFromPhvps(const RTI::ParameterHandleValuePairSet& pvList)=0;
63 #endif
64 
73  virtual void setExConn(DtExerciseConn* exConn,
74  DtInterClassDesc* classDesc = 0);
75 
77  virtual RTI::InteractionClassHandle interactionClassHandle() const;
78 
80  virtual char* interactionClassName() const;
81 
83  virtual int numParameters() const;
84 
87  virtual bool neededByFederation() const;
88 
90  virtual void print() const;
91 
93  virtual void printToStream(std::ostream& stream) const;
94 
96  virtual void printHeader() const;
97 
99  virtual void printHeaderToStream(std::ostream& stream) const;
100 
102  virtual void printData() const;
103 
105  virtual void printDataToString(DtString& buff) const;
106 
108  virtual void printDataToStream(std::ostream& stream) const;
109 
111  virtual void printParams(bool withHex) const;
112 
114  virtual void printParamsToStream(std::ostream& stream, bool withHex) const;
115 
117  virtual const char* name() const = 0;
118 
120  virtual DtExerciseConn* exerciseConn() const;
121 
124  virtual DtInterClassDesc* classDesc() const;
125 
127  virtual bool customTagSet() const;
128 
129 
130 #if DtHLA_1516
131 
132  virtual void setCustomTag(const RTI::VariableLengthData& a_tag);
134  virtual void setTag(const RTI::VariableLengthData& tag);
136  virtual const RTI::VariableLengthData &tag() const;
137 #else
138 
139  virtual void setCustomTag(const DtString& a_tag);
141  virtual void setTag(const DtString& tag);
143  virtual const DtString& tag() const;
144 #endif
145 
146 
147 #if DtHLA_1516
148  virtual const std::set<DtDDMRegion>* region() const;
149  virtual void setRegion(const std::set<DtDDMRegion>& region);
150 #else
151  virtual const DtDDMRegion* region() const;
152  virtual DtDDMRegion* region();
153  virtual void setRegion(const DtDDMRegion& region);
154 #endif
155 
156 #if DtHLA_1516_EVOLVED
157  virtual const DtString& producingFederate() const;
158  virtual void setProducingFederate(const DtString& fedName);
159 #endif
160 
161 
165  virtual void setTimeStamp(DtTime time,
167 
170  virtual DtTime timeStamp() const;
171 
173  virtual DtTimeStampType timeStampType() const;
174 
179  virtual DtTime guessTimeValid(DtTime referenceTime) const;
180 
185 #if DtHLA_1516
186  virtual void setFedTime(const RTI::LogicalTime &ft);
187 #else
188  virtual void setFedTime(const RTI::FedTime &ft);
189 #endif
190 
194 #if DtHLA_1516
195  virtual const RTI::LogicalTime *fedTime() const;
196 #else
197  virtual const RTI::FedTime *fedTime() const;
198 #endif
199 
200 #if DtHLA_1516
201 
202 
203  virtual void setMessageRetractionHandle(const RTI::MessageRetractionHandle &handle);
204 
206  virtual RTI::MessageRetractionHandle messageRetractionHandle() const;
207 
208 #else
209 
210 
211  virtual void setEventRetractionHandle(const RTI::EventRetractionHandle &handle);
212 
214  virtual RTI::EventRetractionHandle eventRetractionHandle() const;
215 #endif
216 
217 
218 public:
219 
223  static void setTagIsAsciiTime(bool val);
224  static bool tagIsAsciiTime();
225 
228  static void addCallback(DtExerciseConn* conn,
229  const DtList* classes, DtReceiveInteractionCb cb, void* usr,
230  DtDDMRegionSP region = DtDDMRegionSP());
231  static void removeCallback(DtExerciseConn* conn,
232  const DtList* classes, DtReceiveInteractionCb cb, void* usr,
233  DtDDMRegionSP region = DtDDMRegionSP());
234 
236  static void addCallback(DtExerciseConn* conn,
237  const char* className, DtReceiveInteractionCb cb, void* usr,
238  DtDDMRegionSP region = DtDDMRegionSP());
239  static void removeCallback(DtExerciseConn* conn,
240  const char* className, DtReceiveInteractionCb cb, void* usr,
241  DtDDMRegionSP region = DtDDMRegionSP());
242 
243 protected:
244 
247  virtual char* interactionClassToUse(
248  DtExerciseConn* exConn) const;
249 
253 #if DtHLA_1516
254  virtual RTI::ParameterHandleValueMap &privPvList() const;
255 #else
256  virtual RTI::ParameterHandleValuePairSet* privPvList() const;
257 #endif
258 
266  DtInteraction* self() const;
267 
268 protected:
269 
274 
275 #if DtHLA_1516
276  RTI::LogicalTime *myFedTime;
277  RTI::ParameterHandleValueMap myPvList;
278  RTI::MessageRetractionHandle myRetractionHandle;
279  RTI::VariableLengthData myTag;
280  std::set<DtDDMRegion>* myRegion;
281  #if DtHLA_1516_EVOLVED
282  DtString myProducingFederate;
283  #endif
284 #else
286  RTI::ParameterHandleValuePairSet* myPvList;
288  RTI::FedTime *myFedTime;
289  RTI::EventRetractionHandle myRetractionHandle;
291 #endif
292 
294 
295 
296 protected:
297 
298  static bool theTagIsAsciiTime;
299 };
300 
301 DT_DLL_VL std::ostream & operator << (std::ostream &str, const DtInteraction &inter);
302 
303 #include "intClassDesc.h"
304 
305 inline RTI::InteractionClassHandle
307 {
308  return myClassDesc->handle();
309 }
310 
312 {
313  return (char*) (myClassDesc ? myClassDesc->name() : 0);
314 }
315 
317 {
318  return myClassDesc ? myClassDesc->numParameters() : 0;
319 }
320 
322 {
323  return (DtInteraction*) this;
324 }
325 
327 {
328  return myExConn;
329 }
330 
332 {
333  return myClassDesc;
334 }
335 
336 inline void DtInteraction::printData() const
337 {
338 }
339 
341 {
342 }
343 
344 inline void DtInteraction::printDataToStream(std::ostream& stream) const
345 {
346 }
347 
348 #if DtHLA_1516
349 inline void DtInteraction::setMessageRetractionHandle(
350  const RTI::MessageRetractionHandle &handle)
351 {
352  myRetractionHandle = handle;
353 }
354 
355 inline RTI::MessageRetractionHandle DtInteraction::messageRetractionHandle() const
356 {
357  return myRetractionHandle;
358 }
359 
360 #else
362  const RTI::EventRetractionHandle &handle)
363 {
364  myRetractionHandle = handle;
365 }
366 
367 inline RTI::EventRetractionHandle DtInteraction::eventRetractionHandle() const
368 {
369  return myRetractionHandle;
370 }
371 #endif
372 
373 #endif
374 #endif
375 
376 

Document ID: Generated on Wed Aug 14 15:35:11 EDT 2013 from SVN revision 130445
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)