Jamoma API  0.6.0.a19
TTValue Class Reference

[doxygenAppendixC_copyExample] More...

#include <TTValue.h>

Inherits std::vector< T >.

Public Member Functions

 TTValue ()
 [doxygenAppendixC_copyExample] More...
 
template<class T >
 TTValue (const T &anInitialValue)
 Constructor with a single initial element. More...
 
 TTValue (const TTFloat64 v)
 Specialized constructor for the float64 case because it is so often performance sensitive. More...
 
template<class T , class U >
 TTValue (const T &aFirstElementInitialValue, const U &aSecondElementInitialValue)
 Constructor with two initial elements. More...
 
template<class T , class U , class V >
 TTValue (const T &aFirstElementInitialValue, const U &aSecondElementInitialValue, const V &aThirdElementInitialValue)
 Constructor with three initial elements. More...
 
template<class T , class U , class V , class W >
 TTValue (const T &aFirstElementInitialValue, const U &aSecondElementInitialValue, const V &aThirdElementInitialValue, const W &aFourthElementInitialValue)
 Constructor with four initial elements. More...
 
 ~TTValue ()
 Destructor.
 
TTFloat64 float64 () const
 Fast fetch of float64 elements without range/type checking or conversion.
 
TTValuefloat64 (TTFloat64 v)
 Fast assignment of float64 elements without range/type checking or conversion. More...
 
void clear ()
 Clear all values from the vector, leaving with size of 0.
 
void copyRange (const TTValue &obj, TTUInt16 startIndex, TTUInt16 endIndex)
 Copy a value starting from an index until another index.
 
void copyFrom (const TTValue &obj, TTUInt16 index)
 Copy a value starting from an index until the last element.
 
void prepend (const TTValue &aValueToPrepend)
 Insert another TTValue before the first element. More...
 
template<class T >
TTValueoperator= (T value)
 Assign a value to TTValue. More...
 
template<class T >
 operator T () const
 Get a value from TTValue.
 
 operator TTSymbol () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
 operator TTObject () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<class T >
void append (const T &anElementValueToAppend)
 Insert a single TTElement at the end.
 
void append (const TTValue &aValueToAppend)
 Insert another TTValue after the last element. More...
 
void clip (const TTFloat64 &aLowBound, const TTFloat64 &aHighBound)
 Clip numerical values between low and high boundaries. More...
 
void cliplow (const TTFloat64 &aLowBound)
 Clip numerical values below a specified boundary. More...
 
void cliphigh (const TTFloat64 &aHighBound)
 Clip numerical values above a specified boundary. More...
 
void fold (const TTFloat64 &aLowBound, const TTFloat64 &aHighBound)
 Fold numerical values to remain between low and high boundaries. More...
 
void wrap (const TTFloat64 &aLowBound, const TTFloat64 &aHighBound)
 Wrap numerical values to remain between low and high boundaries. More...
 
void round ()
 Round float & double elements to the nearest whole number.
 
void truncate ()
 Truncate float & double elements so that only whole number remains.
 
void booleanize ()
 Booleanize numerical elements. More...
 
TTString toString (TTBoolean quotes=YES) const
 Return the content as a single string with spaces between elements. More...
 
void toString (TTBoolean quotes=YES)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void fromString (TTBoolean numberAsSymbol=NO)
 Convert a single string into individual elements using space to divide items. More...
 
TTErr transformCSVStringToSymbolArray ()
 Convert a comma-separated-value string into an array of TTSymbols. More...
 
size_type size () const noexcept
 Return the number of elements. More...
 
void resize (size_type n)
 Change the number of elements. More...
 
TTUInt16 getSize () const
 DEPRECATED. More...
 
void setSize (const TTUInt16 arg)
 DEPRECATED. More...
 
TTDataType getType (const TTUInt16 index=0) const
 DEPRECATED. More...
 
template<class T >
void set (const TTUInt16 index, const T &anElementValue)
 DEPRECATED. More...
 
template<class T >
void get (const TTUInt16 index, T &returnedElementValue) const
 DEPRECATED. More...
 
TTFloat64 getUInt8 (TTUInt16 index=0) const
 DEPRECATED. More...
 
TTFloat64 getInt32 (TTUInt16 index=0) const
 DEPRECATED. More...
 
TTFloat64 getFloat32 (TTUInt16 index=0) const
 DEPRECATED. More...
 
TTFloat64 getFloat64 (TTUInt16 index=0) const
 DEPRECATED. More...
 
void getArray (TTUInt8 *arrayToFill, TTUInt16 maxSize) const
 DEPRECATED. More...
 
void getArray (TTInt32 *arrayToFill, TTUInt16 maxSize) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void getArray (TTFloat32 *arrayToFill, TTUInt16 maxSize) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void getArray (TTFloat64 *arrayToFill, TTUInt16 maxSize) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 

Friends

bool operator== (const TTValue &a, const TTValue &b)
 Test equality of two values.
 
template<class T >
bool operator== (const TTValue &a, const T b)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 

Detailed Description

[doxygenAppendixC_copyExample]

Provides a common way of representing composite values. TTValue is the primary interface used to pass values to and from methods in Jamoma Core. Methods for a given TTObject should be passed both an input and output value to complete its operation, while the return is reserved for a TTErr.

Each TTValue may be composed of a single element or many elements because it has been defined as a subclass of the C++ standard library's vector class. This also enables our class to inherit familiar functions such as size() and from its parent class.

Individual items within the TTValue are defined by the TTElement class. These individual elements may be one of the defined types in the TTDataType enumeration.

Author
Tim Place, Théo de la Hogue, Nathan Wolek, Julien Rabin, Nils Peters, Trond Lossius

Definition at line 34 of file TTValue.h.

Constructor & Destructor Documentation

TTValue::TTValue ( )
inline

[doxygenAppendixC_copyExample]

Constructor for an empty value

Definition at line 40 of file TTValue.h.

template<class T >
TTValue::TTValue ( const T &  anInitialValue)
inline

Constructor with a single initial element.

Definition at line 52 of file TTValue.h.

References resize().

+ Here is the call graph for this function:

TTValue::TTValue ( const TTFloat64  v)
inline

Specialized constructor for the float64 case because it is so often performance sensitive.

Definition at line 59 of file TTValue.h.

References resize().

+ Here is the call graph for this function:

template<class T , class U >
TTValue::TTValue ( const T &  aFirstElementInitialValue,
const U &  aSecondElementInitialValue 
)
inline

Constructor with two initial elements.

Definition at line 67 of file TTValue.h.

References resize().

+ Here is the call graph for this function:

template<class T , class U , class V >
TTValue::TTValue ( const T &  aFirstElementInitialValue,
const U &  aSecondElementInitialValue,
const V &  aThirdElementInitialValue 
)
inline

Constructor with three initial elements.

Definition at line 76 of file TTValue.h.

References resize().

+ Here is the call graph for this function:

template<class T , class U , class V , class W >
TTValue::TTValue ( const T &  aFirstElementInitialValue,
const U &  aSecondElementInitialValue,
const V &  aThirdElementInitialValue,
const W &  aFourthElementInitialValue 
)
inline

Constructor with four initial elements.

Definition at line 86 of file TTValue.h.

References resize().

+ Here is the call graph for this function:

Member Function Documentation

void TTValue::append ( const TTValue aValueToAppend)
inline

Insert another TTValue after the last element.

The following example code would result in TTValue b having elements ordered <ga, bu, zo, meu, 1, 2, 3>:

TTValue a(1, 2, 3);
TTValue b(ga, bu, zo, meu);
b.append(a);

Definition at line 259 of file TTValue.h.

References resize(), and size().

+ Here is the call graph for this function:

void TTValue::booleanize ( )
inline

Booleanize numerical elements.

Sets all non-zero numerical elements to true, while those that are zero will be set to false. Changes the TTDataType of these elements to kTypeBoolean.

Definition at line 342 of file TTValue.h.

void TTValue::clip ( const TTFloat64 aLowBound,
const TTFloat64 aHighBound 
)
inline

Clip numerical values between low and high boundaries.

Parameters
[in]aLowBoundLowest value that should be preserved. Anything lower will be set to this value.
[in]aHighBoundHighest value that should be preserved. Anything higher will be set to this value.
Returns
none

Definition at line 279 of file TTValue.h.

Referenced by TTObjectBase::setAttributeValue().

void TTValue::cliphigh ( const TTFloat64 aHighBound)
inline

Clip numerical values above a specified boundary.

Parameters
[in]aHighBoundHighest value that should be preserved. Anything higher will be set to this value.
Returns
none

Definition at line 299 of file TTValue.h.

Referenced by TTObjectBase::setAttributeValue().

void TTValue::cliplow ( const TTFloat64 aLowBound)
inline

Clip numerical values below a specified boundary.

Parameters
[in]aLowBoundLowest value that should be preserved. Anything lower will be set to this value.
Returns
none

Definition at line 289 of file TTValue.h.

Referenced by LinearAmplitudeUnit::convertToNeutral(), and TTObjectBase::setAttributeValue().

TTValue& TTValue::float64 ( TTFloat64  v)
inline

Fast assignment of float64 elements without range/type checking or conversion.

Parameters
vthe float to assign to this value.
Returns
a reference to this value object.

Definition at line 123 of file TTValue.h.

References float64().

+ Here is the call graph for this function:

void TTValue::fold ( const TTFloat64 aLowBound,
const TTFloat64 aHighBound 
)
inline

Fold numerical values to remain between low and high boundaries.

Parameters
[in]aLowBoundLowest value that should be preserved. Anything lower will be folder.
[in]aHighBoundHighest value that should be preserved. Anything higher will be folded.
Returns
none

Definition at line 310 of file TTValue.h.

void TTValue::fromString ( TTBoolean  numberAsSymbol = NO)
inline

Convert a single string into individual elements using space to divide items.

Parameters
numberAsSymboloptional TTBoolean determines whether method leaves numbers as symbols, default is NO
Returns
none

Definition at line 386 of file TTValue.h.

References TTString::c_str(), clear(), kTypeString, resize(), TTString::size(), and TTString::substr().

Referenced by TTXmlHandler::fromXmlChar().

+ Here is the call graph for this function:

template<class T >
void TTValue::get ( const TTUInt16  index,
T &  returnedElementValue 
) const
inline

DEPRECATED.

Deprecated:
instead, please fetch the value of an element using standard C array syntax.

Old syntax:

TTValue v(3.14);
TTFloat64 mypi;
v.get(0, mypi);

New syntax:

TTValue v(3.14);
TTFloat64 mypi;
mypi = v[0];

Definition at line 591 of file TTValue.h.

void TTValue::getArray ( TTUInt8 arrayToFill,
TTUInt16  maxSize 
) const
inline

DEPRECATED.

Deprecated:
inlined function formerly used by TTMatrix or Jamoma Foundation DataspaceLib

Definition at line 649 of file TTValue.h.

References size().

+ Here is the call graph for this function:

TTFloat64 TTValue::getFloat32 ( TTUInt16  index = 0) const
inline

DEPRECATED.

Deprecated:
inlined function formerly used by TTMatrix or Jamoma Foundation DataspaceLib

Definition at line 635 of file TTValue.h.

TTFloat64 TTValue::getFloat64 ( TTUInt16  index = 0) const
inline

DEPRECATED.

Deprecated:
inlined function formerly used by TTMatrix or Jamoma Foundation DataspaceLib

Definition at line 642 of file TTValue.h.

TTFloat64 TTValue::getInt32 ( TTUInt16  index = 0) const
inline

DEPRECATED.

Deprecated:
inlined function formerly used by TTMatrix or Jamoma Foundation DataspaceLib

Definition at line 628 of file TTValue.h.

TTUInt16 TTValue::getSize ( ) const
inline

DEPRECATED.

Deprecated:
instead, please call the size() method

Definition at line 521 of file TTValue.h.

References size().

+ Here is the call graph for this function:

TTDataType TTValue::getType ( const TTUInt16  index = 0) const
inline

DEPRECATED.

Deprecated:
instead, please call TTElement::type() on the element itself.

Old syntax:

TTValue v(1,2,3);
TTDataType thetype = v.getType(1);

New syntax:

TTValue v(1,2,3);
TTDataType thetype = v[1].type();

Definition at line 548 of file TTValue.h.

TTFloat64 TTValue::getUInt8 ( TTUInt16  index = 0) const
inline

DEPRECATED.

Deprecated:
inlined function formerly used by TTMatrix or Jamoma Foundation DataspaceLib

Definition at line 620 of file TTValue.h.

template<class T >
TTValue& TTValue::operator= ( value)
inline

Assign a value to TTValue.

Overwrites current elements.

Definition at line 175 of file TTValue.h.

References resize().

+ Here is the call graph for this function:

void TTValue::prepend ( const TTValue aValueToPrepend)
inline

Insert another TTValue before the first element.

The following example code would result in TTValue b having elements ordered <1, 2, 3, ga, bu, zo, meu>:

TTValue a(1, 2, 3);
TTValue b(ga, bu, zo, meu);
b.prepend(a);

Definition at line 162 of file TTValue.h.

References append().

Referenced by TTSampleMatrix::load(), ramp_functionParameter(), ramp_schedulerParameter(), TTSampleMatrix::resizeThenLoad(), TTApplicationManagerProtocolActivityInCallback(), TTApplicationManagerProtocolActivityOutCallback(), and TTContainerValueAttributeCallback().

+ Here is the call graph for this function:

void TTValue::resize ( size_type  n)

Change the number of elements.

Inherited from the C++ standard library's vector class

Parameters
nnumber of elements for resulting TTValue
Returns
void

Referenced by append(), Cartesian3DUnit::convertFromNeutral(), CMYUnit::convertFromNeutral(), Cartesian2DUnit::convertFromNeutral(), EulerUnit::convertFromNeutral(), HSLUnit::convertFromNeutral(), SphericalUnit::convertFromNeutral(), AxisUnit::convertFromNeutral(), HSVUnit::convertFromNeutral(), PolarUnit::convertFromNeutral(), OpenGlUnit::convertFromNeutral(), RGB8Unit::convertFromNeutral(), CylindricalUnit::convertFromNeutral(), Cartesian3DUnit::convertToNeutral(), CMYUnit::convertToNeutral(), Cartesian2DUnit::convertToNeutral(), EulerUnit::convertToNeutral(), HSLUnit::convertToNeutral(), SphericalUnit::convertToNeutral(), AxisUnit::convertToNeutral(), HSVUnit::convertToNeutral(), PolarUnit::convertToNeutral(), OpenGlUnit::convertToNeutral(), RGB8Unit::convertToNeutral(), CylindricalUnit::convertToNeutral(), copyRange(), fromString(), TTNode::getAddress(), TTMutesolo::getChannelMute(), TTMutesolo::getChannelSolo(), TTMatrixBase::getDimensions(), TTSpatBase::getSinkPosition(), TTSpatBase::getSourcePosition(), TTSpat::getSpatFunctions(), TTTrajectory::getTypes(), TTAllpass1::init(), TTAverage::init(), jamoma_ttvalue_from_Atom(), operator=(), PackNew(), TTXmlHandler::Read(), setSize(), RosenbergGlottalPulseWindow::test(), TTMatrixBase::test(), KaiserWindow::test(), TTDataParseCommand(), TTDataRampCallback(), TTValue(), and TTXmlHandler::Write().

template<class T >
void TTValue::set ( const TTUInt16  index,
const T &  anElementValue 
)
inline

DEPRECATED.

Deprecated:
instead, please make an assignment using standard C array syntax.

Old syntax:

v.set(0, 3.14);

New syntax:

v[0] = 3.14;

Definition at line 569 of file TTValue.h.

Referenced by TTViewerDataspaceCallback(), and TTViewerDataspaceUnitCallback().

void TTValue::setSize ( const TTUInt16  arg)
inline

DEPRECATED.

Deprecated:
instead, please call the resize() method

Definition at line 528 of file TTValue.h.

References resize().

