Qt Virtual Chart Table (QVCT)
CDataCourse.hpp
Go to the documentation of this file.
1 // INDENTING (emacs/vi): -*- mode:c++; tab-width:2; c-basic-offset:2; intent-tabs-mode:nil; -*- ex: set tabstop=2 expandtab:
2 
3 /*
4  * Qt Virtual Chart Table (QVCT)
5  * Copyright (C) 2012 Cedric Dufour <http://cedric.dufour.name>
6  * Author: Cedric Dufour <http://cedric.dufour.name>
7  *
8  * The Qt Virtual Chart Table (QVCT) is free software:
9  * you can redistribute it and/or modify it under the terms of the GNU General
10  * Public License as published by the Free Software Foundation, Version 3.
11  *
12  * The Qt Virtual Chart Table (QVCT) is distributed in the hope
13  * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
14  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  *
16  * See the GNU General Public License for more details.
17  */
18 
19 #ifndef QVCT_CDATACOURSE_HPP
20 #define QVCT_CDATACOURSE_HPP
21 
22 // QT
23 class QDataStream;
24 
25 
27 
34 {
35 
36  //------------------------------------------------------------------------------
37  // CONSTANTS / STATIC
38  //------------------------------------------------------------------------------
39 
40 public:
42  static constexpr double UNDEFINED_BEARING = -999;
44  static constexpr double UNDEFINED_SPEED = -9999999;
46  static const CDataCourse UNDEFINED;
47 
48 
49  //------------------------------------------------------------------------------
50  // FIELDS
51  //------------------------------------------------------------------------------
52 
53 private:
55 
56  double fdBearing;
58 
59  double fdSpeed;
61 
63 
64 
65  //------------------------------------------------------------------------------
66  // CONSTRUCTORS / DESTRUCTOR
67  //------------------------------------------------------------------------------
68 
69 public:
70  CDataCourse();
74  CDataCourse( double _fdBearing, double _fdSpeed, double _fdSpeedVertical = UNDEFINED_SPEED );
75  CDataCourse( const CDataCourse& _roDataCourse );
76  virtual ~CDataCourse() {};
77 
78 
79  //------------------------------------------------------------------------------
80  // METHODS
81  //------------------------------------------------------------------------------
82 
83  // SETTERS
84 public:
86 
89  void setCourse( double _fdBearing, double _fdSpeed, double _fdSpeedVertical = UNDEFINED_SPEED );
91  void setCourse( const CDataCourse& _roDataCourse );
93 
94  void resetCourse();
96  void setBearing( double _fdBearing ) { fdBearing = _fdBearing; };
98 
101  void setSpeed( double _fdSpeed, double _fdSpeedVertical = UNDEFINED_SPEED ) { fdSpeed = _fdSpeed; fdSpeedVertical = _fdSpeedVertical; };
103 
106  void setSpeedVertical( double _fdSpeedVertical ) { fdSpeedVertical = _fdSpeedVertical; };
108 
110 
111  // GETTERS
112 public:
114  double getBearing() const { return fdBearing; };
116  double getSpeed() const { return fdSpeed; };
118  double getSpeedVertical() const { return fdSpeedVertical; };
119 
120  // OTHER
121 public:
123  void serialize( QDataStream& _rqDataStream ) const;
125  void unserialize( QDataStream& _rqDataStream );
126 
127  // OPERATORS
128 public:
130 
132  bool operator==( const CDataCourse& _roCourse ) const;
134 
136  bool operator!=( const CDataCourse& _roCourse ) const;
137 
138  // COMPARATORS
139 public:
141  static bool compareBearingAscending( const CDataCourse& _roCourse1, const CDataCourse& _roCourse2 );
143  static bool compareBearingDescending( const CDataCourse& _roCourse1, const CDataCourse& _roCourse2 );
145  static bool compareSpeedAscending( const CDataCourse& _roCourse1, const CDataCourse& _roCourse2 );
147  static bool compareSpeedDescending( const CDataCourse& _roCourse1, const CDataCourse& _roCourse2 );
149  static bool compareSpeedVerticalAscending( const CDataCourse& _roCourse1, const CDataCourse& _roCourse2 );
151  static bool compareSpeedVerticalDescending( const CDataCourse& _roCourse1, const CDataCourse& _roCourse2 );
152 
153 };
154 
155 
157 
163 {
164 
165  //------------------------------------------------------------------------------
166  // FIELDS
167  //------------------------------------------------------------------------------
168 
169 public:
174 
175 
176  //------------------------------------------------------------------------------
177  // CONSTRUCTORS / DESTRUCTOR
178  //------------------------------------------------------------------------------
179 
180 public:
181  CDataCourseGA();
182  CDataCourseGA( const CDataCourse& _roDataCourseGround, const CDataCourse& _roDataCourseApparent );
183  virtual ~CDataCourseGA() {};
184 
185 
186  //------------------------------------------------------------------------------
187  // METHODS
188  //------------------------------------------------------------------------------
189 
190  // OTHER
191 public:
193  void serialize( QDataStream& _rqDataStream ) const;
195  void unserialize( QDataStream& _rqDataStream );
196 
197 };
198 
199 #endif // QVCT_CDATACOURSE_HPP
Ground and apparent geographical courses container.
void serialize(QDataStream &_rqDataStream) const
Serializes (store) this object's data to binary format.
virtual ~CDataCourseGA()
void unserialize(QDataStream &_rqDataStream)
Unserializes (restore) this object's data from binary format.
CDataCourse ApparentCourse
Apparent course.
CDataCourse GroundCourse
Ground course.
(Geographical) Course data [bearing, horizontal/vertical speeds]
Definition: CDataCourse.hpp:34
bool operator!=(const CDataCourse &_roCourse) const
Inequality operator.
static bool compareSpeedVerticalDescending(const CDataCourse &_roCourse1, const CDataCourse &_roCourse2)
Vertical speed (descending sort) comparison operator.
static bool compareSpeedVerticalAscending(const CDataCourse &_roCourse1, const CDataCourse &_roCourse2)
Vertical speed (ascending sort) comparison operator.
void resetBearing()
Resets this course's bearing.
Definition: CDataCourse.hpp:99
void setBearing(double _fdBearing)
Sets this course's bearing, in degrees.
Definition: CDataCourse.hpp:96
static bool compareBearingDescending(const CDataCourse &_roCourse1, const CDataCourse &_roCourse2)
Bearing (descending sort) comparison operator.
double getSpeedVertical() const
Returns this course's vertical speed, in meters per second.
double fdSpeedVertical
Vertical speed, in meters per second.
Definition: CDataCourse.hpp:62
static bool compareSpeedAscending(const CDataCourse &_roCourse1, const CDataCourse &_roCourse2)
Horizontal speed (ascending sort) comparison operator.
void resetSpeedVertical()
Resets this course's vertical speed.
bool operator==(const CDataCourse &_roCourse) const
Equality operator.
void resetSpeed()
Resets this course's horizontal speed.
virtual ~CDataCourse()
Definition: CDataCourse.hpp:76
void setSpeed(double _fdSpeed, double _fdSpeedVertical=UNDEFINED_SPEED)
Sets this course's horizontal speed, in meters per second.
double fdSpeed
Horizontal speed, in meters per second.
Definition: CDataCourse.hpp:59
static constexpr double UNDEFINED_BEARING
Specific value for an undefined bearing.
Definition: CDataCourse.hpp:42
static constexpr double UNDEFINED_SPEED
Specific value for an undefined speed.
Definition: CDataCourse.hpp:44
void setCourse(double _fdBearing, double _fdSpeed, double _fdSpeedVertical=UNDEFINED_SPEED)
Sets course values.
Definition: CDataCourse.cpp:72
void serialize(QDataStream &_rqDataStream) const
Serializes (store) this object's data to binary format.
void setSpeedVertical(double _fdSpeedVertical)
Sets this course's vertical speed, in meters per second.
double fdBearing
Bearing, in degrees.
Definition: CDataCourse.hpp:56
void resetCourse()
Resets all values (to an undefined course)
Definition: CDataCourse.cpp:94
double getBearing() const
Returns this course's bearing, in degrees.
static const CDataCourse UNDEFINED
Specific value for an undefined course.
Definition: CDataCourse.hpp:46
static bool compareBearingAscending(const CDataCourse &_roCourse1, const CDataCourse &_roCourse2)
Bearing (ascending sort) comparison operator.
static bool compareSpeedDescending(const CDataCourse &_roCourse1, const CDataCourse &_roCourse2)
Horizontal speed (descending sort) comparison operator.
void unserialize(QDataStream &_rqDataStream)
Unserializes (restore) this object's data from binary format.
double getSpeed() const
Returns this course's horizontal speed, in meters per second.