KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MineFusing.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: MineFusing
33  created: 11/06/2010
34  author: Karl Jones
35 
36  purpose: Represent the primary, secondary fuse and anti-handling
37  device for each mine.
38  size: 16 bits / 2 octets
39 *********************************************************************/
40 
41 #pragma once
42 
43 #include "./DataTypeBase.h"
44 
45 namespace KDIS {
46 namespace DATA_TYPE {
47 
49 {
50 protected:
51 
52  union
53  {
54  struct
55  {
56  KUINT16 m_ui16Primary : 7;
57  KUINT16 m_ui16Secondary : 7;
58  KUINT16 m_ui16AHD : 1;
59  KUINT16 m_ui16Unused : 1;
60  };
61 
63  } m_FuseUnion;
64 
65 public:
66 
67  static const KUINT16 MINE_FUSING_SIZE = 2;
68 
69  MineFusing();
70 
72 
73  MineFusing( KDataStream & stream ) throw( KException );
74 
75  virtual ~MineFusing();
76 
77  //************************************
78  // FullName: KDIS::DATA_TYPE::MineFusing::SetPrimaryFuse
79  // KDIS::DATA_TYPE::MineFusing::GetPrimaryFuse
80  //!Description: Identifies the type of the primary fuse.
81  // Parameter: MineFuse F
82  //************************************
83  void SetPrimaryFuse( KDIS::DATA_TYPE::ENUMS::MineFuse F );
84  KDIS::DATA_TYPE::ENUMS::MineFuse GetPrimaryFuse() const;
85 
86  //************************************
87  // FullName: KDIS::DATA_TYPE::MineFusing::SetSecondaryFuse
88  // KDIS::DATA_TYPE::MineFusing::GetSecondaryFuse
89  //!Description: Identifies the type of the secondary fuse.
90  // Parameter: MineFuse F
91  //************************************
92  void SetSecondaryFuse( KDIS::DATA_TYPE::ENUMS::MineFuse F );
93  KDIS::DATA_TYPE::ENUMS::MineFuse GetSecondaryFuse() const;
94 
95  //************************************
96  // FullName: KDIS::DATA_TYPE::MineFusing::SetHasAntiHandlingDevice
97  // KDIS::DATA_TYPE::MineFusing::GetHasAntiHandlingDevice
98  //!Description: Describes the anti-handling device status of the mine
99  //! true = anti-handling device.
100  //! false = No anti-handling device.
101  // Parameter: KBOOL AHD
102  //************************************
103  void SetHasAntiHandlingDevice( KBOOL AHD );
104  KBOOL GetHasAntiHandlingDevice() const;
105 
106  //************************************
107  // FullName: KDIS::DATA_TYPE::MineFusing::GetAsString
108  //!Description: Returns a string representation
109  //************************************
110  virtual KString GetAsString() const;
111 
112  //************************************
113  // FullName: KDIS::DATA_TYPE::MineFusing::Decode
114  //!Description: Convert From Network Data.
115  // Parameter: KDataStream & stream
116  //************************************
117  virtual void Decode( KDataStream & stream ) throw( KException );
118 
119  //************************************
120  // FullName: KDIS::DATA_TYPE::MineFusing::Encode
121  //!Description: Convert To Network Data.
122  // Parameter: KDataStream & stream
123  //************************************
124  virtual KDataStream Encode() const;
125  virtual void Encode( KDataStream & stream ) const;
126 
127  KBOOL operator == ( const MineFusing & Value ) const;
128  KBOOL operator != ( const MineFusing & Value ) const;
129 };
130 
131 } // END namespace DATA_TYPES
132 } // END namespace KDIS
133 
unsigned short int KUINT16
Definition: KDefines.h:101
MineFuse
Definition: EnumMinefield.h:160
Definition: MineFusing.h:48
KUINT16 m_ui16Fusing
Definition: MineFusing.h:62
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