KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Areal_Object_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: Areal_Object_State_PDU
32  DIS: (6) 1278.1a - 1998
33  created: 17/03/2010
34  author: Karl Jones
35 
36  purpose: An object that is geometrically anchored to the terrain
37  with a set of three or more points that come to a closure.
38 
39  size: 384 bits / 48 octets - Min size.
40 *********************************************************************/
41 
42 #pragma once
43 
44 #include "./Object_State_Header.h"
45 #include "./../../DataTypes/ObjectType.h"
46 #include "./../../DataTypes/SimulationIdentifier.h"
47 #include "./../../DataTypes/ArealObjectAppearance.h"
48 #include "./../../DataTypes/WorldCoordinates.h"
49 #include <vector>
50 
51 namespace KDIS {
52 namespace PDU {
53 
55 {
56 protected:
57 
58  union
59  {
60  struct
61  {
62  KUINT8 m_ui8LocBit : 1;
63  KUINT8 m_ui8Unused : 7;
64  };
65 
67  } m_ModificationUnion;
68 
70 
72 
74 
76 
78 
79  std::vector<KDIS::DATA_TYPE::WorldCoordinates> m_vPoints;
80 
81 public:
82 
83  static const KUINT16 AREAL_OBJECT_STATE_PDU_SIZE = 48;
84 
86 
87  Areal_Object_State_PDU( KDataStream & stream ) throw( KException );
88 
89  Areal_Object_State_PDU( const Header & H, KDataStream & stream ) throw( KException );
90 
92  const KDIS::DATA_TYPE::SimulationIdentifier & RequestorID, const KDIS::DATA_TYPE::SimulationIdentifier & ReceivingID );
93 
96  const std::vector<KDIS::DATA_TYPE::WorldCoordinates> & Points );
97 
98  virtual ~Areal_Object_State_PDU();
99 
100  //************************************
101  // FullName: KDIS::PDU::Areal_Object_State_PDU::SetModification
102  // KDIS::PDU::Areal_Object_State_PDU::GetModification
103  // KDIS::PDU::Areal_Object_State_PDU::SetModificationLocation
104  // KDIS::PDU::Areal_Object_State_PDU::IsModificationLocation
105  //!Description: Identifies whether a modification has been made to the point object�s location .
106  //! Modification is represented by a single 8 bit unsigned int, where
107  //! bit 0 is the location modified flag.
108  //! A value of 1(true) indicates the field has been changed.
109  //! All values are set to false(0) by default.
110  // Parameter: KUINT8 M, KBOOL M = true
111  //************************************
112  void SetModification( KUINT8 M );
113  KUINT8 GetModification() const;
114  void SetModificationLocation( KBOOL M = true );
115  KBOOL IsModificationLocation() const;
116 
117  //************************************
118  // FullName: KDIS::PDU::Areal_Object_State_PDU::SetObjectType
119  // KDIS::PDU::Areal_Object_State_PDU::GetObjectType
120  //!Description: The type of object. Represented as DIS enumeration(domain, kind, Category and sub category).
121  // Parameter: const ObjectType & O
122  //************************************
123  void SetObjectType( const KDIS::DATA_TYPE::ObjectType & O );
124  const KDIS::DATA_TYPE::ObjectType & GetObjectType() const;
125  KDIS::DATA_TYPE::ObjectType & GetObjectType();
126 
127  //************************************
128  // FullName: KDIS::PDU::Areal_Object_State_PDU::SetObjectAppearance
129  // KDIS::PDU::Areal_Object_State_PDU::GetObjectAppearance
130  //!Description: Specifies the dynamic changes to an object�s appearance attributes.
131  // Parameter: const ArealObjectAppearance & A
132  //************************************
133  void SetObjectAppearance( const KDIS::DATA_TYPE::ArealObjectAppearance & A );
134  const KDIS::DATA_TYPE::ArealObjectAppearance & GetObjectAppearance() const;
135  KDIS::DATA_TYPE::ArealObjectAppearance & GetObjectAppearance();
136 
137  //************************************
138  // FullName: KDIS::PDU::Areal_Object_State_PDU::GetNumberOfPoints
139  //!Description: The total number of points making up the areal object.
140  //************************************
141  KUINT16 GetNumberOfPoints() const;
142 
143  //************************************
144  // FullName: KDIS::PDU::Areal_Object_State_PDU::SetRequestorSimulationID
145  // KDIS::PDU::Areal_Object_State_PDU::GetRequestorSimulationID
146  //!Description: The simulation application sending the PDU.
147  // Parameter: const SimulationIdentifier & ID
148  //************************************
149  void SetRequestorSimulationID( const KDIS::DATA_TYPE::SimulationIdentifier & ID );
150  const KDIS::DATA_TYPE::SimulationIdentifier & GetRequestorSimulationID() const;
151  KDIS::DATA_TYPE::SimulationIdentifier & GetRequestorSimulationID();
152 
153  //************************************
154  // FullName: KDIS::PDU::Areal_Object_State_PDU::SetReceivingSimulationID
155  // KDIS::PDU::Areal_Object_State_PDU::GetReceivingSimulationID
156  //!Description: The simulation application that is to receive the PDU.
157  // Parameter: const SimulationIdentifier & ID
158  //************************************
159  void SetReceivingSimulationID( const KDIS::DATA_TYPE::SimulationIdentifier & ID );
160  const KDIS::DATA_TYPE::SimulationIdentifier & GetReceivingSimulationID() const;
161  KDIS::DATA_TYPE::SimulationIdentifier & GetReceivingSimulationID();
162 
163  //************************************
164  // FullName: KDIS::PDU::Areal_Object_State_PDU::AddPoint
165  // KDIS::PDU::Areal_Object_State_PDU::SetPoints
166  // KDIS::PDU::Areal_Object_State_PDU::GetPoints
167  //!Description: Specifies the points that make up the object�s physical location.
168  // Parameter: const WorldCoordinates & P, const vector<WorldCoordinates> & P, void
169  //************************************
170  void AddPoint( const KDIS::DATA_TYPE::WorldCoordinates & P );
171  void SetPoints( const std::vector<KDIS::DATA_TYPE::WorldCoordinates> & P );
172  const std::vector<KDIS::DATA_TYPE::WorldCoordinates> & GetPoints() const;
173 
174  //************************************
175  // FullName: KDIS::PDU::Areal_Object_State_PDU::GetAsString
176  //!Description: Returns a string representation of the PDU.
177  //************************************
178  virtual KString GetAsString() const;
179 
180  //************************************
181  // FullName: KDIS::PDU::Areal_Object_State_PDU::Decode
182  //!Description: Convert From Network Data.
183  // Parameter: KDataStream & stream
184  // Parameter: bool ignoreHeader = false - Decode the header from the stream?
185  //************************************
186  virtual void Decode( KDataStream & stream, bool ignoreHeader = false ) throw( KException );
187 
188  //************************************
189  // FullName: KDIS::PDU::Areal_Object_State_PDU::Encode
190  //!Description: Convert To Network Data.
191  // Parameter: KDataStream & stream
192  //************************************
193  virtual KDataStream Encode() const;
194  virtual void Encode( KDataStream & stream ) const;
195 
196  KBOOL operator == ( const Areal_Object_State_PDU & Value ) const;
197  KBOOL operator != ( const Areal_Object_State_PDU & Value ) const;
198 };
199 
200 } // END namespace PDU
201 } // END namespace KDIS
Definition: ArealObjectAppearance.h:46
Definition: SimulationIdentifier.h:51
Definition: ObjectType.h:47
unsigned short int KUINT16
Definition: KDefines.h:101
KDIS::DATA_TYPE::SimulationIdentifier m_RecvID
Definition: Areal_Object_State_PDU.h:77
KDIS::DATA_TYPE::ObjectType m_ObjTyp
Definition: Areal_Object_State_PDU.h:69
KDIS::DATA_TYPE::SimulationIdentifier m_ReqID
Definition: Areal_Object_State_PDU.h:75
Definition: KDefines.h:182
Definition: KDataStream.h:48
std::vector< KDIS::DATA_TYPE::WorldCoordinates > m_vPoints
Definition: Areal_Object_State_PDU.h:79
KUINT8 m_ui8Modifications
Definition: Areal_Object_State_PDU.h:66
Definition: WorldCoordinates.h:52
bool KBOOL
Definition: KDefines.h:119
std::string KString
Definition: KDefines.h:116
KUINT16 m_ui16NumPoints
Definition: Areal_Object_State_PDU.h:73
Definition: Header7.h:142
unsigned char KUINT8
Definition: KDefines.h:99
#define KDIS_EXPORT
Definition: KDefines.h:82
Definition: Object_State_Header.h:49
KDIS::DATA_TYPE::ArealObjectAppearance m_Apperance
Definition: Areal_Object_State_PDU.h:71
Definition: Areal_Object_State_PDU.h:54