Jamoma API  0.6.0.a19
TTDataspaceUnit.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup foundationDataspaceLib
4  *
5  * @brief Specification for #TTDataspaceUnit, the base class of each dataspace unit. TODO: Could this be made more descriptive, making it easier to understand how this is distinguished as compared to TTDataspace and TTDataspaceConverter?
6  *
7  * @details A DataspaceUnit converts back and forth between a specific unit and a neutral unit, and is used by DataspaceLib to do a conversion.
8  *
9  * @authors Tim Place, Trond Lossius, ...
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 __TTDATASPACEUNIT_H__
18 #define __TTDATASPACEUNIT_H__
19 
20 #include "TTDataspaceLib.h"
21 
22 
23 /** Specification for the base class of each DataspaceUnit.
24  *
25  @details A DataspaceUnit converts back and forth between a specific unit and a neutral unit, and is used by DataspaceLib to do a conversion.
26  */
28 
29 public:
30  TTSymbol name; ///< Name of this unit.
31 
32 
33  /** Constructor. Must be passed the name of this DataspaceUnit as a TTSymbolPtr.
34  @param arguments Arguments passed to the class when created.
35  */
36  TTDataspaceUnit(TTValue arguments);
37 
38  /** Destructor.
39  */
40  virtual ~TTDataspaceUnit()
41  {
42  ;
43  }
44 
45  /** Converts from an actual unit to a 'neutral' unit that can be interpreted by other units within this dataspace.
46  *
47  * @details This must be defined by a sub-class.
48  *
49  * @param input Input value to be converted .
50  * @param output Returned value, converted to the neutral unit of the dataspace.
51  */
52  //virtual void convertToNeutral(long inputNumArgs, t_atom *inputAtoms, long *outputNumArgs, double *output) = 0;
53  virtual void convertToNeutral(const TTValue& input, TTValue& output) = 0;
54 
55  /** Converts from a neutral unit back to an actual unit.
56  *
57  * @details This must be defined by a sub-class.
58  *
59  * @param input Input value described using the neutral unit.
60  * @param output Returned value, converted to the unit of this class.
61  */
62  //virtual void convertFromNeutral(long inputNumArgs, double *input, long *outputNumArgs, t_atom **outputAtoms) = 0;
63  virtual void convertFromNeutral(const TTValue& input, TTValue& output) = 0;
64 };
65 
67 
68 
69 #endif // __TTDATASPACEUNIT_H__
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
Specification for the base class of each DataspaceUnit.
TTDataspaceUnit(TTValue arguments)
Constructor.
TTSymbol name
Name of this unit.
virtual void convertFromNeutral(const TTValue &input, TTValue &output)=0
Converts from a neutral unit back to an actual unit.
virtual ~TTDataspaceUnit()
Destructor.
virtual void convertToNeutral(const TTValue &input, TTValue &output)=0
Converts from an actual unit to a 'neutral' unit that can be interpreted by other units within this d...
This library provides convertions between different measurement units for values relating to time...
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34