KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
EntityCapabilities.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: EntityCapabilities
32  created: 2008/09/24
33  author: Karl Jones
34 
35  purpose: Collection of bits to describe the capabilities of the entity
36  size: 32 bits / 4 octets
37 *********************************************************************/
38 
39 #pragma once
40 
41 #include "./DataTypeBase.h"
42 
43 namespace KDIS {
44 namespace DATA_TYPE {
45 
47 {
48 protected:
49 
50  union
51  {
52  struct
53  {
54  KUINT32 m_AmmunitionSupply : 1;
55  KUINT32 m_FuelSupply : 1;
56  KUINT32 m_RecoveryService : 1;
57  KUINT32 m_RepairService : 1;
58  KUINT32 m_ADSB : 1;
59  KUINT32 m_Unused : 27;
60  };
62  };
63 
64 public:
65 
66  static const KUINT16 ENTITY_CAPABILITIES_SIZE = 4;
67 
69 
70  EntityCapabilities( KDataStream & stream ) throw( KException );
71 
72  EntityCapabilities( KBOOL AmunitionSupply, KBOOL FuelSupply, KBOOL RecoveryService, KBOOL RepairService );
73 
74  EntityCapabilities( KBOOL AmunitionSupply, KBOOL FuelSupply, KBOOL RecoveryService, KBOOL RepairService, KBOOL ADSB );
75 
76  virtual ~EntityCapabilities();
77 
78  //************************************
79  // FullName: KDIS::DATA_TYPE::EntityCapabilities::SetHasAmmunitionSupply
80  // KDIS::DATA_TYPE::EntityCapabilities::HasAmmunitionSupply
81  //!Description: Does the entity have an ammunition supply
82  // Parameter: KBOOL HAS
83  //************************************
84  void SetHasAmmunitionSupply( KBOOL HAS );
85  KBOOL HasAmmunitionSupply() const;
86 
87  //************************************
88  // FullName: KDIS::DATA_TYPE::EntityCapabilities::SetHasFuelSupply
89  // KDIS::DATA_TYPE::EntityCapabilities::HasFuelSupply
90  //!Description: Does the entity have a fuel supply
91  // Parameter: KBOOL HAS
92  //************************************
93  void SetHasFuelSupply( KBOOL HAS );
94  KBOOL HasFuelSupply() const;
95 
96  //************************************
97  // FullName: KDIS::DATA_TYPE::EntityCapabilities::SetHasRecoveryService
98  // KDIS::DATA_TYPE::EntityCapabilities::HasRecoveryService
99  //!Description: Does the entity have a recovery service, such as towing
100  // Parameter: KBOOL HAS
101  //************************************
102  void SetHasRecoveryService( KBOOL HAS );
103  KBOOL HasRecoveryService() const;
104 
105  //************************************
106  // FullName: KDIS::DATA_TYPE::EntityCapabilities::SetHasRepairService
107  // KDIS::DATA_TYPE::EntityCapabilities::HasRepairService
108  //!Description: Does the entity have a repair service
109  // Parameter: KBOOL HAS
110  //************************************
111  void SetHasRepairService( KBOOL HAS );
112  KBOOL HasRepairService() const;
113 
114  //************************************
115  // FullName: KDIS::DATA_TYPE::EntityCapabilities::SetHasAutomaticDependentSurveillanceBroadcast
116  // KDIS::DATA_TYPE::EntityCapabilities::HasAutomaticDependentSurveillanceBroadcast
117  //!Description: Is the entity capable of Automatic Dependent Surveillance - Broadcast (ADS-B)?
118  // Parameter: KBOOL ADSB
119  //************************************
120  void SetHasAutomaticDependentSurveillanceBroadcast( KBOOL ADSB );
121  KBOOL HasAutomaticDependentSurveillanceBroadcast() const;
122 
123  //************************************
124  // FullName: KDIS::DATA_TYPE::EntityCapabilities::SetAllFields
125  // KDIS::DATA_TYPE::EntityCapabilities::GetAllFields
126  //!Description: 4 octet length field with all the bits set.
127  // Parameter: KUINT32 All
128  //************************************
129  void SetAllFields( KUINT32 All );
130  KUINT32 GetAllFields() const;
131 
132  //************************************
133  // FullName: KDIS::DATA_TYPE::EntityCapabilities::GetAsString
134  //!Description: Returns a string representation
135  //************************************
136  virtual KString GetAsString() const;
137 
138  //************************************
139  // FullName: KDIS::DATA_TYPE::EntityCapabilities::Decode
140  //!Description: Convert From Network Data.
141  // Parameter: KDataStream & stream
142  //************************************
143  virtual void Decode( KDataStream & stream ) throw( KException );
144 
145  //************************************
146  // FullName: KDIS::DATA_TYPE::EntityCapabilities::Encode
147  //!Description: Convert To Network Data.
148  // Parameter: KDataStream & stream
149  //************************************
150  virtual KDataStream Encode() const;
151  virtual void Encode( KDataStream & stream ) const;
152 
153  KBOOL operator == ( const EntityCapabilities & Value ) const;
154  KBOOL operator != ( const EntityCapabilities & Value ) const;
155 };
156 
157 } // END namespace DATA_TYPES
158 } // END namespace KDIS
159 
unsigned int KUINT32
Definition: KDefines.h:103
Definition: EntityCapabilities.h:46
unsigned short int KUINT16
Definition: KDefines.h:101
Definition: KDefines.h:182
Definition: KDataStream.h:48
Definition: DataTypeBase.h:49
bool KBOOL
Definition: KDefines.h:119
std::string KString
Definition: KDefines.h:116
KUINT32 m_ui16Data
Definition: EntityCapabilities.h:61
#define KDIS_EXPORT
Definition: KDefines.h:82