KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ArticulatedPart.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: ArticulatedPart
32  updated: 08/03/2013
33  author: Karl Jones
34 
35  purpose: The Articulated Part VP record is used to represent the state of the movable parts of an entity.
36  Examples of movable parts include the turret on a tank and the periscope on a submarine.
37  An Articulated Part VP record shall represent the value of only one parameter of a movable,
38  or articulated, part. Thus, it may require multiple Articulated Part VP records to describe
39  the state of a single articulated part.
40 
41  size: 128 bits / 16 octets
42 *********************************************************************/
43 
44 #pragma once
45 
46 #include "./VariableParameter.h"
47 
48 namespace KDIS {
49 namespace DATA_TYPE {
50 
52 {
53 protected:
54 
56 
58 
60 
62 
64 
65 public:
66 
68 
69  ArticulatedPart( KDataStream & stream ) throw( KException );
70 
73 
74  ArticulatedPart( KUINT8 ParamChangeIndicator, KUINT16 AttachID, KUINT32 TypeVariant, KFLOAT32 Value );
75 
76  virtual ~ArticulatedPart();
77 
78  //************************************
79  // FullName: KDIS::DATA_TYPE::ArticulatedPart::SetParameterChangeIndicator
80  // KDIS::DATA_TYPE::ArticulatedPart::GetParameterChangeIndicator
81  //!Description: Stores change to any articulated part. Set to 0 at sim start and incremented
82  //! each time a change occurs, if value > 255 it should be set back to 0.
83  // Parameter: KUINT8 PCI
84  //************************************
85  void SetParameterChangeIndicator( KUINT8 PCI );
86  KUINT8 GetParameterChangeIndicator() const;
87 
88  //************************************
89  // FullName: KDIS::DATA_TYPE::ArticulatedPart::SetAttachementID
90  // KDIS::DATA_TYPE::ArticulatedPart::GetAttachementID
91  //!Description: ID field of the articulated part to which the articulation parameter
92  //! is attached. Field shall be 0 if the part is attached directly
93  //! to the entity.
94  // Parameter: KUINT16 ID
95  //************************************
96  void SetAttachementID( KUINT16 ID );
97  KUINT16 GetAttachementID() const;
98 
99  //************************************
100  // FullName: KDIS::DATA_TYPE::ArticulatedPart::SetTypeVariantClass
101  // KDIS::DATA_TYPE::ArticulatedPart::GetTypeVariantClass
102  //!Description: Identifies a particular articulated part on a given entity type.
103  // Parameter: ArticulatedPartsClass C
104  //************************************
105  void SetTypeVariantClass( KDIS::DATA_TYPE::ENUMS::ArticulatedPartsClass C );
106  KDIS::DATA_TYPE::ENUMS::ArticulatedPartsClass GetTypeVariantClass() const;
107 
108  //************************************
109  // FullName: KDIS::DATA_TYPE::ArticulatedPart::SetTypeVariantMetric
110  // KDIS::DATA_TYPE::ArticulatedPart::GetTypeVariantMetric
111  //!Description: Identifies the transformation to be applied to the articulated part.
112  //! Recommended type of metric:
113  // Horizontal control surfaces - Elevation
114  //! Vertical control surfaces - Azimuth
115  //! Extendible items - Extension
116  //! Fixed path items - Position
117  //! Turrets - Azimuth
118  //! Guns - Elevation
119  //! Movable missile launcher - Azimuth and elevation
120  // Parameter: ArticulatedPartsMetric M
121  //************************************
122  void SetTypeVariantMetric( KDIS::DATA_TYPE::ENUMS::ArticulatedPartsMetric M );
123  KDIS::DATA_TYPE::ENUMS::ArticulatedPartsMetric GetTypeVariantMetric() const;
124 
125  //************************************
126  // FullName: KDIS::DATA_TYPE::ArticulatedPart::SetTypeVariant
127  // KDIS::DATA_TYPE::ArticulatedPart::GetTypeVariant
128  //!Description: TV = Metric + Class.
129  // Parameter: KUINT32 TV
130  //************************************
131  void SetTypeVariant( KUINT32 TV );
132  KUINT32 GetTypeVariant() const;
133 
134  //************************************
135  // FullName: KDIS::DATA_TYPE::ArticulatedPart::SetValue
136  // KDIS::DATA_TYPE::ArticulatedPart::GetValue
137  //!Description: Value.
138  // Parameter: KFLOAT32 val
139  //************************************
140  void SetValue( KFLOAT32 val );
141  KFLOAT32 GetValue() const;
142 
143  //************************************
144  // FullName: KDIS::DATA_TYPE::ArticulatedPart::GetAsString
145  //!Description: Returns a string representation.
146  //************************************
147  virtual KString GetAsString() const;
148 
149  //************************************
150  // FullName: KDIS::DATA_TYPE::ArticulatedPart::Decode
151  //!Description: Convert From Network Data.
152  // Parameter: KDataStream & stream
153  //************************************
154  virtual void Decode( KDataStream & stream ) throw( KException );
155 
156  //************************************
157  // FullName: KDIS::DATA_TYPE::ArticulatedPart::Encode
158  //!Description: Convert To Network Data.
159  // Parameter: KDataStream & stream
160  //************************************
161  virtual KDataStream Encode() const;
162  virtual void Encode( KDataStream & stream ) const;
163 
164  KBOOL operator == ( const ArticulatedPart & Value ) const;
165  KBOOL operator != ( const ArticulatedPart & Value ) const;
166 };
167 
168 } // END namespace DATA_TYPES
169 } // END namespace KDIS
unsigned int KUINT32
Definition: KDefines.h:103
KUINT32 m_ui32Padding
Definition: ArticulatedPart.h:63
unsigned short int KUINT16
Definition: KDefines.h:101
float KFLOAT32
Definition: KDefines.h:113
ArticulatedPartsMetric
Definition: EnumEntityInfoInteraction.h:391
KUINT8 m_ui8ParmeterChange
Definition: ArticulatedPart.h:55
ArticulatedPartsClass
Definition: EnumEntityInfoInteraction.h:441
Definition: ArticulatedPart.h:51
Definition: KDefines.h:182
Definition: KDataStream.h:48
bool KBOOL
Definition: KDefines.h:119
KFLOAT32 m_f32ParamValue
Definition: ArticulatedPart.h:61
std::string KString
Definition: KDefines.h:116
KUINT32 m_ui32ParamTypeVariant
Definition: ArticulatedPart.h:59
unsigned char KUINT8
Definition: KDefines.h:99
KUINT16 m_ui16AttachementID
Definition: ArticulatedPart.h:57
#define KDIS_EXPORT
Definition: KDefines.h:82
Definition: VariableParameter.h:67