Jamoma API  0.6.0.a19
SpeedDataspace.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup foundationDataspaceLib
4  *
5  * @brief The #SpeedDataspace converts between different measurement untis describing velocity.
6  *
7  * @details The neutral unit of the speed dataspace is _m/s_.
8  *
9  * @authors Nils Peters, Trond Lossius, Tim Peters, ...
10  *
11  * @copyright Copyright © 2011 by Nils Peters @n
12  * This code is licensed under the terms of the "New BSD License" @n
13  * http://creativecommons.org/licenses/BSD/
14  */
15 
16 
17 #ifndef __SPEEDDATASPACE_H__
18 #define __SPEEDDATASPACE_H__
19 
20 #include "TTDataspace.h"
21 
22 
23 /** Base class for the speed dataspace, provides dataspace support for converting speed between mph, km/h, knot ft/s and m/s.
24  *
25  * @details: _m/s_ is the neutral data unit of this dataspace.
26  */
29 
30  /** Unit test for the speed dataspace.
31  @param returnedTestInfo The outcome from the performed unit test.
32  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
33  */
34  virtual TTErr test(TTValue& returnedTestInfo);
35 };
36 
37 
38 /** Converts speed to and from miles per hour.
39  *
40  * @details This unit is denoted as "mph" or "mi/h".
41  */
44 
45 public:
46 
47  /** Convert from miles per hour to neutral unit.
48  @param input Input speed described using miles per hour .
49  @param output Returned speed, converted to neutral unit.
50  */
51  void convertToNeutral(const TTValue& input, TTValue& output);
52 
53  /** Convert from neutral unit to miles per hour.
54  @param input Input speed described using the neutral unit.
55  @param output Returned speed, described using miles per hour.
56  */
57  void convertFromNeutral(const TTValue& input, TTValue& output);
58 };
59 
60 
61 /** Converts speed to and from kilometers per hour.
62  *
63  * @details This unit is denoted as "km/h" or "kmph".
64  */
67 
68 public:
69 
70  /** Convert from kilometers per hour to neutral unit.
71  @param input Input speed described using kilometers per hour .
72  @param output Returned speed, converted to neutral unit.
73  */
74  void convertToNeutral(const TTValue& input, TTValue& output);
75 
76  /** Convert from neutral unit to radians.
77  @param input Input speed described using the neutral unit.
78  @param output Returned speed, described using kilometers per hour.
79  */
80  void convertFromNeutral(const TTValue& input, TTValue& output);
81 };
82 
83 
84 /** Converts speed to and from foot per second.
85  *
86  * @details This unit is denoted as "ft/s" or "fps".
87  */
90 
91 public:
92 
93  /** Convert from foot per second to neutral unit.
94  @param input Input speed described using foot per second .
95  @param output Returned speed, converted to neutral unit.
96  */
97  void convertToNeutral(const TTValue& input, TTValue& output);
98 
99  /** Convert from neutral unit to foot per second.
100  @param input Input speed described using the neutral unit.
101  @param output Returned speed, described using foot per second.
102  */
103  void convertFromNeutral(const TTValue& input, TTValue& output);
104 };
105 
106 
107 /** Converts speed to and from knot.
108  *
109  * @details This unit is denoted as "kn".
110  */
111 class KnotUnit : public TTDataObjectBase, public TTDataspaceUnit {
113 
114 public:
115 
116  /** Convert from knot to neutral unit.
117  @param input Input speed described using knot .
118  @param output Returned speed, converted to neutral unit.
119  */
120  void convertToNeutral(const TTValue& input, TTValue& output);
121 
122  /** Convert from neutral unit to knot.
123  @param input Input speed described using the neutral unit.
124  @param output Returned speed, described using knot.
125  */
126  void convertFromNeutral(const TTValue& input, TTValue& output);
127 };
128 
129 
130 /** Converts speed to and from meters per second.
131  *
132  * @details This unit is denoted as "m/s".
133  */
136 
137 public:
138 
139  /** Convert from meters per second to neutral unit.
140  @param input Input speed described using meters per second .
141  @param output Returned speed, converted to neutral unit.
142  */
143  void convertToNeutral(const TTValue& input, TTValue& output);
144 
145  /** Convert from neutral unit to meters per second.
146  @param input Input speed described using the neutral unit.
147  @param output Returned speed, described using meters per second.
148  */
149  void convertFromNeutral(const TTValue& input, TTValue& output);
150 };
151 
152 
153 #endif // __SPEEDDATASPACE_H__
Converts speed to and from foot per second.
void convertToNeutral(const TTValue &input, TTValue &output)
Convert from foot per second to neutral unit.
void convertFromNeutral(const TTValue &input, TTValue &output)
Convert from neutral unit to knot.
void convertToNeutral(const TTValue &input, TTValue &output)
Convert from kilometers per hour to neutral unit.
TTDataObjectBase is the base class for all data generating and processing objects.
void convertFromNeutral(const TTValue &input, TTValue &output)
Convert from neutral unit to foot per second.
Converts speed to and from kilometers per hour.
void convertToNeutral(const TTValue &input, TTValue &output)
Convert from knot to neutral unit.
Base class for the speed dataspace, provides dataspace support for converting speed between mph...
Converts speed to and from miles per hour.
#define TTCLASS_SETUP(className)
TODO Doxygen: need more comments here.
Definition: TTFoundation.h:54
Converts speed to and from knot.
void convertToNeutral(const TTValue &input, TTValue &output)
Convert from miles per hour to neutral unit.
Specification for the base class of each DataspaceUnit.
void convertFromNeutral(const TTValue &input, TTValue &output)
Convert from neutral unit to miles per hour.
void convertFromNeutral(const TTValue &input, TTValue &output)
Convert from neutral unit to meters per second.
void convertFromNeutral(const TTValue &input, TTValue &output)
Convert from neutral unit to radians.
Specification for TTDataspace, the base class of each dataspace.
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
Converts speed to and from meters per second.
Base class for each dataspace.
Definition: TTDataspace.h:30
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
void convertToNeutral(const TTValue &input, TTValue &output)
Convert from meters per second to neutral unit.