KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Data_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: Data_Query_PDU
32  DIS: (5) 1278.1 - 1995
33  created: 08/10/2008
34  author: Karl Jones
35 
36  purpose: Requests for data from an entity are communicated by a Data Query PDU
37  size: 320 bits/ 40 octets - not including variable param sizes
38 *********************************************************************/
39 
40 #pragma once
41 
42 #include "./Data_PDU.h"
43 
44 namespace KDIS {
45 namespace PDU {
46 
48 {
49 protected:
50 
52 
54 
56 
58 
59  std::vector<KUINT32> m_vFixedDatum;
60 
61  std::vector<KUINT32> m_vVariableDatum;
62 
63 public:
64 
65  static const KUINT16 DATA_QUERY_PDU_SIZE = 40;
66 
68 
69  Data_Query_PDU( const Header & H );
70 
71  Data_Query_PDU( KDataStream & stream ) throw( KException );
72 
73  Data_Query_PDU( const Header & H, KDataStream & stream ) throw( KException );
74 
75  Data_Query_PDU( const KDIS::DATA_TYPE::EntityIdentifier & OriginatingEntityID, const KDIS::DATA_TYPE::EntityIdentifier & ReceivingEntityID,
76  KUINT32 RequestID );
77 
78  virtual ~Data_Query_PDU();
79 
80  //************************************
81  // FullName: KDIS::PDU::Data_Query_PDU::SetRequestID
82  // KDIS::PDU::Data_Query_PDU::GetRequestID
83  //!Description: Request ID, identifies the matching response
84  //! to a Data Query PDU or Set Data PDU.
85  // Parameter: KUINT32 ID
86  //************************************
87  void SetRequestID( KUINT32 ID );
88  KUINT32 GetRequestID() const;
89 
90  //************************************
91  // FullName: KDIS::PDU::Data_Query_PDU::SetTimeInterval
92  // KDIS::PDU::Data_Query_PDU::GetTimeInterval
93  //!Description: Specifies the time interval between issues of
94  //! Data PDUs, a value of 0(default) indicates the data should
95  //! be sent once and not at any other time intervals.
96  // Parameter: TimeStamp TI
97  //************************************
98  void SetTimeInterval( const KDIS::DATA_TYPE::TimeStamp & TI );
99  const KDIS::DATA_TYPE::TimeStamp & GetTimeInterval() const;
100  KDIS::DATA_TYPE::TimeStamp & GetTimeInterval();
101 
102  //************************************
103  // FullName: KDIS::PDU::Data_Query_PDU::GetNumberFIxedDatum
104  //!Description: Returns number of fixed datum records
105  //************************************
106  KUINT32 GetNumberFIxedDatum() const;
107 
108  //************************************
109  // FullName: KDIS::PDU::Data_Query_PDU::GetNumberVariableDatum
110  //!Description: Returns number of variable datum records
111  //************************************
112  KUINT32 GetNumberVariableDatum() const;
113 
114  //************************************
115  // FullName: KDIS::PDU::Data_Query_PDU::AddFixedDatum
116  // KDIS::PDU::Data_Query_PDU::SetFixedDatum
117  // KDIS::PDU::Data_Query_PDU::GetFixedDatum
118  //!Description: Datum ID's for which information is required.
119  // Parameter: KUINT32 FD, const vector<KUINT32> & FD
120  //************************************
121  void AddFixedDatum( KUINT32 FD );
122  void SetFixedDatum( const std::vector<KUINT32> & FD );
123  const std::vector<KUINT32> & GetFixedDatum() const;
124 
125  //************************************
126  // FullName: KDIS::PDU::Data_Query_PDU::AddVariableDatum
127  // KDIS::PDU::Data_Query_PDU::SetVariableDatum
128  // KDIS::PDU::Data_Query_PDU::GetVariableDatum
129  //!Description: Datum ID's for which information is required.
130  // Parameter: VarDtmPtr VD, const vector<VarDtmPtr> & VD
131  //************************************
132  void AddVariableDatum( KUINT32 VD );
133  void SetVariableDatum( const std::vector<KUINT32> & VD );
134  const std::vector<KUINT32> & GetVariableDatum() const;
135 
136  //************************************
137  // FullName: KDIS::PDU::Data_Query_PDU::GetAsString
138  //!Description: Returns a string representation of the PDU.
139  //************************************
140  virtual KString GetAsString() const;
141 
142  //************************************
143  // FullName: KDIS::PDU::Data_Query_PDU::Decode
144  //!Description: Convert From Network Data.
145  // Parameter: KDataStream & stream
146  // Parameter: bool ignoreHeader = false - Decode the header from the stream?
147  //************************************
148  virtual void Decode( KDataStream & stream, bool ignoreHeader = false ) throw( KException );
149 
150  //************************************
151  // FullName: KDIS::PDU::Data_Query_PDU::Encode
152  //!Description: Convert To Network Data.
153  // Parameter: KDataStream & stream
154  //************************************
155  virtual KDataStream Encode() const;
156  virtual void Encode( KDataStream & stream ) const;
157 
158  KBOOL operator == ( const Data_Query_PDU & Value ) const;
159  KBOOL operator != ( const Data_Query_PDU & Value ) const;
160 };
161 
162 } // END namespace PDU
163 } // END namespace KDIS
164 
std::vector< KUINT32 > m_vVariableDatum
Definition: Data_Query_PDU.h:61
unsigned int KUINT32
Definition: KDefines.h:103
Definition: Simulation_Management_Header.h:48
unsigned short int KUINT16
Definition: KDefines.h:101
std::vector< KUINT32 > m_vFixedDatum
Definition: Data_Query_PDU.h:59
Definition: KDefines.h:182
Definition: KDataStream.h:48
bool KBOOL
Definition: KDefines.h:119
KDIS::DATA_TYPE::TimeStamp m_TimeInterval
Definition: Data_Query_PDU.h:53
KUINT32 m_ui32RequestID
Definition: Data_Query_PDU.h:51
std::string KString
Definition: KDefines.h:116
KUINT32 m_ui32NumFixedDatum
Definition: Data_Query_PDU.h:55
Definition: EntityIdentifier.h:49
KUINT32 m_ui32NumVariableDatum
Definition: Data_Query_PDU.h:57
Definition: Header7.h:142
Definition: Data_Query_PDU.h:47
#define KDIS_EXPORT
Definition: KDefines.h:82
Definition: TimeStamp.h:68