1 /*********************************************************************
2 Copyright 2013 Karl Jones
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
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.
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.
25 For Further Information Please Contact me at
27 http://p.sf.net/kdis/UserGuide
28 *********************************************************************/
30 /********************************************************************
32 DIS: (6) 1278.1A - 1998
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 *********************************************************************/
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"
62 // Some PDU specific data types.
63 typedef KDIS::UTILS::KRef_Ptr
<GED
> GEDItem
;
64 typedef std::vector
<GEDItem
> GEDList
;
66 } // END namespace DATA_TYPE
70 using KDIS::DATA_TYPE::EntityIdentifier
;
71 using KDIS::DATA_TYPE::GED
;
72 using KDIS::DATA_TYPE::GEDItem
;
73 using KDIS::DATA_TYPE::GEDList
;
74 using KDIS::DATA_TYPE::ENUMS::GroupedEntityCategory
;
76 class KDIS_EXPORT IsGroupOf_PDU
: public Header
80 KDIS::DATA_TYPE::EntityIdentifier m_GroupedEntityID
;
82 KUINT8 m_ui8GrpdEntCat
;
84 KUINT8 m_ui8NumOfGroupedEnts
;
86 KUINT32 m_ui32Padding1
;
92 KDIS::DATA_TYPE::GEDList m_vpGED
;
96 static const KUINT16 IS_GROUP_OF_PDU_SIZE
= 40; // Min size
100 IsGroupOf_PDU( KDataStream
& stream
) ;
102 IsGroupOf_PDU( const Header
& H
, KDataStream
& stream
) ;
104 IsGroupOf_PDU( const KDIS::DATA_TYPE::EntityIdentifier
& EI
, KDIS::DATA_TYPE::ENUMS::GroupedEntityCategory GED
, KFLOAT64 GrpLatitude
, KFLOAT64 GrpLongitude
);
106 IsGroupOf_PDU( const KDIS::DATA_TYPE::EntityIdentifier
& EI
, KFLOAT64 GrpLatitude
, KFLOAT64 GrpLongitude
, const KDIS::DATA_TYPE::GEDList
& GED
) ;
108 virtual ~IsGroupOf_PDU();
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();
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;
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;
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;
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
) ;
180 void SetGED( const KDIS::DATA_TYPE::GEDList
& GED
) ;
181 const KDIS::DATA_TYPE::GEDList
& GetGED() const;
183 //************************************
184 // FullName: KDIS::PDU::IsGroupOf_PDU::GetAsString
185 // Description: Returns a string representation of the PDU.
186 //************************************
187 virtual KString
GetAsString() const;
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 ) ;
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;
205 KBOOL
operator == ( const IsGroupOf_PDU
& Value
) const;
206 KBOOL
operator != ( const IsGroupOf_PDU
& Value
) const;
209 } // END namespace PDU
210 } // END namespace KDIS