KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MinefieldDataFilter.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: MinefieldDataFilter
32  created: 17/05/2010
33  author: Karl Jones
34 
35  purpose: Provides a simple interface to the 32-bit enumeration for the Data Filter
36  field of the Minefield Query PDU and the Minefield Data PDU.
37  The data filter is used to identify which of the optional fields are
38  being requested(Minefield Query PDU) or are present(Minefield Data PDU).
39  size: 32 bits / 4 octets
40 *********************************************************************/
41 
42 #pragma once
43 
44 #include "./DataTypeBase.h"
45 
46 namespace KDIS {
47 namespace DATA_TYPE {
48 
50 {
51 protected:
52 
53  union
54  {
55  struct
56  {
57  KUINT32 m_ui32GroundOffset : 1;
58  KUINT32 m_ui32WaterOffset : 1;
59  KUINT32 m_ui32SnowOffset : 1;
60  KUINT32 m_ui32MineOri : 1;
61  KUINT32 m_ui32ThermalCon : 1;
62  KUINT32 m_ui32Reflectance : 1;
63  KUINT32 m_ui32MineEmpAge : 1;
64  KUINT32 m_ui32TripDetWire : 1;
65  KUINT32 m_ui32Fusing : 1;
66  KUINT32 m_ui32ScalarDet : 1;
67  KUINT32 m_ui32PaintScm : 1;
68  KUINT32 m_ui32Padding : 21;
69  };
71  } m_FilterUnion;
72 
73 public:
74 
75  static const KUINT16 MINEFIELD_DATA_FILTER_SIZE = 4;
76 
78 
79  MinefieldDataFilter( KDataStream & stream ) throw( KException );
80 
81  MinefieldDataFilter( KBOOL GroundBurialDepthOffset, KBOOL WaterBurialDepthOffset, KBOOL SnowBurialDepthOffset,
82  KBOOL MineOrientation, KBOOL ThermalContrast, KBOOL Reflectance, KBOOL MineEmplacementAge,
83  KBOOL TripDetonationWire, KBOOL Fusing, KBOOL ScalarDetectionCoefficient, KBOOL PaintScheme );
84 
85  virtual ~MinefieldDataFilter();
86 
87  //************************************
88  // FullName: KDIS::DATA_TYPE::MinefieldDataFilter::SetGroundBurialDepthOffset
89  // KDIS::DATA_TYPE::MinefieldDataFilter::IsGroundBurialDepthOffset
90  //!Description: Identifies whether Ground Burial Depth Offset data is requested / present.
91  //! true(1) - requested, false(0) - not requested.
92  // Parameter: KBOOL B, void
93  //************************************
94  void SetGroundBurialDepthOffset( KBOOL B );
95  KBOOL IsGroundBurialDepthOffset() const;
96 
97  //************************************
98  // FullName: KDIS::DATA_TYPE::MinefieldDataFilter::SetWaterBurialDepthOffset
99  // KDIS::DATA_TYPE::MinefieldDataFilter::IsWaterBurialDepthOffset
100  //!Description: Identifies whether Water Burial Depth Offset data is requested / present.
101  //! true(1) - requested, false(0) - not requested.
102  // Parameter: KBOOL B, void
103  //************************************
104  void SetWaterBurialDepthOffset( KBOOL B );
105  KBOOL IsWaterBurialDepthOffset() const;
106 
107  //************************************
108  // FullName: KDIS::DATA_TYPE::MinefieldDataFilter::SetSnowBurialDepthOffset
109  // KDIS::DATA_TYPE::MinefieldDataFilter::IsSnowBurialDepthOffset
110  //!Description: Identifies whether Snow Burial Depth Offset data is requested / present.
111  //! true(1) - requested, false(0) - not requested.
112  // Parameter: KBOOL B, void
113  //************************************
114  void SetSnowBurialDepthOffset( KBOOL B );
115  KBOOL IsSnowBurialDepthOffset() const;
116 
117  //************************************
118  // FullName: KDIS::DATA_TYPE::MinefieldDataFilter::SetMineOrientation
119  // KDIS::DATA_TYPE::MinefieldDataFilter::IsMineOrientation
120  //!Description: Identifies whether Mine Orientation data is requested / present.
121  //! true(1) - requested, false(0) - not requested.
122  // Parameter: KBOOL B, void
123  //************************************
124  void SetMineOrientation( KBOOL B );
125  KBOOL IsMineOrientation() const;
126 
127  //************************************
128  // FullName: KDIS::DATA_TYPE::MinefieldDataFilter::SetThermalContrast
129  // KDIS::DATA_TYPE::MinefieldDataFilter::IsThermalContrast
130  //!Description: Identifies whether Thermal Contrast data is requested / present.
131  //! true(1) - requested, false(0) - not requested.
132  // Parameter: KBOOL B, void
133  //************************************
134  void SetThermalContrast( KBOOL B );
135  KBOOL IsThermalContrast() const;
136 
137  //************************************
138  // FullName: KDIS::DATA_TYPE::MinefieldDataFilter::SetReflectance
139  // KDIS::DATA_TYPE::MinefieldDataFilter::IsReflectance
140  //!Description: Identifies whether Dielectric Constant data is requested / present.
141  //! true(1) - requested, false(0) - not requested.
142  // Parameter: KBOOL B, void
143  //************************************
144  void SetReflectance( KBOOL B );
145  KBOOL IsReflectance() const;
146 
147  //************************************
148  // FullName: KDIS::DATA_TYPE::MinefieldDataFilter::SetMineEmplacementAge
149  // KDIS::DATA_TYPE::MinefieldDataFilter::IsMineEmplacementAge
150  //!Description: Identifies whether Mine Emplacement Age data is requested / present.
151  //! true(1) - requested, false(0) - not requested.
152  // Parameter: KBOOL B, void
153  //************************************
154  void SetMineEmplacementAge( KBOOL B );
155  KBOOL IsMineEmplacementAge() const;
156 
157  //************************************
158  // FullName: KDIS::DATA_TYPE::MinefieldDataFilter::SetTripDetonationWire
159  // KDIS::DATA_TYPE::MinefieldDataFilter::IsTripDetonationWire
160  //!Description: Identifies whether Trip / Detonation Wire Location data is requested / present.
161  //! true(1) - requested, false(0) - not requested.
162  // Parameter: KBOOL B, void
163  //************************************
164  void SetTripDetonationWire( KBOOL B );
165  KBOOL IsTripDetonationWire() const;
166 
167  //************************************
168  // FullName: KDIS::DATA_TYPE::MinefieldDataFilter::SetFusing
169  // KDIS::DATA_TYPE::MinefieldDataFilter::IsFusing
170  //!Description: Identifies whether Fusing data is requested / present.
171  //! true(1) - requested, false(0) - not requested.
172  // Parameter: KBOOL B, void
173  //************************************
174  void SetFusing( KBOOL B );
175  KBOOL IsFusing() const;
176 
177  //************************************
178  // FullName: KDIS::DATA_TYPE::MinefieldDataFilter::SetScalarDetectionCoefficient
179  // KDIS::DATA_TYPE::MinefieldDataFilter::IsScalarDetectionCoefficient
180  //!Description: Identifies whether Scalar Detection Coefficient data is requested / present.
181  //! true(1) - requested, false(0) - not requested.
182  // Parameter: KBOOL B, void
183  //************************************
184  void SetScalarDetectionCoefficient( KBOOL B );
185  KBOOL IsScalarDetectionCoefficient() const;
186 
187  //************************************
188  // FullName: KDIS::DATA_TYPE::MinefieldDataFilter::SetPaintScheme
189  // KDIS::DATA_TYPE::MinefieldDataFilter::IsPaintScheme
190  //!Description: Identifies whether Paint Scheme data is requested / present.
191  //! true(1) - requested, false(0) - not requested.
192  // Parameter: KBOOL B, void
193  //************************************
194  void SetPaintScheme( KBOOL B );
195  KBOOL IsPaintScheme() const;
196 
197  //************************************
198  // FullName: KDIS::DATA_TYPE::MinefieldDataFilter::GetAsString
199  //!Description: Returns a string representation.
200  //************************************
201  virtual KString GetAsString() const;
202 
203  //************************************
204  // FullName: KDIS::DATA_TYPE::MinefieldDataFilter::Decode
205  //!Description: Convert From Network Data.
206  // Parameter: KDataStream & stream
207  //************************************
208  virtual void Decode( KDataStream & stream ) throw( KException );
209 
210  //************************************
211  // FullName: KDIS::DATA_TYPE::MinefieldDataFilter::Encode
212  //!Description: Convert To Network Data.
213  // Parameter: KDataStream & stream
214  //************************************
215  virtual KDataStream Encode() const;
216  virtual void Encode( KDataStream & stream ) const;
217 
218  KBOOL operator == ( const MinefieldDataFilter & Value ) const;
219  KBOOL operator != ( const MinefieldDataFilter & Value ) const;
220 };
221 
222 } // END namespace DATA_TYPES
223 } // END namespace KDIS
unsigned int KUINT32
Definition: KDefines.h:103
KUINT32 m_ui32Filter
Definition: MinefieldDataFilter.h:70
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
PaintScheme
Definition: EnumMinefield.h:203
#define KDIS_EXPORT
Definition: KDefines.h:82
Definition: MinefieldDataFilter.h:49