KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Shaft.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: Shaft
32  created: 04/01/2009
33  author: Karl Jones
34 
35  purpose: Represents a shaft on a platform.
36  size: 64 bits / 8 octets
37 *********************************************************************/
38 
39 #pragma once
40 
41 #include "./DataTypeBase.h"
42 
43 namespace KDIS {
44 namespace DATA_TYPE {
45 
47 {
48 protected:
49 
51 
53 
55 
56 public:
57 
58  static const KUINT16 SHAFT_SIZE = 8;
59 
60  Shaft();
61 
62  Shaft( KDataStream & stream ) throw( KException );
63 
64  Shaft( KINT16 CurrentRPM, KINT16 OrderedRPM, KINT32 RateOfChange );
65 
66  virtual ~Shaft();
67 
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;
79 
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;
91 
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;
103 
104  //************************************
105  // FullName: KDIS::DATA_TYPE::Shaft::GetAsString
106  //!Description: Returns a string representation
107  //************************************
108  virtual KString GetAsString() const;
109 
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 ) throw( KException );
116 
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;
124 
125  KBOOL operator == ( const Shaft & Value ) const;
126  KBOOL operator != ( const Shaft & Value ) const;
127 };
128 
129 } // END namespace DATA_TYPES
130 } // END namespace KDIS
131 
KINT32 m_i32RPMRateOfChange
Definition: Shaft.h:54
KINT16 m_i16OrderedRPM
Definition: Shaft.h:52
short int KINT16
Definition: KDefines.h:102
unsigned short int KUINT16
Definition: KDefines.h:101
Definition: KDefines.h:182
Definition: KDataStream.h:48
int KINT32
Definition: KDefines.h:104
Definition: DataTypeBase.h:49
bool KBOOL
Definition: KDefines.h:119
std::string KString
Definition: KDefines.h:116
Definition: Shaft.h:46
KINT16 m_i16CurrentRPM
Definition: Shaft.h:50
#define KDIS_EXPORT
Definition: KDefines.h:82