KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IsGroupOf_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: IsGroupOf_PDU
32  DIS: (6) 1278.1A - 1998
33  created: 13:05:2009
34  author: Karl Jones
35 
36  purpose: Contains information about a particular group of
37  entities (grouped together for the purposes of
38  network bandwidth reduction or aggregation).
39  size: 320 bits / 40 octets - min size
40 *********************************************************************/
41 
42 #pragma once
43 
44 #include "./../Header.h"
45 #include "./../../DataTypes/EntityIdentifier.h"
46 #include "./../../DataTypes/GED.h"
47 #include "./../../Extras/KRef_Ptr.h"
48 #include "./../../DataTypes/GED_BasicGroundCombatVehicle.h"
49 #include "./../../DataTypes/GED_EnhancedGroundCombatVehicle.h"
50 #include "./../../DataTypes/GED_BasicGroundCombatSoldier.h"
51 #include "./../../DataTypes/GED_EnhancedGroundCombatSoldier.h"
52 #include "./../../DataTypes/GED_BasicRotorWingAircraft.h"
53 #include "./../../DataTypes/GED_EnhancedRotaryWingAircraft.h"
54 #include "./../../DataTypes/GED_BasicFixedWingAircraft.h"
55 #include "./../../DataTypes/GED_EnhancedFixedWingAircraft.h"
56 #include "./../../DataTypes/GED_GroundLogisticsVehicle.h"
57 
58 namespace KDIS {
59 
60 namespace DATA_TYPE {
61 
62 // Some PDU specific data types.
64 typedef std::vector<GEDItem> GEDList;
65 
66 } // END namespace DATA_TYPE
67 
68 namespace PDU {
69 
75 
77 {
78 protected:
79 
81 
83 
85 
87 
89 
91 
93 
94 public:
95 
96  static const KUINT16 IS_GROUP_OF_PDU_SIZE = 40; // Min size
97 
98  IsGroupOf_PDU();
99 
100  IsGroupOf_PDU( KDataStream & stream ) throw( KException );
101 
102  IsGroupOf_PDU( const Header & H, KDataStream & stream ) throw( KException );
103 
105 
106  IsGroupOf_PDU( const KDIS::DATA_TYPE::EntityIdentifier & EI, KFLOAT64 GrpLatitude, KFLOAT64 GrpLongitude, const KDIS::DATA_TYPE::GEDList & GED ) throw( KException );
107 
108  virtual ~IsGroupOf_PDU();
109 
110  //************************************
111  // FullName: KDIS::PDU::IsGroupOf_PDU::SetGroupedEntityID
112  // KDIS::PDU::IsGroupOf_PDU::GetGroupedEntityID
113  //!Description: The entity that represents the group of entities.
114  // Parameter: const EntityIdentifier & EI
115  //************************************
116  void SetGroupedEntityID( const KDIS::DATA_TYPE::EntityIdentifier & EI );
117  const KDIS::DATA_TYPE::EntityIdentifier & GetGroupedEntityID() const;
118  KDIS::DATA_TYPE::EntityIdentifier & GetGroupedEntityID();
119 
120  //************************************
121  // FullName: KDIS::PDU::IsGroupOf_PDU::SetGroupedEntityCategory
122  // KDIS::PDU::IsGroupOf_PDU::GetGroupedEntityCategory
123  //!Description: Describes the type of entities constituting a group.
124  // Parameter: const GroupedEntityCategor GED
125  //************************************
126  void SetGroupedEntityCategory( KDIS::DATA_TYPE::ENUMS::GroupedEntityCategory GED );
127  KDIS::DATA_TYPE::ENUMS::GroupedEntityCategory GetGroupedEntityCategory() const;
128 
129  //************************************
130  // FullName: KDIS::PDU::IsGroupOf_PDU::GetNumberOfGroupedEntities
131  //!Description: Specifies the number of individual entities
132  //! constituting the group.
133  //************************************
134  KUINT8 GetNumberOfGroupedEntities() const;
135 
136  //************************************
137  // FullName: KDIS::PDU::IsGroupOf_PDU::SetGroupReferencePoint
138  // KDIS::PDU::IsGroupOf_PDU::SetGroupReferencePointLatitude
139  // KDIS::PDU::IsGroupOf_PDU::SetGroupReferencePointLongitude
140  // KDIS::PDU::IsGroupOf_PDU::GetGroupReferencePointLatitude
141  // KDIS::PDU::IsGroupOf_PDU::GetGroupReferencePointLongitude
142  //!Description: Specifies the location of the group that will be used as
143  //! the reference point from which the locations of all other grouped
144  //! entities are based.
145  //! Note: The third coordinate of the Reference Point, which will not be transmitted in the IsGroupOf
146  //! PDU, is defined to be 100 m below Adjusted Mean Sea Level to compensate for the lowest surface
147  //! point on the earth.
148  // Parameter: KFLOAT64 Latitude, void
149  // Parameter: KFLOAT64 Longitude, void
150  //************************************
151  void SetGroupReferencePoint( KFLOAT64 Latitude, KFLOAT64 Longitude );
152  void SetGroupReferencePointLatitude( KFLOAT64 L );
153  void SetGroupReferencePointLongitude( KFLOAT64 L );
154  KFLOAT64 GetGroupReferencePointLatitude() const;
155  KFLOAT64 GetGroupReferencePointLongitude() const;
156 
157  //************************************
158  // FullName: KDIS::PDU::IsGroupOf_PDU::AddGED
159  // KDIS::PDU::IsGroupOf_PDU::SetGED
160  // KDIS::PDU::IsGroupOf_PDU::GetGED
161  //!Description: Grouped Entity Descriptions (GEDs). This field consists of GED records
162  //! that specify information about each individual entity's within
163  //! the group. A GED record must be of the type specified by GroupedEntityCategory, if not an
164  //! INVALID_DATA exception is thrown.
165  //! Calling SetGED will change the GroupedEntityCategory to the new GED type, if the GED vector
166  //! contains multiple types an INVALID_DATA exception will be thrown.
167  //! Available GED are:
168  //! GED_BasicGroundCombatVehicle
169  //! GED_EnhancedGroundCombatVehicle
170  //! GED_BasicGroundCombatSoldier
171  //! GED_EnhancedGroundCombatSoldier
172  //! GED_BasicRotorWingAircraft
173  //! GED_EnhancedRotaryWingAircraft
174  //! GED_BasicFixedWingAircraft
175  //! GED_EnhancedFixedWingAircraft
176  //! GED_GroundLogisticsVehicle
177  // Parameter: const GEDItem & GED, const GEDList & GED, void
178  //************************************
179  void AddGED( const KDIS::DATA_TYPE::GEDItem & GED ) throw( KException );
180  void SetGED( const KDIS::DATA_TYPE::GEDList & GED ) throw( KException );
181  const KDIS::DATA_TYPE::GEDList & GetGED() const;
182 
183  //************************************
184  // FullName: KDIS::PDU::IsGroupOf_PDU::GetAsString
185  //!Description: Returns a string representation of the PDU.
186  //************************************
187  virtual KString GetAsString() const;
188 
189  //************************************
190  // FullName: KDIS::PDU::IsGroupOf_PDU::Decode
191  //!Description: Convert From Network Data.
192  // Parameter: KDataStream & stream
193  // Parameter: bool ignoreHeader = false - Decode the header from the stream?
194  //************************************
195  virtual void Decode( KDataStream & stream, bool ignoreHeader = false ) throw( KException );
196 
197  //************************************
198  // FullName: KDIS::PDU::IsGroupOf_PDU::Encode
199  //!Description: Convert To Network Data.
200  // Parameter: KDataStream & stream
201  //************************************
202  virtual KDataStream Encode() const;
203  virtual void Encode( KDataStream & stream ) const;
204 
205  KBOOL operator == ( const IsGroupOf_PDU & Value ) const;
206  KBOOL operator != ( const IsGroupOf_PDU & Value ) const;
207 };
208 
209 } // END namespace PDU
210 } // END namespace KDIS
unsigned int KUINT32
Definition: KDefines.h:103
KDIS::DATA_TYPE::GEDList m_vpGED
Definition: IsGroupOf_PDU.h:92
KDIS::DATA_TYPE::EntityIdentifier m_GroupedEntityID
Definition: IsGroupOf_PDU.h:80
Definition: IsGroupOf_PDU.h:76
unsigned short int KUINT16
Definition: KDefines.h:101
std::vector< GEDItem > GEDList
Definition: IsGroupOf_PDU.h:64
KDIS::UTILS::KRef_Ptr< GED > GEDItem
Definition: IsGroupOf_PDU.h:63
KUINT32 m_ui32Padding1
Definition: IsGroupOf_PDU.h:86
KUINT8 m_ui8NumOfGroupedEnts
Definition: IsGroupOf_PDU.h:84
Definition: KDefines.h:182
Definition: KDataStream.h:48
Definition: GED.h:59
bool KBOOL
Definition: KDefines.h:119
KUINT8 m_ui8GrpdEntCat
Definition: IsGroupOf_PDU.h:82
std::string KString
Definition: KDefines.h:116
KFLOAT64 m_f64GrpLat
Definition: IsGroupOf_PDU.h:88
Definition: EntityIdentifier.h:49
double KFLOAT64
Definition: KDefines.h:114
KFLOAT64 m_f64GrpLon
Definition: IsGroupOf_PDU.h:90
Definition: Header7.h:142
unsigned char KUINT8
Definition: KDefines.h:99
#define KDIS_EXPORT
Definition: KDefines.h:82
GroupedEntityCategory
Definition: EnumEntityManagement.h:118
Definition: KRef_Ptr.h:73