VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 #include <vl/interClassDesc.h>
21 
22 
23 class DT_DLL_VL DtInterClassDesc;
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 
151 #if DtHLA_1516
152  virtual const RTI::RegionHandleSet* conveyedRegion() const;
153  virtual void setConveyedRegion(const RTI::RegionHandleSet* sentRegionHandleSet);
154 #else
155  virtual const RTI::Region* conveyedRegion() const;
156  virtual void setConveyedRegion(const RTI::Region* region);
157 #endif
158 
159 #if DtHLA_1516_EVOLVED
160 
161 
162 
163 
164 
165  virtual void setProducingFederateHandle(RTI::FederateHandle federateHandle);
166 
168  virtual RTI::FederateHandle producingFederateHandle() const;
169 
172  virtual const DtString& producingFederateName() const;
173 #endif
174 
175 
179  virtual void setTimeStamp(DtTime time,
181 
184  virtual DtTime timeStamp() const;
185 
187  virtual DtTimeStampType timeStampType() const;
188 
193  virtual DtTime guessTimeValid(DtTime referenceTime) const;
194 
199 #if DtHLA_1516
200  virtual void setFedTime(const RTI::LogicalTime &ft);
201 #else
202  virtual void setFedTime(const RTI::FedTime &ft);
203 #endif
204 
208 #if DtHLA_1516
209  virtual const RTI::LogicalTime *fedTime() const;
210 #else
211  virtual const RTI::FedTime *fedTime() const;
212 #endif
213 
214 #if DtHLA_1516
215 
216 
217  virtual void setMessageRetractionHandle(const RTI::MessageRetractionHandle &handle);
218 
220  virtual RTI::MessageRetractionHandle messageRetractionHandle() const;
221 
222 #else
223 
224 
225  virtual void setEventRetractionHandle(const RTI::EventRetractionHandle &handle);
226 
228  virtual RTI::EventRetractionHandle eventRetractionHandle() const;
229 #endif
230 
231 
232 public:
233 
237  static void setTagIsAsciiTime(bool val);
238  static bool tagIsAsciiTime();
239 
242  static void addCallback(DtExerciseConn* conn,
243  const DtList* classes, DtReceiveInteractionCb cb, void* usr,
244  DtDDMRegionSP region = DtDDMRegionSP());
245  static void removeCallback(DtExerciseConn* conn,
246  const DtList* classes, DtReceiveInteractionCb cb, void* usr,
247  DtDDMRegionSP region = DtDDMRegionSP());
248 
250  static void addCallback(DtExerciseConn* conn,
251  const char* className, DtReceiveInteractionCb cb, void* usr,
252  DtDDMRegionSP region = DtDDMRegionSP());
253  static void removeCallback(DtExerciseConn* conn,
254  const char* className, DtReceiveInteractionCb cb, void* usr,
255  DtDDMRegionSP region = DtDDMRegionSP());
256 
257 protected:
258 
261  virtual char* interactionClassToUse(
262  DtExerciseConn* exConn) const;
263 
267 #if DtHLA_1516
268  virtual RTI::ParameterHandleValueMap &privPvList() const;
269 #else
270  virtual RTI::ParameterHandleValuePairSet* privPvList() const;
271 #endif
272 
280  DtInteraction* self() const;
281 
282 protected:
283 
284  DtInterClassDesc* myClassDesc;
285  DtExerciseConn* myExConn;
286  DtTime myTime;
287  DtTimeStampType myTimeType;
288 
289 #if DtHLA_1516
290  RTI::LogicalTime *myFedTime;
291  RTI::ParameterHandleValueMap myPvList;
292  RTI::MessageRetractionHandle myRetractionHandle;
293  RTI::VariableLengthData myTag;
294  const RTI::RegionHandleSet* myConveyedRegion;
295 #if DtHLA_1516_EVOLVED
296  mutable DtString myProducingFederateName;
297  RTI::FederateHandle myProducingFederateHandle;
298 #endif
299 #else
300  DtString myTag;
301  RTI::ParameterHandleValuePairSet* myPvList;
302  int myPvListMaxSize;
303  RTI::FedTime *myFedTime;
304  RTI::EventRetractionHandle myRetractionHandle;
305  const RTI::Region* myConveyedRegion;
306 #endif
307 
308  bool myCustomTagSet;
309 
310 
311 protected:
312 
313  static bool theTagIsAsciiTime;
314 };
315 
316 DT_DLL_VL std::ostream & operator << (std::ostream &str, const DtInteraction &inter);
317 
318 inline RTI::InteractionClassHandle
319  DtInteraction::interactionClassHandle() const
320 {
321  return myClassDesc->handle();
322 }
323 
324 inline char* DtInteraction::interactionClassName() const
325 {
326  return (char*) (myClassDesc ? myClassDesc->name() : 0);
327 }
328 
329 inline int DtInteraction::numParameters() const
330 {
331  return myClassDesc ? myClassDesc->numParameters() : 0;
332 }
333 
334 inline DtInteraction* DtInteraction::self() const
335 {
336  return (DtInteraction*) this;
337 }
338 
339 inline DtExerciseConn* DtInteraction::exerciseConn() const
340 {
341  return myExConn;
342 }
343 
344 inline DtInterClassDesc* DtInteraction::classDesc() const
345 {
346  return myClassDesc;
347 }
348 
349 inline void DtInteraction::printData() const
350 {
351 }
352 
353 inline void DtInteraction::printDataToString(DtString& buff) const
354 {
355 }
356 
357 inline void DtInteraction::printDataToStream(std::ostream& stream) const
358 {
359 }
360 
361 #if DtHLA_1516
362 inline void DtInteraction::setMessageRetractionHandle(
363  const RTI::MessageRetractionHandle &handle)
364 {
365  myRetractionHandle = handle;
366 }
367 
368 inline RTI::MessageRetractionHandle DtInteraction::messageRetractionHandle() const
369 {
370  return myRetractionHandle;
371 }
372 
373 #else
374 inline void DtInteraction::setEventRetractionHandle(
375  const RTI::EventRetractionHandle &handle)
376 {
377  myRetractionHandle = handle;
378 }
379 
380 inline RTI::EventRetractionHandle DtInteraction::eventRetractionHandle() const
381 {
382  return myRetractionHandle;
383 }
384 #endif
385 
386 #endif
387 #endif
388 
389 

Document ID: Generated on Wed Jan 7 13:31:29 EST 2015 from SVN revision 149162
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)