1 /*********************************************************************
2 Copyright 2013 Karl Jones
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
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.
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.
25 For Further Information Please Contact me at
27 http://p.sf.net/kdis/UserGuide
28 *********************************************************************/
30 /********************************************************************
32 DIS: (5) 1278.1 - 1995
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 *********************************************************************/
42 #include "./Data_PDU.h"
47 class KDIS_EXPORT Data_Query_PDU
: public Simulation_Management_Header
51 KUINT32 m_ui32RequestID
;
53 KDIS::DATA_TYPE::TimeStamp m_TimeInterval
;
55 KUINT32 m_ui32NumFixedDatum
;
57 KUINT32 m_ui32NumVariableDatum
;
59 std::vector
<KUINT32
> m_vFixedDatum
;
61 std::vector
<KUINT32
> m_vVariableDatum
;
65 static const KUINT16 DATA_QUERY_PDU_SIZE
= 40;
69 explicit Data_Query_PDU( const Header
& H
);
71 Data_Query_PDU( KDataStream
& stream
) ;
73 Data_Query_PDU( const Header
& H
, KDataStream
& stream
) ;
75 Data_Query_PDU( const KDIS::DATA_TYPE::EntityIdentifier
& OriginatingEntityID
, const KDIS::DATA_TYPE::EntityIdentifier
& ReceivingEntityID
,
78 virtual ~Data_Query_PDU();
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;
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();
102 //************************************
103 // FullName: KDIS::PDU::Data_Query_PDU::GetNumberFIxedDatum
104 // Description: Returns number of fixed datum records
105 //************************************
106 KUINT32
GetNumberFIxedDatum() const;
108 //************************************
109 // FullName: KDIS::PDU::Data_Query_PDU::GetNumberVariableDatum
110 // Description: Returns number of variable datum records
111 //************************************
112 KUINT32
GetNumberVariableDatum() const;
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;
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;
136 //************************************
137 // FullName: KDIS::PDU::Data_Query_PDU::GetAsString
138 // Description: Returns a string representation of the PDU.
139 //************************************
140 virtual KString
GetAsString() const;
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 ) ;
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;
158 KBOOL
operator == ( const Data_Query_PDU
& Value
) const;
159 KBOOL
operator != ( const Data_Query_PDU
& Value
) const;
162 } // END namespace PDU
163 } // END namespace KDIS