Jamoma API  0.6.0.a19
TTDataspace Class Reference

Base class for each dataspace. More...

#include <TTDataspace.h>

+ Inheritance diagram for TTDataspace:
+ Collaboration diagram for TTDataspace:

Public Member Functions

 TTDataspace ()
 Constructor.
 
virtual ~TTDataspace ()
 Destructor.
 
TTErr convert (const TTValue &input, TTValue &output)
 Converts a value from one unit to another. More...
 
TTErr setInputUnit (TTSymbol inUnitName)
 Set the input unit type for this dataspace object by it's name as a symbol. More...
 
TTSymbolgetInputUnit ()
 Get the input unit type for this dataspace object as a symbol. More...
 
TTErr setOutputUnit (TTSymbol outUnitName)
 Set the output unit type for this dataspace object by it's name as a symbol. More...
 
TTSymbolgetOutputUnit ()
 Get the output unit type for this dataspace object as a symbol. More...
 
TTErr getAvailableUnits (TTValue &unitNames)
 Return a list of all available units for this dataspace. More...
 

Public Attributes

TTSymbol neutralUnit
 The neutral unit of the dataspace as a symbol.
 

Protected Member Functions

void registerUnit (const TTSymbol &className, const TTSymbol &unitName)
 Called by subclasses to register units with the dataspace. More...
 

Detailed Description

Base class for each dataspace.

Definition at line 30 of file TTDataspace.h.

Member Function Documentation

TTErr TTDataspace::convert ( const TTValue input,
TTValue output 
)

Converts a value from one unit to another.

Internally in the dataspace the conversion is done in two steps: First the input value is converted to the neutral unit, and that value is then converted to the output value. If a dataspace has N alternative units, this prevents us from having to provide NxN methods for conversions. Instead we make do with 2xN methods, making the DataspaceLib more manageable and scaleable.

Parameters
inputThe input value, described using the input unit.
outputThe output value, converted to the output unit.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 36 of file TTDataspace.cpp.

References TTDataspaceUnit::convertFromNeutral(), TTDataspaceUnit::convertToNeutral(), kTTErrNone, and TTDataspaceUnit::name.

+ Here is the call graph for this function:

TTErr TTDataspace::getAvailableUnits ( TTValue unitNames)

Return a list of all available units for this dataspace.

Parameters
unitNamesReturns a list of all available units for this dataspace.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 120 of file TTDataspace.cpp.

References TTHash::getKeys().

+ Here is the call graph for this function:

TTSymbol & TTDataspace::getInputUnit ( )

Get the input unit type for this dataspace object as a symbol.

Returns
Input unit type for this dataspace object as a symbol.

Definition at line 75 of file TTDataspace.cpp.

References TTDataspaceUnit::name.

TTSymbol & TTDataspace::getOutputUnit ( )

Get the output unit type for this dataspace object as a symbol.

Returns
Output unit type for this dataspace object as a symbol.

Definition at line 106 of file TTDataspace.cpp.

References TTDataspaceUnit::name.

void TTDataspace::registerUnit ( const TTSymbol className,
const TTSymbol unitName 
)
protected

Called by subclasses to register units with the dataspace.

Parameters
className
unitName

Definition at line 112 of file TTDataspace.cpp.

References TTHash::append().

+ Here is the call graph for this function:

TTErr TTDataspace::setInputUnit ( TTSymbol  inUnitName)

Set the input unit type for this dataspace object by it's name as a symbol.

Parameters
inUnitNameThe input unit type for this dataspace object as a symbol.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 50 of file TTDataspace.cpp.

References kTTErrNone, TTHash::lookup(), TTDataspaceUnit::name, and TTObjectBaseInstantiate().

+ Here is the call graph for this function:

TTErr TTDataspace::setOutputUnit ( TTSymbol  outUnitName)

Set the output unit type for this dataspace object by it's name as a symbol.

Parameters
outUnitNameThe input unit type for this dataspace object as a symbol.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 81 of file TTDataspace.cpp.

References kTTErrNone, TTHash::lookup(), TTDataspaceUnit::name, and TTObjectBaseInstantiate().

+ Here is the call graph for this function:


The documentation for this class was generated from the following files: