Jamoma API  0.6.0.a19
DistanceDataspace.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup foundationDataspaceLib
4  *
5  * @brief The #DistanceDataspace converts between different measurement untis describing distance.
6  *
7  * @details The neutral unit of the distance dataspace is _meter_.
8  *
9  * @authors Tim Place, Trond Lossius, Nils Peters, ...
10  *
11  * @copyright Copyright © 2007 by Tim Place @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 __DISTANCEDATASPACE_H__
18 #define __DISTANCEDATASPACE_H__
19 
20 #include "TTDataspace.h"
21 
22 
23 /** Base class for the distance dataspace, provides dataspace support for converting distances between radians and degrees.
24  *
25  * @details: meter is the neutral data unit of this dataspace.
26  */
29 
30  /** Unit test for the distance 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 distance to and from centimeter.
39  *
40  * @details This unit is denoted as "cm" or "centimeters".
41  */
44 
45 public:
46 
47  /** Convert from centimeter to neutral unit.
48  @param input Input distance described using centimeter .
49  @param output Returned distance, converted to neutral unit.
50  */
51  void convertToNeutral(const TTValue& input, TTValue& output);
52 
53  /** Convert from neutral unit to centimeter.
54  @param input Input distance described using the neutral unit.
55  @param output Returned distance, described using centimeter.
56  */
57  void convertFromNeutral(const TTValue& input, TTValue& output);
58 };
59 
60 
61 /** Converts distances to and from inch.
62  *
63  * @details This unit is denoted as '"' or 'inches'.
64  */
65 class InchUnit : public TTDataObjectBase, public TTDataspaceUnit {
67 
68 public:
69 
70  /** Convert from inches to neutral unit.
71  @param input Input distance described using inches.
72  @param output Returned distance, converted to neutral unit.
73  */
74  void convertToNeutral(const TTValue& input, TTValue& output);
75 
76  /** Convert from neutral unit to inches.
77  @param input Input distance described using the neutral unit.
78  @param output Returned distance, described using inches.
79  */
80  void convertFromNeutral(const TTValue& input, TTValue& output);
81 };
82 
83 
84 /** Converts distances to and from feet.
85  *
86  * @details This unit is denoted as "feet" or "'".
87  */
88 class FootUnit : public TTDataObjectBase, public TTDataspaceUnit {
90 
91 public:
92 
93  /** Convert from feet to neutral unit.
94  @param input Input distance described using feet .
95  @param output Returned distance, converted to neutral unit.
96  */
97  void convertToNeutral(const TTValue& input, TTValue& output);
98 
99  /** Convert from neutral unit to feet.
100  @param input Input distance described using the neutral unit.
101  @param output Returned distance, described using feet.
102  */
103  void convertFromNeutral(const TTValue& input, TTValue& output);
104 };
105 
106 
107 
108 /** Converts distances to and from meters.
109  *
110  * @details This unit is denoted as "m" or "meters".
111  */
114 
115 public:
116 
117  /** Convert from meters to neutral unit.
118  @param input Input distance described using meters.
119  @param output Returned distance, converted to neutral unit.
120  */
121  void convertToNeutral(const TTValue& input, TTValue& output);
122 
123  /** Convert from neutral unit to meters.
124  @param input Input distance described using the neutral unit.
125  @param output Returned distance, described using meters.
126  */
127  void convertFromNeutral(const TTValue& input, TTValue& output);
128 };
129 
130 
131 #endif // __DISTANCEDATASPACE_H__
void convertToNeutral(const TTValue &input, TTValue &output)
Convert from centimeter to neutral unit.
Converts distance to and from centimeter.
TTDataObjectBase is the base class for all data generating and processing objects.
void convertFromNeutral(const TTValue &input, TTValue &output)
Convert from neutral unit to meters.
#define TTCLASS_SETUP(className)
TODO Doxygen: need more comments here.
Definition: TTFoundation.h:54
Specification for the base class of each DataspaceUnit.
void convertFromNeutral(const TTValue &input, TTValue &output)
Convert from neutral unit to centimeter.
Converts distances to and from meters.
void convertToNeutral(const TTValue &input, TTValue &output)
Convert from inches to neutral unit.
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 distances to and from inch.
Base class for each dataspace.
Definition: TTDataspace.h:30
void convertToNeutral(const TTValue &input, TTValue &output)
Convert from feet to neutral unit.
Base class for the distance dataspace, provides dataspace support for converting distances between ra...
void convertToNeutral(const TTValue &input, TTValue &output)
Convert from meters to neutral unit.
Converts distances to and from feet.
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
void convertFromNeutral(const TTValue &input, TTValue &output)
Convert from neutral unit to inches.
void convertFromNeutral(const TTValue &input, TTValue &output)
Convert from neutral unit to feet.