+ Here is the call graph for this function:

size_type TTValue::size ( ) const
noexcept

Return the number of elements.

Inherited from the C++ standard library's vector class

Parameters
none
Returns
number of elements currently in TTValue

Referenced by append(), TTProtocol::ApplicationRegister(), TTProtocol::ApplicationRename(), TTProtocol::ApplicationUnregister(), copyFrom(), copyRange(), TTMatrixBase::fill(), filter_gettypes(), TTMatrixBase::get(), TTApplicationManager::getApplicationProtocolNames(), getArray(), TTObjectBase::getAttributeNames(), TTEnvironment::getClassNamesWithTags(), TTTrajectory::getCurrentAttributeNames(), TTFreeHandFunction::getCurveList(), TTObjectBase::getMessageNames(), getSize(), TTXmlHandler::getXmlNextAttribute(), jamoma_callback_return_address(), jamoma_callback_return_signal_audio(), jamoma_callback_return_value(), jamoma_callback_return_value_typed(), jamoma_patcher_share_info(), jamoma_subscriber_create(), jamoma_ttvalue_to_Atom(), jamoma_ttvalue_to_typed_Atom(), TTSoundfileLoader::load(), model_get_amenities(), model_preset_edit(), model_set_amenities(), model_subscribe(), TTSampleMatrix::normalize(), TTNodeDirectory::notifyObservers(), operator T(), operator TTObject(), operator TTSymbol(), TTTrajectory::ramp(), ramp_list(), TTXmlHandler::Read(), TTEnvironment::registerClass(), TTNodeDirectory::replaceAlias(), score_doread(), TTAudioObjectBaseArray::set(), TTMatrixBase::set(), TTMutesolo::setChannelMute(), TTMutesolo::setChannelSolo(), TTFreeHandFunction::setCurveList(), TTMatrixBase::setDimensions(), TTClock::setDuration(), TTMultiMixer::setGain(), TTMixer::setGain(), TTUiInfo::setHighlight(), TTMixer::setLinearGain(), TTMixer::setMidiGain(), TTWavetable::setMode(), TTNode::setNameInstance(), TTClock::setOffset(), WindowFunction::setParameter(), TTAttribute::setrange(), TTClock::setSpeed(), TTSampleMatrix::setValueAtIndex(), TTMutesolo::test(), toString(), TTContainerValueAttributeCallback(), TTDataParseCommand(), TTExplorerDirectoryCallback(), TTMapperInputCreationCallback(), TTMapperOutputCreationCallback(), wrapAsMaxAudioGraph(), wrappedModularClass_anything(), wrappedModularClass_attrSet(), wrapTTModularClassAsMaxClass(), wrapTTModularClassAsPdClass(), TTXmlHandler::Write(), TTObjectBase::~TTObjectBase(), and TTProtocol::~TTProtocol().

TTString TTValue::toString ( TTBoolean  quotes = YES) const
inline

Return the content as a single string with spaces between elements.

Parameters
none
Returns
TTString that contains the content of all elements in the TTValue

Definition at line 351 of file TTValue.h.

References TTString::append(), and size().

Referenced by WrappedInputClass_new(), and WrappedOutputClass_new().

+ Here is the call graph for this function:

TTErr TTValue::transformCSVStringToSymbolArray ( )
inline

Convert a comma-separated-value string into an array of TTSymbols.

Returns
kTTErrInvalidType if first item is not kTypeString, else kTTErrNone

Definition at line 463 of file TTValue.h.

References append(), TTString::c_str(), clear(), kTTErrInvalidType, kTTErrNone, kTypeString, and TTString::size().

Referenced by TTEnvironment::registerClass().

+ Here is the call graph for this function:

void TTValue::wrap ( const TTFloat64 aLowBound,
const TTFloat64 aHighBound 
)
inline

Wrap numerical values to remain between low and high boundaries.

Parameters
[in]aLowBoundLowest value that should be preserved. Anything lower will be wrapped.
[in]aHighBoundHighest value that should be preserved. Anything higher will be wrapped.
Returns
none

Definition at line 321 of file TTValue.h.


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