KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Attribute_PDU.h
Go to the documentation of this file.
1 /*********************************************************************
2 
3 Copyright 2013 Karl Jones
4 All rights reserved.
5 
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
8 
9 1. Redistributions of source code must retain the above copyright notice, this
10  list of conditions and the following disclaimer.
11 2. Redistributions in binary form must reproduce the above copyright notice,
12  this list of conditions and the following disclaimer in the documentation
13  and/or other materials provided with the distribution.
14 
15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
19 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 For Further Information Please Contact me at
27 Karljj1@yahoo.com
28 http://p.sf.net/kdis/UserGuide
29 *********************************************************************/
30 
31 /********************************************************************
32  class: Attribute_PDU
33  DIS: (7) 1278.1-2012
34  created: 27/01/2011
35  author: Karl Jones
36 
37  purpose: Information about individual attributes for a particular entity,
38  other object, or event may be communicated using an Attribute PDU.
39  The Attribute PDU shall not be used to exchange data available in
40  any other PDU except where explicitly mentioned in the PDU issuance
41  instructions within the standard.
42  Size: 256 bits / 32 octets
43 *********************************************************************/
44 
45 #pragma once
46 
47 #include "./../Header.h"
48 #include "./../../DataTypes/SimulationIdentifier.h"
49 #include "./../../DataTypes/AttributeRecordSet.h"
50 
51 namespace KDIS {
52 namespace PDU {
53 
55 {
56 protected:
57 
59 
61 
63 
65 
67 
69 
71 
73 
75 
76  std::vector<KDIS::DATA_TYPE::AttributeRecordSet> m_vAttributeRecordSets;
77 
78 public:
79 
80  static const KUINT16 ATTRIBUTE_PDU_SIZE = 32; // Min size
81 
82  Attribute_PDU();
83 
84  Attribute_PDU( KDataStream & stream ) throw( KException );
85 
86  Attribute_PDU( const Header & H, KDataStream & stream ) throw( KException );
87 
90 
91  virtual ~Attribute_PDU();
92 
93  //************************************
94  // FullName: KDIS::PDU::Attribute_PDU::SetOriginatingSimulationAddress
95  // KDIS::PDU::Attribute_PDU::GetOriginatingSimulationAddress
96  //!Description: Identifies the simulation issuing the PDU.
97  // Parameter: const EntityIdentifier & ID
98  //************************************
99  void SetOriginatingSimulationAddress( const KDIS::DATA_TYPE::SimulationIdentifier & ID );
100  const KDIS::DATA_TYPE::SimulationIdentifier & GetOriginatingSimulationAddress() const;
101  KDIS::DATA_TYPE::SimulationIdentifier & GetOriginatingSimulationAddress();
102 
103  //************************************
104  // FullName: KDIS::PDU::Attribute_PDU::SetExtendedPDUType
105  // KDIS::PDU::Attribute_PDU::GetExtendedPDUType
106  //!Description: The type of PDU that is being extended or updated, if applicable.
107  // Parameter: PDUType Type
108  //************************************
109  void SetExtendedPDUType( KDIS::DATA_TYPE::ENUMS::PDUType T );
110  KDIS::DATA_TYPE::ENUMS::PDUType GetExtendedPDUType() const;
111 
112  //************************************
113  // FullName: KDIS::PDU::Attribute_PDU::SetExtendedProtocolVersion
114  // KDIS::PDU::Attribute_PDU::GetExtendedProtocolVersion
115  //!Description: The protocol version asociated with the extended/updated PDU.
116  // Parameter: ProtocolVersion PV
117  //************************************
118  void SetExtendedProtocolVersion( KDIS::DATA_TYPE::ENUMS::ProtocolVersion PV );
119  KDIS::DATA_TYPE::ENUMS::ProtocolVersion GetExtendedProtocolVersion() const;
120 
121  //************************************
122  // FullName: KDIS::PDU::Attribute_PDU::SetMasterAttributeRecordType
123  // KDIS::PDU::Attribute_PDU::GetMasterAttributeRecordType
124  //!Description: Contains the Attribute record type of the Attribute records
125  //! in the PDU if they all have the same Attribute record type.
126  // Parameter: AttributeID MART
127  //************************************
128  void SetMasterAttributeRecordType( KDIS::DATA_TYPE::ENUMS::AttributeID MART );
129  KDIS::DATA_TYPE::ENUMS::AttributeID GetMasterAttributeRecordType() const;
130 
131  //************************************
132  // FullName: KDIS::PDU::Attribute_PDU::SetActionCode
133  // KDIS::PDU::Attribute_PDU::GetActionCode
134  //!Description: Action code applicable to all attribute records in this Attribute_PDU.
135  // Parameter: ActionCode AC
136  //************************************
137  void SetActionCode( KDIS::DATA_TYPE::ENUMS::ActionCode AC );
138  KDIS::DATA_TYPE::ENUMS::ActionCode GetActionCode() const;
139 
140  //************************************
141  // FullName: KDIS::PDU::Attribute_PDU::GetNumberOfAttributeRecordSets
142  //!Description: The number of Attribute Record Sets contained within this PDU.
143  //************************************
144  KUINT16 GetNumberOfAttributeRecordSets() const;
145 
146  //************************************
147  // FullName: KDIS::PDU::Entity_State_PDU::AddAttributeRecordSet
148  // KDIS::PDU::Entity_State_PDU::SetAttributeRecordSets
149  // KDIS::PDU::Entity_State_PDU::GetAttributeRecordSets
150  // KDIS::PDU::Entity_State_PDU::ClearAttributeRecordSet
151  //!Description: Add/Set the record sets.
152  //! Adding will update the Number of Attribute Record Sets Params and the PDU length field.
153  // Parameter: const AttributeRecordSet & AR, const vector<AttributeRecordSet> & AR
154  //************************************
155  void AddAttributeRecordSet( const KDIS::DATA_TYPE::AttributeRecordSet & AR );
156  void SetAttributeRecordSets( const std::vector<KDIS::DATA_TYPE::AttributeRecordSet> & AR );
157  const std::vector<KDIS::DATA_TYPE::AttributeRecordSet> & GetAttributeRecordSets() const;
158  void ClearAttributeRecordSet();
159 
160  //************************************
161  // FullName: KDIS::PDU::Attribute_PDU::GetAsString
162  //!Description: Returns a string representation of the PDU.
163  //************************************
164  virtual KString GetAsString() const;
165 
166  //************************************
167  // FullName: KDIS::PDU::Attribute_PDU::Decode
168  //!Description: Convert From Network Data.
169  // Parameter: KDataStream & stream
170  // Parameter: bool ignoreHeader = false - Decode the header from the stream?
171  //************************************
172  virtual void Decode( KDataStream & stream, bool ignoreHeader = false ) throw( KException );
173 
174  //************************************
175  // FullName: KDIS::PDU::Attribute_PDU::Encode
176  //!Description: Convert To Network Data.
177  // Parameter: KDataStream & stream
178  //************************************
179  virtual KDataStream Encode() const;
180  virtual void Encode( KDataStream & stream ) const;
181 
182  KBOOL operator == ( const Attribute_PDU & Value ) const;
183  KBOOL operator != ( const Attribute_PDU & Value ) const;
184 };
185 
186 } // END namespace PDU
187 } // END namespace KDIS
188 
Definition: SimulationIdentifier.h:51
unsigned int KUINT32
Definition: KDefines.h:103
KUINT16 m_ui16Padding
Definition: Attribute_PDU.h:62
ID_Enum
Definition: EnumEntityManagement.h:201
ActionCode
Definition: EnumEntityInfoInteraction.h:935
unsigned short int KUINT16
Definition: KDefines.h:101
KUINT16 m_ui16NumAttrRecSets
Definition: Attribute_PDU.h:74
KUINT32 m_ui32Padding
Definition: Attribute_PDU.h:60
ProtocolVersion
Definition: EnumHeader.h:53
Definition: KDefines.h:182
Definition: KDataStream.h:48
bool KBOOL
Definition: KDefines.h:119
std::vector< KDIS::DATA_TYPE::AttributeRecordSet > m_vAttributeRecordSets
Definition: Attribute_PDU.h:76
KUINT8 m_ui8ExtPDUType
Definition: Attribute_PDU.h:64
KUINT8 m_ui8ActionCode
Definition: Attribute_PDU.h:70
Definition: Attribute_PDU.h:54
std::string KString
Definition: KDefines.h:116
KUINT8 m_ui8Padding1
Definition: Attribute_PDU.h:72
KDIS::DATA_TYPE::SimulationIdentifier m_OrigSimAddr
Definition: Attribute_PDU.h:58
PDUType
Definition: EnumHeader.h:79
Definition: Header7.h:142
unsigned char KUINT8
Definition: KDefines.h:99
KUINT8 m_ui8ExtProtocolVersion
Definition: Attribute_PDU.h:66
KUINT32 m_ui32MasterRecType
Definition: Attribute_PDU.h:68
Definition: AttributeRecordSet.h:48
#define KDIS_EXPORT
Definition: KDefines.h:82