chore: KDIS datatypes
[KDIS.git] / KDIS / DataTypes / VectoringNozzleSystem.cpp
blobafd0a0b8cb352e001195107b364fd4a765c514a9
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 #include "./VectoringNozzleSystem.h"
32 using namespace KDIS;
33 using namespace DATA_TYPE;
34 using namespace ENUMS;
36 //////////////////////////////////////////////////////////////////////////
37 // Public:
38 //////////////////////////////////////////////////////////////////////////
40 VectoringNozzleSystem::VectoringNozzleSystem() :
41 m_f32HDeflAngle( 0 ),
42 m_f32VDeflAngle( 0 )
46 //////////////////////////////////////////////////////////////////////////
48 VectoringNozzleSystem::VectoringNozzleSystem( KDataStream & stream )
50 Decode( stream );
53 //////////////////////////////////////////////////////////////////////////
55 VectoringNozzleSystem::VectoringNozzleSystem( KFLOAT32 HorizontalDeflectionAngle, KFLOAT32 VerticalDeflectionAngle ) :
56 m_f32HDeflAngle( HorizontalDeflectionAngle ),
57 m_f32VDeflAngle( VerticalDeflectionAngle )
61 //////////////////////////////////////////////////////////////////////////
63 VectoringNozzleSystem::~VectoringNozzleSystem()
67 //////////////////////////////////////////////////////////////////////////
69 void VectoringNozzleSystem::SetHorizontalDeflectionAngle( KFLOAT32 HDA )
71 m_f32HDeflAngle = HDA;
74 //////////////////////////////////////////////////////////////////////////
76 KFLOAT32 VectoringNozzleSystem::GetHorizontalDeflectionAngle() const
78 return m_f32HDeflAngle;
81 //////////////////////////////////////////////////////////////////////////
83 void VectoringNozzleSystem::SetVerticalDeflectionAngle( KFLOAT32 VDA )
85 m_f32VDeflAngle = VDA;
88 //////////////////////////////////////////////////////////////////////////
90 KFLOAT32 VectoringNozzleSystem::GetVerticalDeflectionAngle() const
92 return m_f32VDeflAngle;
95 //////////////////////////////////////////////////////////////////////////
97 KString VectoringNozzleSystem::GetAsString() const
99 KStringStream ss;
101 ss << "Vectoring Nozzle System:"
102 << "\n\tHorizontal Deflection Angle: " << m_f32HDeflAngle
103 << "\n\tVertical Deflection Angle: " << m_f32VDeflAngle
104 << "\n";
106 return ss.str();
109 //////////////////////////////////////////////////////////////////////////
111 void VectoringNozzleSystem::Decode( KDataStream & stream )
113 if( stream.GetBufferSize() < VECTORING_NOZZLE_SYSTEM_SIZE )throw KException( __FUNCTION__, NOT_ENOUGH_DATA_IN_BUFFER );
115 stream >> m_f32HDeflAngle
116 >> m_f32VDeflAngle;
119 //////////////////////////////////////////////////////////////////////////
121 KDataStream VectoringNozzleSystem::Encode() const
123 KDataStream stream;
125 VectoringNozzleSystem::Encode( stream );
127 return stream;
130 //////////////////////////////////////////////////////////////////////////
132 void VectoringNozzleSystem::Encode( KDataStream & stream ) const
134 stream << m_f32HDeflAngle
135 << m_f32VDeflAngle;
138 //////////////////////////////////////////////////////////////////////////
140 KBOOL VectoringNozzleSystem::operator == ( const VectoringNozzleSystem & Value ) const
142 if( m_f32HDeflAngle != Value.m_f32HDeflAngle ) return false;
143 if( m_f32VDeflAngle != Value.m_f32VDeflAngle ) return false;
144 return true;
147 //////////////////////////////////////////////////////////////////////////
149 KBOOL VectoringNozzleSystem::operator != ( const VectoringNozzleSystem & Value ) const
151 return !( *this == Value );
154 //////////////////////////////////////////////////////////////////////////