KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Aggregate_State_PDU.h
Go to the documentation of this file.
1 /*********************************************************************
2 Copyright 2013 Karl Jones
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7 
8 1. Redistributions of source code must retain the above copyright notice, this
9  list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright notice,
11  this list of conditions and the following disclaimer in the documentation
12  and/or other materials provided with the distribution.
13 
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 
25 For Further Information Please Contact me at
26 Karljj1@yahoo.com
27 http://p.sf.net/kdis/UserGuide
28 *********************************************************************/
29 
30 /********************************************************************
31  class: Aggregate_State_PDU
32  DIS: (6) 1278.1A - 1998
33  created: 07/02/2009
34  author: Karl Jones
35 
36  purpose: Contains detailed information about aggregating entities.
37  size: 1088 bits / 136 octets - min size
38 *********************************************************************/
39 
40 #pragma once
41 
42 #include "./../Header.h"
43 #include "./../../DataTypes/AggregateIdentifier.h"
44 #include "./../../DataTypes/AggregateType.h"
45 #include "./../../DataTypes/AggregateMarking.h"
46 #include "./../../DataTypes/Vector.h"
47 #include "./../../DataTypes/EulerAngles.h"
48 #include "./../../DataTypes/WorldCoordinates.h"
49 #include "./../../DataTypes/EntityIdentifier.h"
50 #include "./../../DataTypes/SilentAggregateSystem.h"
51 #include "./../../DataTypes/SilentEntitySystem.h"
52 #include "./../../DataTypes/VariableDatum.h"
53 #include <vector>
54 
55 namespace KDIS {
56 namespace PDU {
57 
59 {
60 protected:
61 
63 
65 
67 
69 
71 
73 
75 
77 
79 
81 
83 
85 
87 
89 
90  std::vector<KDIS::DATA_TYPE::AggregateIdentifier> m_vAI;
91 
92  std::vector<KDIS::DATA_TYPE::EntityIdentifier> m_vEI;
93 
96 
97  std::vector<KDIS::DATA_TYPE::SilentAggregateSystem> m_vSASL;
98 
99  std::vector<KDIS::DATA_TYPE::SilentEntitySystem> m_vSESL;
100 
102 
103  std::vector<KDIS::DATA_TYPE::VarDtmPtr> m_vVD;
104 
105  //************************************
106  // FullName: KDIS::PDU::Aggregate_State_PDU::calcPadding
107  //!Description: Calculates the padding so the PDU lies on a 32 bit boundary.
108  //************************************
109  void calcPadding();
110 
111 public:
112 
113  static const KUINT16 AGGREGATE_STATE_PDU_SIZE = 136; // Min size
114 
116 
117  Aggregate_State_PDU( KDataStream & stream ) throw( KException );
118 
119  Aggregate_State_PDU( const Header & H, KDataStream & stream ) throw( KException );
120 
123  const KDIS::DATA_TYPE::Vector & Dimensions, const KDIS::DATA_TYPE::EulerAngles & Orientation,
124  const KDIS::DATA_TYPE::WorldCoordinates & CenterOfMass, const KDIS::DATA_TYPE::Vector & Velocity );
125 
126  virtual ~Aggregate_State_PDU();
127 
128  //************************************
129  // FullName: KDIS::PDU::Aggregate_State_PDU::SetAggregateIdentifier
130  // KDIS::PDU::Aggregate_State_PDU::GetAggregateIdentifier
131  //!Description: ID of the aggregate issuing the PDU.
132  // Parameter: const AggregateIdentifier & AI
133  //************************************
134  void SetAggregateIdentifier( const KDIS::DATA_TYPE::AggregateIdentifier & AI );
135  const KDIS::DATA_TYPE::AggregateIdentifier & GetAggregateIdentifier() const;
136  KDIS::DATA_TYPE::AggregateIdentifier & GetAggregateIdentifier();
137 
138  //************************************
139  // FullName: KDIS::PDU::Aggregate_State_PDU::SetForceID
140  // KDIS::PDU::Aggregate_State_PDU::GetForceID
141  //!Description: Force ID of the aggregate, aggregates of opposing forces
142  //! may not group together.
143  // Parameter: ForceID ID
144  //************************************
145  void SetForceID( KDIS::DATA_TYPE::ENUMS::ForceID ID );
146  KDIS::DATA_TYPE::ENUMS::ForceID GetForceID() const;
147 
148  //************************************
149  // FullName: KDIS::PDU::Aggregate_State_PDU::SetAggregateState
150  // KDIS::PDU::Aggregate_State_PDU::GetAggregateState
151  //!Description: Aggregate state enumeration.
152  // Parameter: AggregateState AS
153  //************************************
154  void SetAggregateState( KDIS::DATA_TYPE::ENUMS::AggregateState AS );
155  KDIS::DATA_TYPE::ENUMS::AggregateState GetAggregateState() const;
156 
157  //************************************
158  // FullName: KDIS::PDU::Aggregate_State_PDU::SetAggregateType
159  // KDIS::PDU::Aggregate_State_PDU::GetAggregateType
160  //!Description: Aggregate type enumerations.
161  // Parameter: const AggregateType & Type
162  //************************************
163  void SetAggregateType( const KDIS::DATA_TYPE::AggregateType & Type );
164  const KDIS::DATA_TYPE::AggregateType & GetAggregateType() const;
165  KDIS::DATA_TYPE::AggregateType & GetAggregateType();
166 
167  //************************************
168  // FullName: KDIS::PDU::Aggregate_State_PDU::SetFormation
169  // KDIS::PDU::Aggregate_State_PDU::GetFormation
170  //!Description: Aggregate formation.
171  // Parameter: Formation F
172  //************************************
173  void SetFormation( KDIS::DATA_TYPE::ENUMS::Formation F );
174  KDIS::DATA_TYPE::ENUMS::Formation GetFormation() const;
175 
176  //************************************
177  // FullName: KDIS::PDU::Aggregate_State_PDU::SetAggregateMarking
178  // KDIS::PDU::Aggregate_State_PDU::GetAggregateMarking
179  //!Description: Aggregate marking.
180  // Parameter: const AggregateMarking & AM
181  //************************************
182  void SetAggregateMarking( const KDIS::DATA_TYPE::AggregateMarking & AM );
183  const KDIS::DATA_TYPE::AggregateMarking & GetAggregateMarking() const;
184  KDIS::DATA_TYPE::AggregateMarking & GetAggregateMarking();
185 
186  //************************************
187  // FullName: KDIS::PDU::Aggregate_State_PDU::SetAggregateDimensions
188  // KDIS::PDU::Aggregate_State_PDU::GetAggregateDimensions
189  //!Description: Identifies the bounding space, in meters, that the aggregate
190  //! occupies. These measurements are taken along the orientation
191  //! axes of the aggregate. Measurements X, Y, and Z are taken from
192  //! the center of mass of the aggregate to the shortest distance
193  //! along an axis in the positive or negative direction that includes
194  //! all of the constituent entities. See fig 38 from IEEE 1278.1A-1998.
195  // Parameter: const Vector & AD
196  //************************************
197  void SetAggregateDimensions( const KDIS::DATA_TYPE::Vector & AD );
198  const KDIS::DATA_TYPE::Vector & GetAggregateDimensions() const;
199  KDIS::DATA_TYPE::Vector & GetAggregateDimensions();
200 
201  //************************************
202  // FullName: KDIS::PDU::Aggregate_State_PDU::SetAggregateOrientation
203  // KDIS::PDU::Aggregate_State_PDU::GetAggregateOrientation
204  //!Description: Orientation of the aggregate.
205  //! Calculated by taking the average orientation of its
206  //! constituent entities.
207  // Parameter: const EulerAngles & AO
208  //************************************
209  void SetAggregateOrientation( const KDIS::DATA_TYPE::EulerAngles & AO );
210  const KDIS::DATA_TYPE::EulerAngles & GetAggregateOrientation() const;
211  KDIS::DATA_TYPE::EulerAngles & GetAggregateOrientation();
212 
213  //************************************
214  // FullName: KDIS::PDU::Aggregate_State_PDU::SetCenterOfMassLocation
215  // KDIS::PDU::Aggregate_State_PDU::GetCenterOfMassLocation
216  //!Description: Location of the aggregate�s center of mass in the simulated world.
217  // Parameter: const WorldCoordinates & COML
218  //************************************
219  void SetCenterOfMassLocation( const KDIS::DATA_TYPE::WorldCoordinates & COML );
220  const KDIS::DATA_TYPE::WorldCoordinates & GetCenterOfMassLocation() const;
221  KDIS::DATA_TYPE::WorldCoordinates & GetCenterOfMassLocation();
222 
223  //************************************
224  // FullName: KDIS::PDU::Aggregate_State_PDU::SetAggregateVelocity
225  // KDIS::PDU::Aggregate_State_PDU::GetAggregateVelocity
226  //!Description: Specifies an aggregate�s linear velocity.
227  //! The coordinate system for an aggregate�s linear velocity depends
228  //! on the dead reckoning algorithm used.
229  //! Represented by a Linear Velocity Vector.
230  //! An aggreagte�s velocity is calculated by taking the average velocity
231  //! of its constituent entities. The velocity of the aggregate is
232  //! directed from the center of mass. See fig 39 from IEEE 1278.1A-1998.
233  // Parameter: const Vector & V
234  //************************************
235  void SetAggregateVelocity( const KDIS::DATA_TYPE::Vector & V );
236  const KDIS::DATA_TYPE::Vector & GetAggregateVelocity() const;
237  KDIS::DATA_TYPE::Vector & GetAggregateVelocity();
238 
239  //************************************
240  // FullName: KDIS::PDU::Aggregate_State_PDU::GetNumberOfDISAggregates
241  //!Description: Number of sub-aggregates that are transmitting Aggregate State PDUs.
242  //************************************
243  KUINT16 GetNumberOfDISAggregates() const;
244 
245  //************************************
246  // FullName: KDIS::PDU::Aggregate_State_PDU::GetNumberOfDISEntities
247  //!Description: Number of constituent entities that are transmitting Entity State PDUs.
248  //************************************
249  KUINT16 GetNumberOfDISEntities() const;
250 
251  //************************************
252  // FullName: KDIS::PDU::Aggregate_State_PDU::GetNumberOfSilentAggregateTypes
253  //!Description: Number of sub aggregates that are not transmitting Aggregate State PDUs.
254  //************************************
255  KUINT16 GetNumberOfSilentAggregateTypes() const;
256 
257  //************************************
258  // FullName: KDIS::PDU::Aggregate_State_PDU::GetNumberOfSilentEntityTypes
259  //!Description: Number of constituent entity systems that are not transmitting Entity State PDUs.
260  //************************************
261  KUINT16 GetNumberOfSilentEntityTypes() const;
262 
263  //************************************
264  // FullName: KDIS::PDU::Aggregate_State_PDU::AddAggregateID
265  // KDIS::PDU::Aggregate_State_PDU::SetAggregateID
266  // KDIS::PDU::Aggregate_State_PDU::GetAggregateIDs
267  //!Description: Identify sub aggregates that are transmitting Aggregate State PDUs.
268  // Parameter: const AggregateIdentifier & AI, const vector<AggregateIdentifier> & AI
269  //************************************
270  void AddAggregateID( const KDIS::DATA_TYPE::AggregateIdentifier & AI );
271  void SetAggregateIDList( const std::vector<KDIS::DATA_TYPE::AggregateIdentifier> & AI );
272  const std::vector<KDIS::DATA_TYPE::AggregateIdentifier> & GetAggregateIDList() const;
273 
274  //************************************
275  // FullName: KDIS::PDU::Aggregate_State_PDU::AddEntityID
276  // KDIS::PDU::Aggregate_State_PDU::SetEntityIDList
277  // KDIS::PDU::Aggregate_State_PDU::GetEntityIDList
278  //!Description: Identifies the constituent entities that are
279  //! transmitting Entity State PDUs.
280  // Parameter: const EntityIdentifier & EI, const vector<EntityIdentifier> & EI
281  //************************************
282  void AddEntityID( const KDIS::DATA_TYPE::EntityIdentifier & EI );
283  void SetEntityIDList( const std::vector<KDIS::DATA_TYPE::EntityIdentifier> & EI );
284  const std::vector<KDIS::DATA_TYPE::EntityIdentifier> & GetEntityIDList() const;
285 
286  //************************************
287  // FullName: KDIS::PDU::Aggregate_State_PDU::AddSilentAggregateSystem
288  // KDIS::PDU::Aggregate_State_PDU::GetSilentAggregateSystemList
289  // KDIS::PDU::Aggregate_State_PDU::GetSilentAggregateSystemList
290  //!Description: Contains information about sub aggregates not producing
291  //! Aggregate State PDUs.
292  // Parameter: const SilentAggregateSystem & SAS, const vector<SilentAggregateSystem> & SAS
293  //************************************
294  void AddSilentAggregateSystem( const KDIS::DATA_TYPE::SilentAggregateSystem & SAS );
295  void SetSilentAggregateSystemList( const std::vector<KDIS::DATA_TYPE::SilentAggregateSystem> & SAS );
296  const std::vector<KDIS::DATA_TYPE::SilentAggregateSystem> & GetSilentAggregateSystemList() const;
297 
298  //************************************
299  // FullName: KDIS::PDU::Aggregate_State_PDU::AddSilentEntitySystem
300  // KDIS::PDU::Aggregate_State_PDU::GetSilentEntitySystemList
301  // KDIS::PDU::Aggregate_State_PDU::GetSilentEntitySystemList
302  //!Description: Contains information about entities not producing
303  //! Entity State PDUs.
304  // Parameter: const SilentEntitySystem & SES, const vector<SilentEntitySystem> & SES
305  //************************************
306  void AddSilentEntitySystem( const KDIS::DATA_TYPE::SilentEntitySystem & SES );
307  void SetSilentEntitySystemList( const std::vector<KDIS::DATA_TYPE::SilentEntitySystem> & SES );
308  const std::vector<KDIS::DATA_TYPE::SilentEntitySystem> & GetSilentEntitySystemList() const;
309 
310  //************************************
311  // FullName: KDIS::PDU::Aggregate_State_PDU::GetNumberOfVariableDatums
312  //!Description: Number of variable datum records.
313  //************************************
314  KUINT32 GetNumberOfVariableDatums() const;
315 
316  //************************************
317  // FullName: KDIS::PDU::Aggregate_State_PDU::AddVariableDatum
318  // KDIS::PDU::Aggregate_State_PDU::GetVariableDatumList
319  // KDIS::PDU::Aggregate_State_PDU::GetVariableDatumList
320  // KDIS::PDU::Aggregate_State_PDU::ClearVariableDatumList
321  //!Description: Specifies extra data that is used by the entity-level and
322  //! aggregate-level simulations to transfer control and correlate the
323  //! simulation of entities in an aggregate.
324  //! The contents of these records shall be determined before
325  //! each exercise.
326  //! The first Variable Datum record may be used to indicate a flag that
327  //! tells that the composition or formation of the unit has changed.
328  // Parameter: VarDtmPtr VD, const vector<VarDtmPtr> & VD
329  //************************************
330  void AddVariableDatum( KDIS::DATA_TYPE::VarDtmPtr VD );
331  void SetVariableDatumList( const std::vector<KDIS::DATA_TYPE::VarDtmPtr> & VD );
332  const std::vector<KDIS::DATA_TYPE::VarDtmPtr> & GetVariableDatumList() const;
333  void ClearVariableDatumList();
334 
335  //************************************
336  // FullName: KDIS::PDU::Aggregate_State_PDU::GetAsString
337  //!Description: Returns a string representation of the PDU.
338  //************************************
339  virtual KString GetAsString() const;
340 
341  //************************************
342  // FullName: KDIS::PDU::Aggregate_State_PDU::Decode
343  //!Description: Convert From Network Data.
344  // Parameter: KDataStream & stream
345  // Parameter: bool ignoreHeader = false - Decode the header from the stream?
346  //************************************
347  virtual void Decode( KDataStream & stream, bool ignoreHeader = false ) throw( KException );
348 
349  //************************************
350  // FullName: KDIS::PDU::Aggregate_State_PDU::Encode
351  //!Description: Convert To Network Data.
352  // Parameter: KDataStream & stream
353  //************************************
354  virtual KDataStream Encode() const;
355  virtual void Encode( KDataStream & stream ) const;
356 
357  KBOOL operator == ( const Aggregate_State_PDU & Value ) const;
358  KBOOL operator != ( const Aggregate_State_PDU & Value ) const;
359 };
360 
361 } // END namespace PDU
362 } // END namespace KDIS
Definition: Aggregate_State_PDU.h:58
unsigned int KUINT32
Definition: KDefines.h:103
Formation
Definition: EnumEntityManagement.h:96
Definition: AggregateIdentifier.h:48
KUINT16 m_ui16NumSilentAggregateTypes
Definition: Aggregate_State_PDU.h:86
KUINT32 m_ui32NumVariableDatum
Definition: Aggregate_State_PDU.h:101
KUINT32 m_ui32Formation
Definition: Aggregate_State_PDU.h:70
unsigned short int KUINT16
Definition: KDefines.h:101
Definition: SilentAggregateSystem.h:49
std::vector< KDIS::DATA_TYPE::SilentEntitySystem > m_vSESL
Definition: Aggregate_State_PDU.h:99
KUINT8 m_ui8ForceID
Definition: Aggregate_State_PDU.h:64
Definition: SilentEntitySystem.h:50
Definition: Vector.h:71
Definition: KDefines.h:182
Definition: KDataStream.h:48
Definition: AggregateMarking.h:48
KUINT16 m_ui16NumAggregates
Definition: Aggregate_State_PDU.h:82
KUINT16 m_ui16NumSilentEntityTypes
Definition: Aggregate_State_PDU.h:88
Definition: WorldCoordinates.h:52
bool KBOOL
Definition: KDefines.h:119
KUINT16 m_ui16NumEntities
Definition: Aggregate_State_PDU.h:84
KDIS::DATA_TYPE::Vector m_Dimensions
Definition: Aggregate_State_PDU.h:74
KDIS::DATA_TYPE::AggregateType m_AggregateType
Definition: Aggregate_State_PDU.h:68
Definition: EulerAngles.h:46
std::string KString
Definition: KDefines.h:116
KDIS::DATA_TYPE::AggregateIdentifier m_AggregateID
Definition: Aggregate_State_PDU.h:62
Definition: EntityIdentifier.h:49
KDIS::DATA_TYPE::AggregateMarking m_AggregateMarking
Definition: Aggregate_State_PDU.h:72
KDIS::DATA_TYPE::WorldCoordinates m_CtrOfMassLoc
Definition: Aggregate_State_PDU.h:78
ForceID
Definition: EnumEntityInfoInteraction.h:886
Definition: Header7.h:142
std::vector< KDIS::DATA_TYPE::AggregateIdentifier > m_vAI
Definition: Aggregate_State_PDU.h:90
unsigned char KUINT8
Definition: KDefines.h:99
AggregateState
Definition: EnumEntityManagement.h:52
std::vector< KDIS::DATA_TYPE::VarDtmPtr > m_vVD
Definition: Aggregate_State_PDU.h:103
KUINT16 m_ui16Padding1
Definition: Aggregate_State_PDU.h:95
std::vector< KDIS::DATA_TYPE::SilentAggregateSystem > m_vSASL
Definition: Aggregate_State_PDU.h:97
#define KDIS_EXPORT
Definition: KDefines.h:82
std::vector< KDIS::DATA_TYPE::EntityIdentifier > m_vEI
Definition: Aggregate_State_PDU.h:92
KUINT8 m_ui8AggState
Definition: Aggregate_State_PDU.h:66
Definition: KRef_Ptr.h:73
KBOOL m_bNeedsPadding
Definition: Aggregate_State_PDU.h:94
KDIS::DATA_TYPE::EulerAngles m_Ori
Definition: Aggregate_State_PDU.h:76
Definition: AggregateType.h:46
KDIS::DATA_TYPE::Vector m_Vel
Definition: Aggregate_State_PDU.h:80