Merge pull request #5 from intothevoid/master
[KDIS.git] / KDIS / KDIS / DataTypes / MineFusing.h
blobe1d55ce6d9acd724387e4f8c06618c3c1a716b91
1 /*********************************************************************
3 Copyright 2013 Karl Jones
4 All rights reserved.
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
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.
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.
26 For Further Information Please Contact me at
27 Karljj1@yahoo.com
28 http://p.sf.net/kdis/UserGuide
29 *********************************************************************/
31 /********************************************************************
32 class: MineFusing
33 created: 11/06/2010
34 author: Karl Jones
36 purpose: Represent the primary, secondary fuse and anti-handling
37 device for each mine.
38 size: 16 bits / 2 octets
39 *********************************************************************/
41 #pragma once
43 #include "./DataTypeBase.h"
45 namespace KDIS {
46 namespace DATA_TYPE {
48 class KDIS_EXPORT MineFusing : public DataTypeBase
50 protected:
52 union
54 struct
56 KUINT16 m_ui16Primary : 7;
57 KUINT16 m_ui16Secondary : 7;
58 KUINT16 m_ui16AHD : 1;
59 KUINT16 m_ui16Unused : 1;
62 KUINT16 m_ui16Fusing;
63 } m_FuseUnion;
65 public:
67 static const KUINT16 MINE_FUSING_SIZE = 2;
69 MineFusing();
71 MineFusing( KDIS::DATA_TYPE::ENUMS::MineFuse Primary, KDIS::DATA_TYPE::ENUMS::MineFuse Secondary, KBOOL AntiHandlingDevice );
73 MineFusing( KDataStream & stream ) ;
75 virtual ~MineFusing();
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;
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;
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;
106 //************************************
107 // FullName: KDIS::DATA_TYPE::MineFusing::GetAsString
108 // Description: Returns a string representation
109 //************************************
110 virtual KString GetAsString() const;
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 ) ;
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;
127 KBOOL operator == ( const MineFusing & Value ) const;
128 KBOOL operator != ( const MineFusing & Value ) const;
131 } // END namespace DATA_TYPES
132 } // END namespace KDIS