Merge pull request #5 from intothevoid/master
[KDIS.git] / KDIS / KDIS / PDU / Synthetic_Environment / Object_State_Header.h
blob822439bd233c4d23335ec65b68f4a184d1d04d95
1 /*********************************************************************
2 Copyright 2013 Karl Jones
3 All rights reserved.
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
26 Karljj1@yahoo.com
27 http://p.sf.net/kdis/UserGuide
28 *********************************************************************/
30 /********************************************************************
31 class: Object_State_Header
32 DIS: (6) 1278.1a - 1998
33 created: 07/12/2009
34 author: Karl Jones
36 purpose: Common attributes for point, linear and areal objects
38 size: 216 bits / 27 octets
39 *********************************************************************/
41 #pragma once
43 #include "./../Header.h"
44 #include "./../../DataTypes/EntityIdentifier.h"
46 namespace KDIS {
47 namespace PDU {
49 class KDIS_EXPORT Object_State_Header : public Header
51 protected:
53 KDIS::DATA_TYPE::EntityIdentifier m_ObjID;
55 KDIS::DATA_TYPE::EntityIdentifier m_RefObjID;
57 KUINT16 m_ui16UpdateNum;
59 KUINT8 m_ui8ForceID;
61 public:
63 static const KUINT16 OBJECT_STATE_HEADER_SIZE = 27;
65 Object_State_Header();
67 explicit Object_State_Header( const Header & H );
69 Object_State_Header( KDataStream & stream ) ;
71 Object_State_Header( const Header & H, KDataStream & stream ) ;
73 Object_State_Header( const KDIS::DATA_TYPE::EntityIdentifier & ObjID, const KDIS::DATA_TYPE::EntityIdentifier & RefObjID ,
74 KUINT16 UpdateNum, KDIS::DATA_TYPE::ENUMS::ForceID FI );
76 virtual ~Object_State_Header();
78 //************************************
79 // FullName: KDIS::PDU::Object_State_Header::SetObjectID
80 // KDIS::PDU::Object_State_Header::GetObjectID
81 // Description: The unique identification of the object in the SE.
82 // Parameter: const EntityIdentifier & ID
83 //************************************
84 void SetObjectID( const KDIS::DATA_TYPE::EntityIdentifier & ID );
85 const KDIS::DATA_TYPE::EntityIdentifier & GetObjectID() const;
86 KDIS::DATA_TYPE::EntityIdentifier & GetObjectID();
88 //************************************
89 // FullName: KDIS::PDU::Object_State_Header::SetReferencedObjectID
90 // KDIS::PDU::Object_State_Header::GetReferencedObjectID
91 // Description: The unique identification of the object with which this
92 // state object is associated with.
93 // Parameter: const EntityIdentifier & ID
94 //************************************
95 void SetReferencedObjectID( const KDIS::DATA_TYPE::EntityIdentifier & ID );
96 const KDIS::DATA_TYPE::EntityIdentifier & GetReferencedObjectID() const;
97 KDIS::DATA_TYPE::EntityIdentifier & GetReferencedObjectID();
99 //************************************
100 // FullName: KDIS::PDU::Object_State_Header::SetUpdateNumber
101 // KDIS::PDU::Object_State_Header::GetUpdateNumber
102 // Description: This field shall represent the unique update number, starting with 1,
103 // of each state transition of an individual object.
104 // Parameter: KUINT16 U
105 //************************************
106 void SetUpdateNumber( KUINT16 U );
107 KUINT16 GetUpdateNumber() const;
109 //************************************
110 // FullName: KDIS::PDU::Object_State_Header::SetForceID
111 // KDIS::PDU::Object_State_Header::GetForceID
112 // Description: Identifies the force that created or modified the object.
113 // Parameter: ForceID ID
114 //************************************
115 void SetForceID( KDIS::DATA_TYPE::ENUMS::ForceID ID );
116 KDIS::DATA_TYPE::ENUMS::ForceID GetForceID() const;
118 //************************************
119 // FullName: KDIS::PDU::Object_State_Header::GetAsString
120 // Description: Returns a string representation of the PDU.
121 //************************************
122 virtual KString GetAsString() const;
124 //************************************
125 // FullName: KDIS::PDU::Object_State_Header::Decode
126 // Description: Convert From Network Data.
127 // Parameter: KDataStream & stream
128 // Parameter: bool ignoreHeader = false - Decode the header from the stream?
129 //************************************
130 virtual void Decode( KDataStream & stream, bool ignoreHeader = false ) ;
132 //************************************
133 // FullName: KDIS::PDU::Object_State_Header::Encode
134 // Description: Convert To Network Data.
135 // Parameter: KDataStream & stream
136 //************************************
137 virtual KDataStream Encode() const;
138 virtual void Encode( KDataStream & stream ) const;
140 KBOOL operator == ( const Object_State_Header & Value ) const;
141 KBOOL operator != ( const Object_State_Header & Value ) const;
144 } // END namespace PDU
145 } // END namespace KDIS