A class representing a data attribute containing single-precision floats.
More...
#include <FnAttribute.h>
List of all members.
Public Member Functions |
| | FloatAttribute () |
| | FloatAttribute (value_type value) |
| | FloatAttribute (const value_type *values, int64_t valueCount, int64_t tupleSize, void *context=NULL, FnAttributeFreeOwnedDataFunc freeOwnedDataFunc=NULL) |
| | FloatAttribute (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 & |
| void | fillInterpSample (value_type *array, int64_t valueCount, float sampleTime, const value_type defValue=0.f, bool throwOnError=true) const |
| value_type | getValue (const value_type defValue=0.f, 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 () |
Detailed Description
A class representing a data attribute containing single-precision floats.
Constructor & Destructor Documentation
| Foundry::Katana::FloatAttribute::FloatAttribute |
( |
| ) |
[inline] |
Create empty attribute class (isValid() == false).
| Foundry::Katana::FloatAttribute::FloatAttribute |
( |
value_type |
value | ) |
[inline] |
Creates a float attribute containing one value.
- Parameters:
-
| value | The float value for the new attribute |
| Foundry::Katana::FloatAttribute::FloatAttribute |
( |
const value_type * |
values, |
|
|
int64_t |
valueCount, |
|
|
int64_t |
tupleSize, |
|
|
void * |
context = NULL, |
|
|
FnAttributeFreeOwnedDataFunc |
freeOwnedDataFunc = NULL |
|
) |
| [inline] |
Creates a float attribute containing a number of values, grouped into tuples of a given size.
- Parameters:
-
| values | An array of floats 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::FloatAttribute::FloatAttribute |
( |
const float * |
times, |
|
|
int64_t |
timeCount, |
|
|
const value_type ** |
values, |
|
|
int64_t |
valueCount, |
|
|
int64_t |
tupleSize, |
|
|
void * |
context = NULL, |
|
|
FnAttributeFreeOwnedDataFunc |
freeOwnedDataFunc = NULL |
|
) |
| [inline] |
Creates a float 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.
- Parameters:
-
| 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 float 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. |
Member Function Documentation
| void Foundry::Katana::FloatAttribute::fillInterpSample |
( |
value_type * |
array, |
|
|
int64_t |
valueCount, |
|
|
float |
sampleTime, |
|
|
const value_type |
defValue = 0.f, |
|
|
bool |
throwOnError = true |
|
) |
| const |
Fills the interpolated values for an exact time. If the time falls between two samples, the values of the samples are interpolated to make the result. If you wish to interpolate all values in the attr, valueCount should equal attr.getNumberOfValues()
| static FnKatAttributeType Foundry::Katana::FloatAttribute::getKatAttributeType |
( |
| ) |
[inline, static] |
Returns the intended type of this Attribute, without needing a valid handle.
| array_type Foundry::Katana::FloatAttribute::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.
- Note:
- Any pointers or references obtained from the
ConstVector are invalidated if the ConstVector is destructed.
| accessor_type Foundry::Katana::FloatAttribute::getSamples |
( |
| ) |
const [inline] |
| value_type Foundry::Katana::FloatAttribute::getValue |
( |
const value_type |
defValue = 0.f, |
|
|
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.
- Parameters:
-
| 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. |
template<typename T , size_t N>
| T Foundry::Katana::FloatAttribute::getValuesAs |
( |
const T & |
defValue = T(), |
|
|
bool |
throwOnError = true |
|
) |
| const [inline] |
The documentation for this class was generated from the following file: