VR-Link API Documentation for HLA 1516
Home
Namespaces
Classes
Files
Examples
Libraries
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
include
vl
baseEntityDecoder.h
Go to the documentation of this file.
1
/*********************************************************************
2
** Copyright (c) 1992-2010 VT MAK
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
18
class
DT_DLL_VL
DtEntityStateRepository
;
19
class
DT_DLL_VL
DtBaseEntityStateRepository
;
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
41
class
DT_DLL_VL
DtBaseEntityDecoder
:
public
DtHlaStateDecoder
42
{
43
public
:
44
46
DtBaseEntityDecoder
(
47
DtExerciseConn
* exConn,
48
DtObjClassDesc
* classDesc);
49
51
virtual
~
DtBaseEntityDecoder
();
52
54
DtBaseEntityDecoder
(
const
DtBaseEntityDecoder
& orig);
55
57
DtBaseEntityDecoder
&
operator=
(
const
DtBaseEntityDecoder
& orig);
58
60
virtual
DtHlaStateDecoder
*
clone
()
const
;
61
66
virtual
DtHlaStateDecoder
*
clone
(
DtObjClassDesc
* classDesc)
const
;
67
68
public
:
69
71
static
DtHlaStateDecoder
* create(
72
DtExerciseConn
* exConn,
73
DtObjClassDesc
* classDesc);
74
75
protected
:
76
80
void
addMyDecoders();
81
84
virtual
void
decode
(
const
DtStateMsg
& msg,
85
DtStateRepository
* stateRep)
const
;
86
88
90
DtDECLARE_BASE_ENTITY_ATTR_DECODER
(Spatial);
91
DtDECLARE_BASE_ENTITY_ATTR_DECODER
(RelativeSpatial);
92
DtDECLARE_BASE_ENTITY_ATTR_DECODER
(IsPartOf);
93
95
DtDECLARE_BASE_ENTITY_ATTR_DECODER
(IsPartOf_RPR_20014);
96
98
DtDECLARE_BASE_ENTITY_ATTR_DECODER
(AccelerationVector);
99
DtDECLARE_BASE_ENTITY_ATTR_DECODER
(AngularVelocityVector);
100
DtDECLARE_BASE_ENTITY_ATTR_DECODER
(EntityType);
101
DtDECLARE_BASE_ENTITY_ATTR_DECODER
(IsFrozen);
102
DtDECLARE_BASE_ENTITY_ATTR_DECODER
(Orientation);
103
DtDECLARE_BASE_ENTITY_ATTR_DECODER
(VelocityVector);
104
106
DtDECLARE_BASE_ENTITY_ATTR_DECODER
(DRAlgorithm);
107
DtDECLARE_BASE_ENTITY_ATTR_DECODER
(Position);
108
DtDECLARE_BASE_ENTITY_ATTR_DECODER
(EntityID);
109
111
DtDECLARE_BASE_ENTITY_ATTR_DECODER
(DeadReckoningAlgorithm);
112
DtDECLARE_BASE_ENTITY_ATTR_DECODER
(WorldLocation);
113
DtDECLARE_BASE_ENTITY_ATTR_DECODER
(EntityIdentifier);
114
};
115
121
#define DtDEFINE_SIMPLE_BASE_ENTITY_ATTR_DECODER_WITH_CAST( \
122
attrName, netType, mutator, castExpr) \
123
DtDEFINE_SIMPLE_ATTR_DECODER_WITH_CAST( \
124
DtBaseEntityDecoder, DtBaseEntityStateRepository, \
125
attrName, netType, mutator, castExpr)
126
127
#define DtDEFINE_SIMPLE_BASE_ENTITY_ATTR_DECODER( \
128
attrName, netType, inspector) \
129
DtDEFINE_SIMPLE_BASE_ENTITY_ATTR_DECODER_WITH_CAST( \
130
attrName, netType, inspector, (netType))
131
138
#define DtDEFINE_SIMPLE_BASE_ENTITY_ATTR_DECODER_MUTATOR_WITH_TIME( \
139
attrName, netType, mutator) \
140
void DtBaseEntityDecoder::decode##attrName( \
141
DtBaseEntityStateRepository* stateRep, \
142
const RTI::AttributeHandleValuePairSet& attrs, \
143
int index) \
144
{ \
145
RTI::ULong length = attrs.getValueLength(index); \
146
if (length < sizeof(netType)) \
147
{ \
148
DtWarn("Cannot decode attribute %s.\n" \
149
"Size of data (%d) is smaller than size of %s (%d).\n", \
150
#attrName, length, #netType, sizeof(netType)); \
151
return; \
152
} \
153
else if (length > sizeof(netType) && DtNotifyLevel >= DtNlVerbose) \
154
{ \
155
DtVerbose("When decoding attribute %s,\n" \
156
"found size of data (%d) is larger than size of %s (%d).\n", \
157
#attrName, length, #netType, sizeof(netType)); \
158
return; \
159
} \
160
netType netVal; \
161
attrs.getValue(index, (char*) &netVal, length); \
162
stateRep->mutator(netVal, stateRep->timeForSets()); \
163
}
164
165
#endif
166
#endif
167
168
169
Document ID: Generated on Fri Dec 2 02:42:08 EST 2016 from SVN revision 171416
Copyright © 2005-2016 VT MÄK. All Rights Reserved (
www.mak.com
)