|
Katana Plug-in APIs 0.1
|
A class representing a data attribute containing integers. More...
#include <FnAttribute.h>
Public Member Functions | |
| IntAttribute () | |
| IntAttribute (value_type value) | |
| IntAttribute (const value_type *values, int64_t valueCount, int64_t tupleSize, void *context=NULL, FnAttributeFreeOwnedDataFunc freeOwnedDataFunc=NULL) | |
| IntAttribute (const float *times, int64_t timeCount, const value_type **values, int64_t valueCount, int64_t tupleSize, void *context=NULL, FnAttributeFreeOwnedDataFunc freeOwnedDataFunc=NULL) | |
| accessor_type | getSamples () const & |
| array_type | getNearestSample (float time) const & |
| value_type | getValue (const value_type defValue=0, bool throwOnError=true) const |
| template<typename T , size_t N> | |
| T | getValuesAs (const T &defValue=T(), bool throwOnError=true) const |
Static Public Member Functions | |
| static FnKatAttributeType | getKatAttributeType () |
A class representing a data attribute containing integers.
| Foundry::Katana::IntAttribute::IntAttribute | ( | ) | [inline] |
Create empty attribute class (isValid() == false).
| Foundry::Katana::IntAttribute::IntAttribute | ( | value_type | value | ) | [inline] |
Creates an integer attribute containing one value.
| value | The integer value for the new attribute |
| Foundry::Katana::IntAttribute::IntAttribute | ( | const value_type * | values, |
| int64_t | valueCount, | ||
| int64_t | tupleSize, | ||
| void * | context = NULL, |
||
| FnAttributeFreeOwnedDataFunc | freeOwnedDataFunc = NULL |
||
| ) | [inline] |
Creates an integer attribute containing a number of values, grouped into tuples of a given size.
Specifying values for context and freeOwnedDataFunc will cause the constructor to take ownership of the memory pointed to by values. It is the responsibility of freeOwnedDataFunc to deallocate this memory when called.
| values | An array of integers containing the values |
| valueCount | The total number of values. Must be a multiple of tupleSize |
| tupleSize | The size of tuples to group values into. |
| context | User supplied data passed to freeOwnedDataFunc. |
| freeOwnedDataFunc | Pointer to function that will be called when values' memory is to be returned to the operating system. |
| Foundry::Katana::IntAttribute::IntAttribute | ( | const float * | times, |
| int64_t | timeCount, | ||
| const value_type ** | values, | ||
| int64_t | valueCount, | ||
| int64_t | tupleSize, | ||
| void * | context = NULL, |
||
| FnAttributeFreeOwnedDataFunc | freeOwnedDataFunc = NULL |
||
| ) | [inline] |
Creates an integer attribute containing several timed samples, each containing a number of values, grouped into tuples of a given size.
Specifying values for context and freeOwnedDataFunc will cause the constructor to take ownership of the memory pointed to by values. It is the responsibility of freeOwnedDataFunc to deallocate this memory when called.
Note: when using the 'zero copy' version of this constructor copies of the pointers in times and values will be taken, only management of the memory pointed to by values will be transferred to the attribute.
| times | An array of floats, giving the times of the samples. |
| timeCount | The number of samples for which there is data |
| values | An array of pointers to integer arrays containing values. There must be timeCount arrays, each of which has valueCount values. |
| valueCount | The total number of values in each sample. Must be a multiple of tupleSize |
| tupleSize | The size of tuples to group values into. |
| context | User supplied data passed to freeOwnedDataFunc. |
| freeOwnedDataFunc | Pointer to function that will be called when values' memory is to be returned to the operating system. |
| static FnKatAttributeType Foundry::Katana::IntAttribute::getKatAttributeType | ( | ) | [inline, static] |
Returns the intended type of this Attribute, without needing a valid handle.
| array_type Foundry::Katana::IntAttribute::getNearestSample | ( | float | time | ) | const [inline] |
Returns a ConstVector object that provides a read-only view into values of the sample nearest to the given time.
ConstVector are invalidated if the ConstVector is destructed. | accessor_type Foundry::Katana::IntAttribute::getSamples | ( | ) | const [inline] |
Returns a SampleAccessor object that provides a read-only view into all time samples of the Attribute.
SampleAccessor are invalidated if the SampleAccessor is destructed. | value_type Foundry::Katana::IntAttribute::getValue | ( | const value_type | defValue = 0, |
| bool | throwOnError = true |
||
| ) | const [inline] |
Returns first value from the time sample nearest 0.0. This is a convenience for the extremely common case of an attribute that stores a single sample of a single value at time 0.0. By default, throws std::runtime_error if there are no time samples or no values available.
| defValue | The value to return if an error occurs and throwOnError is false. |
| throwOnError | When error occurs, if true, throw std::runtime_error. If false, return defValue. |
| T Foundry::Katana::IntAttribute::getValuesAs | ( | const T & | defValue = T(), |
| bool | throwOnError = true |
||
| ) | const [inline] |
Convenience function that creates an object of type T by passing the first N values from time sample nearest t=0.0.
Example:
Matrix44<int> m44i = myAttr.getValuesAs<Matrix44<int>, 16>();
| T | The type of object to construct. |
| N | The number of values to pass to T's constructor. |
| defValue | The value to return if throwOnError is false and the attribute has either no time samples, or less than N values per sample. |
| throwOnError | Whether to throw an exception if the attribute has no time samples or has less than N values per sample. |
| std::runtime_error | if an error occurs and throwOnError is true. |
References Foundry::Katana::SampleAccessorBase< ValueT >::empty(), Foundry::Katana::Sample< ValueT >::getAs(), Foundry::Katana::SampleAccessor< ValueT >::getNearestSample(), and Foundry::Katana::SampleAccessorBase< ValueT >::getNumberOfValues().
1.7.3