KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ArealObjectAppearance.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: ArealObjectAppearance
32  created: 17/03/2010
33  author: Karl Jones
34 
35  purpose: Represents a areal objects appearance.
36  size: 48 Bits / 6 Octet
37 *********************************************************************/
38 
39 #pragma once
40 
41 #include "./ObjectAppearance.h"
42 
43 namespace KDIS {
44 namespace DATA_TYPE {
45 
47 {
48 protected:
49 
50  union
51  {
52  struct
53  {
54  KUINT32 m_ui32Breach : 2;
55  KUINT32 m_ui32Unused : 14;
56  KUINT32 m_ui32Mines : 16;
57  } m_Minefield;
58 
60  } m_SpecificAppearanceUnion;
61 
62 public:
63 
64  static const KUINT16 AREAL_OBJECT_APPEARANCE_SIZE = 6;
65 
67 
68  ArealObjectAppearance( KDataStream & stream ) throw( KException );
69 
70  virtual ~ArealObjectAppearance();
71 
72  /************************************************************************/
73  /* The following appearance values are only for areal's of the type: */
74  /* Minefield */
75  /************************************************************************/
76 
77  //************************************
78  // FullName: KDIS::DATA_TYPE::ArealObjectAppearance::SetBreach
79  // KDIS::DATA_TYPE::ArealObjectAppearance::GetBreach
80  //!Description: Describes the breached appearance of the object.
81  // Parameter: Breach2bit B, void
82  ////************************************
83  void SetBreach( KDIS::DATA_TYPE::ENUMS::Breach2bit B );
84  KDIS::DATA_TYPE::ENUMS::Breach2bit GetBreach() const;
85 
86  //************************************
87  // FullName: KDIS::DATA_TYPE::ArealObjectAppearance::SetMineCount
88  // KDIS::DATA_TYPE::ArealObjectAppearance::GetMineCount
89  //!Description: The number of mines in the minefield.
90  // Parameter: KUINT16 M, void
91  //************************************
92  void SetMineCount( KUINT16 M );
93  KUINT16 GetMineCount() const;
94 
95  //************************************
96  // FullName: KDIS::DATA_TYPE::ArealObjectAppearance::GetAsString
97  //!Description: Returns a string representation of the appearance
98  // Parameter: const EntityType & EntType
99  //************************************
100  virtual KString GetAsString() const;
101 
102  //************************************
103  // FullName: KDIS::DATA_TYPE::ArealObjectAppearance::Decode
104  //!Description: Convert From Network Data.
105  // Parameter: KDataStream & stream
106  //************************************
107  virtual void Decode( KDataStream & stream ) throw( KException );
108 
109  //************************************
110  // FullName: KDIS::DATA_TYPE::ArealObjectAppearance::Encode
111  //!Description: Convert To Network Data.
112  // Parameter: KDataStream & stream
113  //************************************
114  virtual KDataStream Encode() const;
115  virtual void Encode( KDataStream & stream ) const;
116 
117  KBOOL operator == ( const ArealObjectAppearance & Value ) const;
118  KBOOL operator != ( const ArealObjectAppearance & Value ) const;
119 };
120 
121 } // END namespace DATA_TYPES
122 } // END namespace KDIS
Definition: ArealObjectAppearance.h:46
unsigned int KUINT32
Definition: KDefines.h:103
KUINT32 m_ui32SpecificAppearance
Definition: ArealObjectAppearance.h:59
unsigned short int KUINT16
Definition: KDefines.h:101
Breach2bit
Definition: EnumSyntheticEnviroment.h:196
Definition: KDefines.h:182
Definition: KDataStream.h:48
bool KBOOL
Definition: KDefines.h:119
std::string KString
Definition: KDefines.h:116
Definition: ObjectAppearance.h:46
#define KDIS_EXPORT
Definition: KDefines.h:82