chore(include): changed include files from .h to .hpp
[KDIS.git] / include / KDIS / DataTypes / MinefieldAppearance.hpp
blobad5b965cbceebf2e5b23fd58165ba940bbc85ce6
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: MinefieldAppearance
32 created: 04/05/2010
33 author: Karl Jones
35 purpose: Represents the appearance bits of the Minefield State PDU.
36 size: 16 bits / 2 octets
37 *********************************************************************/
39 #pragma once
41 #include "./DataTypeBase.h"
43 namespace KDIS {
44 namespace DATA_TYPE {
46 class KDIS_EXPORT MinefieldAppearance : public DataTypeBase
48 protected:
50 union
52 struct
54 KUINT16 m_ui16Type : 2;
55 KUINT16 m_ui16ActiveStatus : 1;
56 KUINT16 m_ui16Lane : 1;
57 KUINT16 m_ui16Unused1 : 9;
58 KUINT16 m_ui16State : 1;
59 KUINT16 m_ui16Unused : 2;
61 KUINT16 m_ui16App;
62 } m_ui16BitUnion;
64 public:
66 static const KUINT16 MINEFIELD_APPEARANCE_SIZE = 2;
68 MinefieldAppearance();
70 MinefieldAppearance( KDIS::DATA_TYPE::ENUMS::MinefieldType T, KBOOL IsStatusActive, KBOOL IsLaneActive, KBOOL IsStateActive );
72 MinefieldAppearance( KDataStream & stream ) ;
74 virtual ~MinefieldAppearance();
76 //************************************
77 // FullName: KDIS::DATA_TYPE::MinefieldAppearance::SetMinefieldType
78 // KDIS::DATA_TYPE::MinefieldAppearance::GetMinefieldType
79 // Description: The type of mines in the minefield. Anti personnel, anti tank or mixed.
80 // Parameter: MinefieldType T
81 //************************************
82 void SetMinefieldType( KDIS::DATA_TYPE::ENUMS::MinefieldType T );
83 KDIS::DATA_TYPE::ENUMS::MinefieldType GetMinefieldType() const;
85 //************************************
86 // FullName: KDIS::DATA_TYPE::MinefieldAppearance::SetStatusActive
87 // KDIS::DATA_TYPE::MinefieldAppearance::IsStatusActive
88 // Description: Identifies the active status of the minefield.
89 // Note: The DIS standard(SISO-REF-010-2006) specifies 0 for true and 1 for false however they are
90 // flipped internally by KDIS so you can use true and false as you would expect to.
91 // Parameter: KBOOL A
92 //************************************
93 void SetStatusActive( KBOOL A );
94 KBOOL IsStatusActive() const;
96 //************************************
97 // FullName: KDIS::DATA_TYPE::MinefieldAppearance::SetLaneActive
98 // KDIS::DATA_TYPE::MinefieldAppearance::IsLaneActive
99 // Description: Identifies whether the minefield has an active lane.
100 // Note: The DIS standard(SISO-REF-010-2006) specifies 0 for true and 1 for false however they are
101 // flipped internally by KDIS so you can use true and false as you would expect to.
102 // Parameter: KBOOL A
103 //************************************
104 void SetLaneActive( KBOOL A );
105 KBOOL IsLaneActive() const;
107 //************************************
108 // FullName: KDIS::DATA_TYPE::MinefieldAppearance::SetStateActive
109 // KDIS::DATA_TYPE::MinefieldAppearance::IsStateActive
110 // Description: Describes the state of the minefield.
111 // Note: The DIS standard(SISO-REF-010-2006) specifies 0 for true and 1 for false however they are
112 // flipped internally by KDIS so you can use true and false as you would expect to.
113 // Parameter: KBOOL A
114 //************************************
115 void SetStateActive( KBOOL A );
116 KBOOL IsStateActive() const;
118 //************************************
119 // FullName: KDIS::DATA_TYPE::MinefieldAppearance::GetAsString
120 // Description: Returns a string representation
121 //************************************
122 virtual KString GetAsString() const;
124 //************************************
125 // FullName: KDIS::DATA_TYPE::MinefieldAppearance::Decode
126 // Description: Convert From Network Data.
127 // Parameter: KDataStream & stream
128 //************************************
129 virtual void Decode( KDataStream & stream ) ;
131 //************************************
132 // FullName: KDIS::DATA_TYPE::MinefieldAppearance::Encode
133 // Description: Convert To Network Data.
134 // Parameter: KDataStream & stream
135 //************************************
136 virtual KDataStream Encode() const;
137 virtual void Encode( KDataStream & stream ) const;
139 KBOOL operator == ( const MinefieldAppearance & Value ) const;
140 KBOOL operator != ( const MinefieldAppearance & Value ) const;
143 } // END namespace DATA_TYPES
144 } // END namespace KDIS