VR-Link API Documentation for HLA 4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
baseEntityDecoder.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1992-2026 MAK Technologies, Inc
3 ** All rights reserved.
4 *********************************************************************/
5 
6 
7 #ifndef DtBaseEntityDecoder_H_
8 #define DtBaseEntityDecoder_H_
9 
10 #if DtHLA
11 
12 #include "hlaStateDecoder.h"
13 
17 
20 
23 #define DtDECLARE_ENTITY_ATTR_DECODER(attrName) \
24  DtDECLARE_ATTR_DECODER(DtEntityStateRepository, attrName)
25 
28 #define DtDECLARE_AGGREGATE_ATTR_DECODER(attrName) \
29  DtDECLARE_ATTR_DECODER(DtAggregateStateRepository, attrName)
30 
33 #define DtDECLARE_BASE_ENTITY_ATTR_DECODER(attrName) \
34  DtDECLARE_ATTR_DECODER(DtBaseEntityStateRepository, attrName)
35 
36 
42 {
43 public:
44 
47  DtExerciseConn* exConn,
48  DtObjClassDesc* classDesc);
49 
51  virtual ~DtBaseEntityDecoder();
52 
55 
58 
60  virtual DtHlaStateDecoder* clone() const;
61 
66  virtual DtHlaStateDecoder* clone(DtObjClassDesc* classDesc) const;
67 
69  static DtHlaStateDecoder* create(
70  DtExerciseConn* exConn, DtObjClassDesc* classDesc);
71 
72 protected:
73 
77  void addMyDecoders();
78 
81  virtual void decode(const DtStateMsg& msg, DtStateRepository* stateRep) const;
82 
84 
87  DtDECLARE_BASE_ENTITY_ATTR_DECODER(RelativeSpatial);
89 
91  DtDECLARE_BASE_ENTITY_ATTR_DECODER(IsPartOf_RPR_20014);
92 
94  DtDECLARE_BASE_ENTITY_ATTR_DECODER(AccelerationVector);
95  DtDECLARE_BASE_ENTITY_ATTR_DECODER(AngularVelocityVector);
99  DtDECLARE_BASE_ENTITY_ATTR_DECODER(VelocityVector);
100 
105 
107  DtDECLARE_BASE_ENTITY_ATTR_DECODER(DeadReckoningAlgorithm);
108  DtDECLARE_BASE_ENTITY_ATTR_DECODER(WorldLocation);
109  DtDECLARE_BASE_ENTITY_ATTR_DECODER(EntityIdentifier);
110 };
111 
117 #define DtDEFINE_SIMPLE_BASE_ENTITY_ATTR_DECODER_WITH_CAST( \
118  attrName, netType, mutator, castExpr) \
119  DtDEFINE_SIMPLE_ATTR_DECODER_WITH_CAST( \
120  DtBaseEntityDecoder, DtBaseEntityStateRepository, \
121  attrName, netType, mutator, castExpr)
122 
123 #define DtDEFINE_SIMPLE_BASE_ENTITY_ATTR_DECODER( \
124  attrName, netType, inspector) \
125  DtDEFINE_SIMPLE_BASE_ENTITY_ATTR_DECODER_WITH_CAST( \
126  attrName, netType, inspector, (netType))
127 
134 #define DtDEFINE_SIMPLE_BASE_ENTITY_ATTR_DECODER_MUTATOR_WITH_TIME( \
135  attrName, netType, mutator) \
136 void DtBaseEntityDecoder::decode##attrName( \
137  DtBaseEntityStateRepository* stateRep, \
138  const RTI::AttributeHandleValuePairSet& attrs, \
139  int index) \
140 { \
141  RTI::ULong length = attrs.getValueLength(index); \
142  if (length < sizeof(netType)) \
143  { \
144  DtWarn("Cannot decode attribute %s.\n" \
145  "Size of data (%d) is smaller than size of %s (%d).\n", \
146  #attrName, length, #netType, sizeof(netType)); \
147  return; \
148  } \
149  else if (length > sizeof(netType) && DtNotifyLevel >= DtNlVerbose) \
150  { \
151  DtVerbose("When decoding attribute %s,\n" \
152  "found size of data (%d) is larger than size of %s (%d).\n", \
153  #attrName, length, #netType, sizeof(netType)); \
154  return; \
155  } \
156  netType netVal; \
157  attrs.getValue(index, (char*) &netVal, length); \
158  stateRep->mutator(netVal, stateRep->timeForSets()); \
159 }
160 
161 #endif
162 #endif
163 
164 
165 
Instances of DtExerciseConn are used to provide an application&#39;s interface or connection to the netwo...
Definition: exerciseConnHLA.h:62
#define DT_DLL_VL
Definition: vlMachineTypes.h:120
Instances of DtBaseEntityDecoder are used to decode a base entity state message into a state reposito...
Definition: baseEntityDecoder.h:41
Instances of DtBaseEntityStateRepository are used to maintain basic state information needed by all k...
Definition: baseEntityStateRepository.h:36
#define DtDECLARE_BASE_ENTITY_ATTR_DECODER(attrName)
This is used to declare attribute decoding functions which are members of the class.
Definition: baseEntityDecoder.h:33
An instance of DtObjClassDesc is a &quot;class descriptor&quot; for an HLA Object class.
Definition: objClassDesc13.h:41
Instances of DtEntityStateRepository are used to maintain attributes and state of entity objects in a...
Definition: entityStateRepository.h:42
DtHlaStateDecoder is used to provide decoding of a state message into a state repository in an HLA (a...
Definition: hlaStateDecoder.h:34
DtStateRepository is an abstract base class for maintaining state for an object.
Definition: stateRepository.h:50
DtHlaStateDecoder & operator=(const DtHlaStateDecoder &orig)
assignment operator
virtual DtHlaStateDecoder * clone() const
Returns a new-ed clone of this object.
virtual void decode(const DtStateMsg &msg, DtStateRepository *stateRep) const
Decode the state message into the state repository.
class DtStateMsg:
Definition: stateMsgHLA.h:32
This file contains the declaration of DtHlaStateDecoder.

Document ID: Generated on Mon Sep 28 00:09:32 EDT 2026 from SVN revision 295353
Copyright © 1992-2025 MAK Technologies. All Rights Reserved (www.mak.com)