KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Directed_Energy_Fire_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: Directed_Energy_Fire_PDU
32  DIS: (7) 1278.1-2012
33  created: 04/07/2011
34  author: Karl Jones
35 
36  purpose: The Directed Energy Fire PDU shall be used to communicate information associated
37  with the firing of a directed energy (DE) weapon. A DE weapon may be directed at
38  a specific target or at an area possibly containing several targets. Distinct
39  aimpoint record types are defined to describe these two general cases.
40  When firing at a specific target a Precision Aimpoint is employed. The DE Precision
41  Aimpoint record is most commonly used to represent the firing of a High Energy Laser.
42  Other types of directed energy weapons propagate effects over a wide region.
43  Representation of these weapons uses the Area Aimpoint record to describe characteristics and effects.
44 
45  Size: 704 bits / 88 octets - Min size
46 *********************************************************************/
47 
48 #pragma once
49 
50 #include "./../Header.h"
51 #include "./../../DataTypes/EntityIdentifier.h"
52 #include "./../../DataTypes/EntityType.h"
53 #include "./../../DataTypes/ClockTime.h"
54 #include "./../../DataTypes/Vector.h"
55 #include "./../../DataTypes/StandardVariable.h"
56 
57 namespace KDIS {
58 namespace PDU {
59 
61 {
62 protected:
63 
65 
67 
69 
71 
73 
75 
77 
79 
81 
83 
85 
86  union
87  {
88  struct
89  {
90  KUINT16 m_ui16WeaponState : 1;
91  KUINT16 m_ui16StateUpdate : 1;
92  KUINT16 m_ui16Reserved : 14;
93  };
95  } m_DeUnion;
96 
98 
102 
104 
105  std::vector<KDIS::DATA_TYPE::StdVarPtr> m_vDeRec;
106 
107 public:
108 
109  static const KUINT16 DIRECTED_ENERGY_PDU_SIZE = 88; // Min size
110 
112 
113  Directed_Energy_Fire_PDU( KDataStream & stream ) throw( KException );
114 
115  Directed_Energy_Fire_PDU( const Header & H, KDataStream & stream ) throw( KException );
116 
118  const KDIS::DATA_TYPE::EntityType & MunitionType, const KDIS::DATA_TYPE::ClockTime & ShotStartTime,
119  KFLOAT32 CumulativeShotTime, const KDIS::DATA_TYPE::Vector & EmitterLocation,
120  KFLOAT32 ApertureDiameter, KFLOAT32 Wavelength, KFLOAT32 PeakIrradiance,
121  KFLOAT32 PulseRepetitionFrequency, KFLOAT32 PulseWidth,
122  KBOOL WeaponState, KBOOL UpdateState, KDIS::DATA_TYPE::ENUMS::BeamSpotShape PS );
123 
124  virtual ~Directed_Energy_Fire_PDU();
125 
126  //************************************
127  // FullName: KDIS::PDU::Directed_Energy_Fire_PDU::SetFiringEntityID
128  // KDIS::PDU::Directed_Energy_Fire_PDU::GetFiringEntityID
129  //!Description: The Firing Entity.
130  // Parameter: const EntityIdentifier & ID
131  //************************************
132  void SetFiringEntityID( const KDIS::DATA_TYPE::EntityIdentifier & ID );
133  const KDIS::DATA_TYPE::EntityIdentifier & GetFiringEntityID() const;
134  KDIS::DATA_TYPE::EntityIdentifier & GetFiringEntityID();
135 
136  //************************************
137  // FullName: KDIS::PDU::Directed_Energy_Fire_PDU::SetEventID
138  // KDIS::PDU::Directed_Energy_Fire_PDU::GetEventID
139  //!Description: Event ID. Used to associate related firing/detonation
140  //! events. If a detonation event if not proceeded
141  //! by a firing event then the value shall be 0 (e.g land mines)
142  // Parameter: const EntityIdentifier & ID
143  //************************************
144  void SetEventID( const KDIS::DATA_TYPE::EntityIdentifier & ID );
145  const KDIS::DATA_TYPE::EntityIdentifier & GetEventID() const;
146  KDIS::DATA_TYPE::EntityIdentifier & GetEventID();
147 
148  //************************************
149  // FullName: KDIS::PDU::Directed_Energy_Fire_PDU::SetMunitionType
150  // KDIS::PDU::Directed_Energy_Fire_PDU::GetMunitionType
151  //!Description: Identifies the munition type enumeration for the DE weapon beam.
152  // Parameter: const EntityType & MT
153  //************************************
154  void SetMunitionType( const KDIS::DATA_TYPE::EntityType & MT );
155  const KDIS::DATA_TYPE::EntityType & GetMunitionType() const;
156  KDIS::DATA_TYPE::EntityType & GetMunitionType();
157 
158  //************************************
159  // FullName: KDIS::PDU::Directed_Energy_Fire_PDU::SetShotStartTime
160  // KDIS::PDU::Directed_Energy_Fire_PDU::GetShotStartTime
161  //!Description: The simulation time at start of the shot.
162  // Parameter: const ClockTime & SST
163  //************************************
164  void SetShotStartTime( const KDIS::DATA_TYPE::ClockTime & SST );
165  const KDIS::DATA_TYPE::ClockTime & GetShotStartTime() const;
166  KDIS::DATA_TYPE::ClockTime & GetShotStartTime();
167 
168  //************************************
169  // FullName: KDIS::PDU::Directed_Energy_Fire_PDU::SetCumulativeShotTime
170  // KDIS::PDU::Directed_Energy_Fire_PDU::GetCumulativeShotTime
171  //!Description: The current cumulative duration of the shot in units of seconds.
172  // Parameter: KFLOAT32 CST
173  //************************************
174  void SetCumulativeShotTime( KFLOAT32 CST );
175  KFLOAT32 GetCumulativeShotTime() const;
176 
177  //************************************
178  // FullName: KDIS::PDU::Directed_Energy_Fire_PDU::SetEmitterLocation
179  // KDIS::PDU::Directed_Energy_Fire_PDU::GetEmitterLocation
180  //!Description: Location of the DE weapon aperture/emitter.
181  // Represented by an Entity Coordinate Vector.
182  // Parameter: const Vector & EL
183  //************************************
184  void SetEmitterLocation( const KDIS::DATA_TYPE::Vector & EL );
185  const KDIS::DATA_TYPE::Vector & GetEmitterLocation() const;
186  KDIS::DATA_TYPE::Vector & GetEmitterLocation();
187 
188  //************************************
189  // FullName: KDIS::PDU::Directed_Energy_Fire_PDU::SetApertureDiameter
190  // KDIS::PDU::Directed_Energy_Fire_PDU::GetApertureDiameter
191  //!Description: The beam diameter at the aperture/emitter. In meters.
192  // Parameter: KFLOAT32 AD
193  //************************************
194  void SetApertureDiameter( KFLOAT32 AD );
195  KFLOAT32 GetApertureDiameter() const;
196 
197  //************************************
198  // FullName: KDIS::PDU::Directed_Energy_Fire_PDU::SetWavelength
199  // KDIS::PDU::Directed_Energy_Fire_PDU::GetWavelength
200  //!Description: Emissions wavelength in units of meters.
201  // Parameter: KFLOAT32 AD
202  //************************************
203  void SetWavelength( KFLOAT32 W );
204  KFLOAT32 GetWavelength() const;
205 
206  //************************************
207  // FullName: KDIS::PDU::Directed_Energy_Fire_PDU::SetPeakIrradiance
208  // KDIS::PDU::Directed_Energy_Fire_PDU::GetPeakIrradiance
209  //!Description: Current peak irradiance of emissions in units of Watts per square meter.
210  // Parameter: KFLOAT32 PI
211  //************************************
212  void SetPeakIrradiance( KFLOAT32 PI );
213  KFLOAT32 GetPeakIrradiance() const;
214 
215  //************************************
216  // FullName: KDIS::PDU::Directed_Energy_Fire_PDU::SetPulseRepetitionFrequency
217  // KDIS::PDU::Directed_Energy_Fire_PDU::GetPulseRepetitionFrequency
218  //!Description: Current pulse repetition frequency in units of cycles per second (Hertz).
219  // Parameter: KFLOAT32 PRF
220  //************************************
221  void SetPulseRepetitionFrequency( KFLOAT32 PRF );
222  KFLOAT32 GetPulseRepetitionFrequency() const;
223 
224  //************************************
225  // FullName: KDIS::PDU::Directed_Energy_Fire_PDU::SetPulseWidth
226  // KDIS::PDU::Directed_Energy_Fire_PDU::GetPulseWidth
227  //!Description: Pulse width emissions in units of seconds.
228  // Parameter: KFLOAT32 PW
229  //************************************
230  void SetPulseWidth( KFLOAT32 PW );
231  KFLOAT32 GetPulseWidth() const;
232 
233  //************************************
234  // FullName: KDIS::PDU::Directed_Energy_Fire_PDU::SetFlagWeaponState
235  // KDIS::PDU::Directed_Energy_Fire_PDU::GetFlagWeaponState
236  //!Description: true = weapon on, false = weapon off
237  // Parameter: KBOOL WS
238  //************************************
239  void SetFlagWeaponState( KBOOL WS );
240  KBOOL GetFlagWeaponState() const;
241 
242  //************************************
243  // FullName: KDIS::PDU::Directed_Energy_Fire_PDU::SetFlagStateUpdate
244  // KDIS::PDU::Directed_Energy_Fire_PDU::GetFlagStateUpdate
245  //!Description: true = state changed, false = update due to heartbeat timer
246  // Parameter: KFLOAT32 SU
247  //************************************
248  void SetFlagStateUpdate( KBOOL SU );
249  KBOOL GetFlagStateUpdate() const;
250 
251  //************************************
252  // FullName: KDIS::PDU::Directed_Energy_Fire_PDU::SetPulseShape
253  // KDIS::PDU::Directed_Energy_Fire_PDU::GetPulseShape
254  //!Description: Identifies the pulse shape .
255  // Parameter: BeamSpotShape PS
256  //************************************
257  void SetPulseShape( KDIS::DATA_TYPE::ENUMS::BeamSpotShape PS );
258  KDIS::DATA_TYPE::ENUMS::BeamSpotShape GetPulseShape() const;
259 
260  //************************************
261  // FullName: KDIS::PDU::Directed_Energy_Fire_PDU::GetNumberOfDirectedEnergyRecords
262  //!Description: Number of Directed Energy records stored in this PDU.
263  //************************************
264  KUINT16 GetNumberOfDirectedEnergyRecords() const;
265 
266  //************************************
267  // FullName: KDIS::PDU::Directed_Energy_Fire_PDU::AddDirectedEnergyRecord
268  // KDIS::PDU::Directed_Energy_Fire_PDU::SetDirectedEnergyRecords
269  // KDIS::PDU::Directed_Energy_Fire_PDU::GetDirectedEnergyRecords
270  // KDIS::PDU::Directed_Energy_Fire_PDU::ClearDirectedEnergyRecords
271  //!Description: This field can contain one or more DE records and may also contain
272  // other Standard Variable records.
273  // Parameter: StdVarPtr DE, const vector<StdVarPtr> & DE
274  //************************************
275  void AddDirectedEnergyRecord( KDIS::DATA_TYPE::StdVarPtr DE );
276  void SetDirectedEnergyRecords( const std::vector<KDIS::DATA_TYPE::StdVarPtr> & DE );
277  const std::vector<KDIS::DATA_TYPE::StdVarPtr> & GetDirectedEnergyRecords() const;
278  void ClearDirectedEnergyRecords();
279 
280  //************************************
281  // FullName: KDIS::PDU::Directed_Energy_Fire_PDU::GetAsString
282  //!Description: Returns a string representation of the PDU.
283  //************************************
284  virtual KString GetAsString() const;
285 
286  //************************************
287  // FullName: KDIS::PDU::Directed_Energy_Fire_PDU::Decode
288  //!Description: Convert From Network Data.
289  // Parameter: KDataStream & stream
290  // Parameter: bool ignoreHeader = false - Decode the header from the stream?
291  //************************************
292  virtual void Decode( KDataStream & stream, bool ignoreHeader = false ) throw( KException );
293 
294  //************************************
295  // FullName: KDIS::PDU::Directed_Energy_Fire_PDU::Encode
296  //!Description: Convert To Network Data.
297  // Parameter: KDataStream & stream
298  //************************************
299  virtual KDataStream Encode() const;
300  virtual void Encode( KDataStream & stream ) const;
301 
302  KBOOL operator == ( const Directed_Energy_Fire_PDU & Value ) const;
303  KBOOL operator != ( const Directed_Energy_Fire_PDU & Value ) const;
304 };
305 
306 } // END namespace PDU
307 } // END namespace KDIS
KDIS::DATA_TYPE::EntityIdentifier m_EventID
Definition: Directed_Energy_Fire_PDU.h:66
unsigned int KUINT32
Definition: KDefines.h:103
Definition: EntityType.h:46
KUINT16 m_ui16Padding3
Definition: Directed_Energy_Fire_PDU.h:101
KDIS::DATA_TYPE::EntityType m_MunTyp
Definition: Directed_Energy_Fire_PDU.h:68
unsigned short int KUINT16
Definition: KDefines.h:101
KUINT16 m_ui16Flags
Definition: Directed_Energy_Fire_PDU.h:94
KFLOAT32 m_f32AperDiameter
Definition: Directed_Energy_Fire_PDU.h:76
float KFLOAT32
Definition: KDefines.h:113
KUINT8 m_ui8PulseShp
Definition: Directed_Energy_Fire_PDU.h:97
KDIS::DATA_TYPE::ClockTime m_ShotStartTime
Definition: Directed_Energy_Fire_PDU.h:70
Definition: Vector.h:71
KFLOAT32 m_f32PeakIrradiance
Definition: Directed_Energy_Fire_PDU.h:80
Definition: KDefines.h:182
Definition: KDataStream.h:48
KUINT8 m_ui8Padding1
Definition: Directed_Energy_Fire_PDU.h:99
KDIS::DATA_TYPE::Vector m_EmitterLoc
Definition: Directed_Energy_Fire_PDU.h:74
bool KBOOL
Definition: KDefines.h:119
Definition: Directed_Energy_Fire_PDU.h:60
KDIS::DATA_TYPE::EntityIdentifier m_FiringEntityID
Definition: Directed_Energy_Fire_PDU.h:64
std::string KString
Definition: KDefines.h:116
Definition: EntityIdentifier.h:49
KUINT32 m_ui32Padding2
Definition: Directed_Energy_Fire_PDU.h:100
KFLOAT32 m_f32CumulativeShotTime
Definition: Directed_Energy_Fire_PDU.h:72
Definition: Header7.h:142
unsigned char KUINT8
Definition: KDefines.h:99
BeamSpotShape
Definition: EnumDesignator.h:90
KFLOAT32 m_f32PulseRepFreq
Definition: Directed_Energy_Fire_PDU.h:82
KUINT16 m_ui16NumDERecs
Definition: Directed_Energy_Fire_PDU.h:103
#define KDIS_EXPORT
Definition: KDefines.h:82
KFLOAT32 m_f32PulseWidth
Definition: Directed_Energy_Fire_PDU.h:84
Definition: KRef_Ptr.h:73
std::vector< KDIS::DATA_TYPE::StdVarPtr > m_vDeRec
Definition: Directed_Energy_Fire_PDU.h:105
Definition: ClockTime.h:49
KFLOAT32 m_f32Wavelength
Definition: Directed_Energy_Fire_PDU.h:78