KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MinefieldAppearance.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: MinefieldAppearance
32  created: 04/05/2010
33  author: Karl Jones
34 
35  purpose: Represents the appearance bits of the Minefield State PDU.
36  size: 16 bits / 2 octets
37 *********************************************************************/
38 
39 #pragma once
40 
41 #include "./DataTypeBase.h"
42 
43 namespace KDIS {
44 namespace DATA_TYPE {
45 
47 {
48 protected:
49 
50  union
51  {
52  struct
53  {
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;
60  };
62  } m_ui16BitUnion;
63 
64 public:
65 
66  static const KUINT16 MINEFIELD_APPEARANCE_SIZE = 2;
67 
69 
70  MinefieldAppearance( KDIS::DATA_TYPE::ENUMS::MinefieldType T, KBOOL IsStatusActive, KBOOL IsLaneActive, KBOOL IsStateActive );
71 
72  MinefieldAppearance( KDataStream & stream ) throw( KException );
73 
74  virtual ~MinefieldAppearance();
75 
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;
84 
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;
95 
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;
106 
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;
117 
118  //************************************
119  // FullName: KDIS::DATA_TYPE::MinefieldAppearance::GetAsString
120  //!Description: Returns a string representation
121  //************************************
122  virtual KString GetAsString() const;
123 
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 ) throw( KException );
130 
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;
138 
139  KBOOL operator == ( const MinefieldAppearance & Value ) const;
140  KBOOL operator != ( const MinefieldAppearance & Value ) const;
141 };
142 
143 } // END namespace DATA_TYPES
144 } // END namespace KDIS
145 
KUINT16 m_ui16App
Definition: MinefieldAppearance.h:61
unsigned short int KUINT16
Definition: KDefines.h:101
MinefieldType
Definition: EnumMinefield.h:53
Definition: KDefines.h:182
Definition: KDataStream.h:48
Definition: DataTypeBase.h:49
bool KBOOL
Definition: KDefines.h:119
std::string KString
Definition: KDefines.h:116
#define KDIS_EXPORT
Definition: KDefines.h:82
Definition: MinefieldAppearance.h:46