KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MinePaintScheme.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: MinePaintScheme
33  created: 13/06/2010
34  author: Karl Jones
35 
36  purpose: Represents the Paint Scheme of a mine.
37  size: 8 bits / 1 octet
38 *********************************************************************/
39 
40 #pragma once
41 
42 #include "./DataTypeBase.h"
43 
44 namespace KDIS {
45 namespace DATA_TYPE {
46 
48 {
49 protected:
50 
51  union
52  {
53  struct
54  {
55  KUINT8 m_ui8Alg : 2;
56  KUINT8 m_ui8Scm : 6;
57  };
58 
60  } m_PntScmUnion;
61 
62 public:
63 
64  static const KUINT16 MINE_PAINT_SCHEME_SIZE = 1;
65 
67 
69 
70  MinePaintScheme( KDataStream & stream ) throw( KException );
71 
72  virtual ~MinePaintScheme();
73 
74  //************************************
75  // FullName: KDIS::DATA_TYPE::MinePaintScheme::SetAlgae
76  // KDIS::DATA_TYPE::MinePaintScheme::GetAlgae
77  //!Description: The algae build-up on the mine.
78  // Parameter: MineAlgae A
79  //************************************
80  void SetAlgae( KDIS::DATA_TYPE::ENUMS::MineAlgae A );
81  KDIS::DATA_TYPE::ENUMS::MineAlgae GetAlgae() const;
82 
83  //************************************
84  // FullName: KDIS::DATA_TYPE::MinePaintScheme::SetPaintScheme
85  // KDIS::DATA_TYPE::MinePaintScheme::GetPaintScheme
86  //!Description: The paint scheme of the mine.
87  // Parameter: PaintScheme PS
88  //************************************
89  void SetPaintScheme( KDIS::DATA_TYPE::ENUMS::PaintScheme PS );
90  KDIS::DATA_TYPE::ENUMS::PaintScheme GetPaintScheme() const;
91 
92  //************************************
93  // FullName: KDIS::DATA_TYPE::MinePaintScheme::GetAsString
94  //!Description: Returns a string representation
95  //************************************
96  virtual KString GetAsString() const;
97 
98  //************************************
99  // FullName: KDIS::DATA_TYPE::MinePaintScheme::Decode
100  //!Description: Convert From Network Data.
101  // Parameter: KDataStream & stream
102  //************************************
103  virtual void Decode( KDataStream & stream ) throw( KException );
104 
105  //************************************
106  // FullName: KDIS::DATA_TYPE::MinePaintScheme::Encode
107  //!Description: Convert To Network Data.
108  // Parameter: KDataStream & stream
109  //************************************
110  virtual KDataStream Encode() const;
111  virtual void Encode( KDataStream & stream ) const;
112 
113  KBOOL operator == ( const MinePaintScheme & Value ) const;
114  KBOOL operator != ( const MinePaintScheme & Value ) const;
115 };
116 
117 } // END namespace DATA_TYPES
118 } // END namespace KDIS
119 
MineAlgae
Definition: EnumMinefield.h:183
unsigned short int KUINT16
Definition: KDefines.h:101
Definition: MinePaintScheme.h:47
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
PaintScheme
Definition: EnumMinefield.h:203
unsigned char KUINT8
Definition: KDefines.h:99
KUINT8 m_ui8PntSchm
Definition: MinePaintScheme.h:59
#define KDIS_EXPORT
Definition: KDefines.h:82