KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Minefield_Query_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: Minefield_Query_PDU
32  DIS: (6) 1278.1a - 1998
33  created: 17/05/2010
34  author: Karl Jones
35 
36  purpose: Provides the means to query a minefield simulation for information on individual
37  mines contained within a minefield when operating in QRP mode (MinefieldProtocolMode = 1).
38  size: 320 bits / 40 octets - Min size
39 *********************************************************************/
40 
41 #pragma once
42 
43 #include "./Minefield_Header.h"
44 #include "./../../DataTypes/MinefieldDataFilter.h"
45 #include "./../../DataTypes/EntityType.h"
46 #include "./../../DataTypes/PerimeterPointCoordinate.h"
47 #include <vector>
48 
49 namespace KDIS {
50 namespace PDU {
51 
53 {
54 protected:
55 
57 
59 
61 
63 
65 
67 
69 
70  std::vector<KDIS::DATA_TYPE::PerimeterPointCoordinate> m_vPoints;
71 
72  std::vector<KUINT16> m_vui16SensorTypes;
75 
76  //************************************
77  // FullName: KDIS::PDU::Minefield_Query_PDU::calcPadding
78  //!Description: Calculates the padding so the PDU lies on a 32 bit boundary.
79  //************************************
80  void calcPadding();
81 
82 public:
83 
84  static const KUINT16 MINEFIELD_QUERY_PDU_SIZE = 40; // Min size
85 
87 
88  Minefield_Query_PDU( KDataStream & stream ) throw( KException );
89 
90  Minefield_Query_PDU( const Header & H, KDataStream & stream ) throw( KException );
91 
92  Minefield_Query_PDU( const KDIS::DATA_TYPE::EntityIdentifier & MinefieldID, const KDIS::DATA_TYPE::EntityIdentifier & RequestingSimulationID,
93  KUINT8 RequestID, const KDIS::DATA_TYPE::MinefieldDataFilter & DF, const KDIS::DATA_TYPE::EntityType & MineTypeFilter );
94 
95  virtual ~Minefield_Query_PDU();
96 
97  //************************************
98  // FullName: KDIS::PDU::Minefield_Query_PDU::SetRequestingSimulationID
99  // KDIS::PDU::Minefield_Query_PDU::GetRequestingSimulationID
100  //!Description: The simulation that is requesting the information.
101  // Parameter: const EntityIdentifier & ID
102  //************************************
103  void SetRequestingSimulationID( const KDIS::DATA_TYPE::EntityIdentifier & ID );
104  const KDIS::DATA_TYPE::EntityIdentifier & GetRequestingSimulationID() const;
105  KDIS::DATA_TYPE::EntityIdentifier & GetRequestingSimulationID();
106 
107  //************************************
108  // FullName: KDIS::PDU::Minefield_Query_PDU::SetRequestID
109  // KDIS::PDU::Minefield_Query_PDU::GetRequestID
110  //!Description: Identifies the minefield query request.
111  // Parameter: KUINT8 ID
112  //************************************
113  void SetRequestID( KUINT8 ID );
114  KUINT8 GetRequestID() const;
115 
116  //************************************
117  // FullName: KDIS::PDU::Minefield_Query_PDU::GetNumberOfPerimeterPoints
118  //!Description: Number of points in the perimeter of the minefield.
119  //************************************
120  KUINT8 GetNumberOfPerimeterPoints() const;
121 
122  //************************************
123  // FullName: KDIS::PDU::Minefield_Query_PDU::GetNumberOfSensorsTypes
124  //!Description: The number of sensor types employed by the requesting simulation.
125  //! A zero in this field shall indicate that the requesting simulation
126  //! is not a detection system.
127  //************************************
128  KUINT8 GetNumberOfSensorsTypes() const;
129 
130  //************************************
131  // FullName: KDIS::PDU::Minefield_Query_PDU::SetDataFilter
132  // KDIS::PDU::Minefield_Query_PDU::GetDataFilter
133  //!Description: The data filter is used to identify which of the optional
134  //! fields are being requested.
135  // Parameter: const MinefieldDataFilter & DF
136  //************************************
137  void SetDataFilter( const KDIS::DATA_TYPE::MinefieldDataFilter & DF );
138  const KDIS::DATA_TYPE::MinefieldDataFilter & GetDataFilter() const;
139  KDIS::DATA_TYPE::MinefieldDataFilter & GetDataFilter();
140 
141  //************************************
142  // FullName: KDIS::PDU::Minefield_Query_PDU::SetMineTypeFilter
143  // KDIS::PDU::Minefield_Query_PDU::GetMineTypeFilter
144  //!Description: Requested Mine Type Filter. Specifies the type of mine being queried by the requesting
145  //! simulation.
146  //! If a subfield within the Requested Minefield Type filter record (e.g., the country
147  //! field) contains the value �1 (all bits set), then all subfield values shall match the filter
148  //! (e.g., all countries are allowed).
149  // Parameter: const EntityType & MT
150  //************************************
151  void SetMineTypeFilter( const KDIS::DATA_TYPE::EntityType & MT );
152  const KDIS::DATA_TYPE::EntityType & GetMineTypeFilter() const;
153  KDIS::DATA_TYPE::EntityType & GetMineTypeFilter();
154 
155  //************************************
156  // FullName: KDIS::PDU::Minefield_Query_PDU::AddRequestedPerimeterPointCoordinate
157  // KDIS::PDU::Minefield_Query_PDU::SetRequestedPerimeterPointCoordinates
158  // KDIS::PDU::Minefield_Query_PDU::GetRequestedPerimeterPointCoordinates
159  //!Description: Specifies the location of each perimeter point in the requested area,
160  //! relative to the Minefield Location field from the Minefield State PDU.
161  //! Only the x and y coordinates shall be specified.
162  // Parameter: const PerimeterPointCoordinate & PPC, vector<PerimeterPointCoordinate> & PPC
163  //************************************
164  void AddRequestedPerimeterPointCoordinate( const KDIS::DATA_TYPE::PerimeterPointCoordinate & PPC );
165  void SetRequestedPerimeterPointCoordinates( const std::vector<KDIS::DATA_TYPE::PerimeterPointCoordinate> & PPC );
166  const std::vector<KDIS::DATA_TYPE::PerimeterPointCoordinate> & GetRequestedPerimeterPointCoordinates() const;
167 
168  //************************************
169  // FullName: KDIS::PDU::Minefield_Query_PDU::AddSensorType
170  // KDIS::PDU::Minefield_Query_PDU::SetSensorTypes
171  // KDIS::PDU::Minefield_Query_PDU::GetSensorTypes
172  //!Description: Specifies which types of sensors are requesting the data. The type of
173  //! sensor determines which scalar detection coefficients shall be included
174  //! in the Minefield Data PDU.
175  //! The sensor type is represented as a 16 bit enumeration where bits 0-3
176  //! identify the category of the sensor type and bits 4-15 identify the
177  //! subcategory within the specified category.
178  //! The enum SensorType(EnumMinefield.h) provides all sensor types from SISO-REF-10-2006 which have all the bits set
179  //! correctly for each sensor type.
180  // Parameter: SensorType ST, vector<KUINT16> & ST
181  //************************************
182  void AddSensorType( KDIS::DATA_TYPE::ENUMS::SensorType ST );
183  void SetSensorTypes( const std::vector<KUINT16> & ST );
184  const std::vector<KUINT16> & GetSensorTypes() const;
185 
186  //************************************
187  // FullName: KDIS::PDU::Minefield_Query_PDU::GetAsString
188  //!Description: Returns a string representation of the PDU.
189  //************************************
190  virtual KString GetAsString() const;
191 
192  //************************************
193  // FullName: KDIS::PDU::Minefield_Query_PDU::Decode
194  //!Description: Convert From Network Data.
195  // Parameter: KDataStream & stream
196  // Parameter: bool ignoreHeader = false - Decode the header from the stream?
197  //************************************
198  virtual void Decode( KDataStream & stream, bool ignoreHeader = false ) throw( KException );
199 
200  //************************************
201  // FullName: KDIS::PDU::Minefield_Query_PDU::Encode
202  //!Description: Convert To Network Data.
203  // Parameter: KDataStream & stream
204  //************************************
205  virtual KDataStream Encode() const;
206  virtual void Encode( KDataStream & stream ) const;
207 
208  KBOOL operator == ( const Minefield_Query_PDU & Value ) const;
209  KBOOL operator != ( const Minefield_Query_PDU & Value ) const;
210 };
211 
212 } // END namespace PDU
213 } // END namespace KDIS
Definition: EntityType.h:46
KUINT8 m_ui8Padding1
Definition: Minefield_Query_PDU.h:62
unsigned short int KUINT16
Definition: KDefines.h:101
SensorType
Definition: EnumMinefield.h:95
KBOOL m_bNeedsPadding
Definition: Minefield_Query_PDU.h:73
std::vector< KDIS::DATA_TYPE::PerimeterPointCoordinate > m_vPoints
Definition: Minefield_Query_PDU.h:70
KUINT8 m_ui8ReqID
Definition: Minefield_Query_PDU.h:58
Definition: KDefines.h:182
Definition: KDataStream.h:48
Definition: Minefield_Query_PDU.h:52
KUINT8 m_ui8NumSensTyp
Definition: Minefield_Query_PDU.h:64
bool KBOOL
Definition: KDefines.h:119
Definition: Minefield_Header.h:49
std::string KString
Definition: KDefines.h:116
Definition: EntityIdentifier.h:49
std::vector< KUINT16 > m_vui16SensorTypes
Definition: Minefield_Query_PDU.h:72
Definition: Header7.h:142
unsigned char KUINT8
Definition: KDefines.h:99
#define KDIS_EXPORT
Definition: KDefines.h:82
KDIS::DATA_TYPE::EntityType m_MineTypFilter
Definition: Minefield_Query_PDU.h:68
KDIS::DATA_TYPE::EntityIdentifier m_ReqID
Definition: Minefield_Query_PDU.h:56
KUINT16 m_ui16Padding1
Definition: Minefield_Query_PDU.h:74
KUINT8 m_ui8NumPerimPoints
Definition: Minefield_Query_PDU.h:60
Definition: PerimeterPointCoordinate.h:46
Definition: MinefieldDataFilter.h:49
KDIS::DATA_TYPE::MinefieldDataFilter m_DataFilter
Definition: Minefield_Query_PDU.h:66