Merge pull request #5 from intothevoid/master
[KDIS.git] / KDIS / KDIS / DataTypes / Shaft.h
blob706c6f72763ae2d17c95c6e505d9afa18e619c42
1 /*********************************************************************
2 Copyright 2013 Karl Jones
3 All rights reserved.
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
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.
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.
25 For Further Information Please Contact me at
26 Karljj1@yahoo.com
27 http://p.sf.net/kdis/UserGuide
28 *********************************************************************/
30 /********************************************************************
31 class: Shaft
32 created: 04/01/2009
33 author: Karl Jones
35 purpose: Represents a shaft on a platform.
36 size: 64 bits / 8 octets
37 *********************************************************************/
39 #pragma once
41 #include "./DataTypeBase.h"
43 namespace KDIS {
44 namespace DATA_TYPE {
46 class KDIS_EXPORT Shaft : public DataTypeBase
48 protected:
50 KINT16 m_i16CurrentRPM;
52 KINT16 m_i16OrderedRPM;
54 KINT32 m_i32RPMRateOfChange;
56 public:
58 static const KUINT16 SHAFT_SIZE = 8;
60 Shaft();
62 Shaft( KDataStream & stream ) ;
64 Shaft( KINT16 CurrentRPM, KINT16 OrderedRPM, KINT32 RateOfChange );
66 virtual ~Shaft();
68 //************************************
69 // FullName: KDIS::DATA_TYPE::Shaft::SetCurrentRPM
70 // KDIS::DATA_TYPE::Shaft::GetCurrentRPM
71 // Description: Current speed in RPM of the shaft.
72 // A positive value indicates a clockwise
73 // rotation. Shafts are defined from port to
74 // starboard locations(refrence view is from stern to bow).
75 // Parameter: KINT16 RPM, void
76 //************************************
77 void SetCurrentRPM( KINT16 RPM );
78 KINT16 GetCurrentRPM() const;
80 //************************************
81 // FullName: KDIS::DATA_TYPE::Shaft::SetOrderedRPM
82 // KDIS::DATA_TYPE::Shaft::GetOrderedRPM
83 // Description: Current speed in RPM of the shaft.
84 // A positive value indicates a clockwise
85 // rotation. Shafts are defined from port to
86 // starboard locations(refrence view is from stern to bow).
87 // Parameter: KINT16 RPM, void
88 //************************************
89 void SetOrderedRPM( KINT16 RPM );
90 KINT16 GetOrderedRPM() const;
92 //************************************
93 // FullName: KDIS::DATA_TYPE::Shaft::SetRateOfChange
94 // KDIS::DATA_TYPE::Shaft::GetRateOfChange
95 // Description: Current speed in RPM of the shaft.
96 // A positive value indicates a clockwise
97 // rotation. Shafts are defined from port to
98 // starboard locations(refrence view is from stern to bow).
99 // Parameter: KINT32 ROC, void
100 //************************************
101 void SetRateOfChange( KINT32 ROC );
102 KINT32 GetRateOfChange() const;
104 //************************************
105 // FullName: KDIS::DATA_TYPE::Shaft::GetAsString
106 // Description: Returns a string representation
107 //************************************
108 virtual KString GetAsString() const;
110 //************************************
111 // FullName: KDIS::DATA_TYPE::Shaft::Decode
112 // Description: Convert From Network Data.
113 // Parameter: KDataStream & stream
114 //************************************
115 virtual void Decode( KDataStream & stream ) ;
117 //************************************
118 // FullName: KDIS::DATA_TYPE::Shaft::Encode
119 // Description: Convert To Network Data.
120 // Parameter: KDataStream & stream
121 //************************************
122 virtual KDataStream Encode() const;
123 virtual void Encode( KDataStream & stream ) const;
125 KBOOL operator == ( const Shaft & Value ) const;
126 KBOOL operator != ( const Shaft & Value ) const;
129 } // END namespace DATA_TYPES
130 } // END namespace KDIS