A class representing a data attribute containing strings.
More...
#include <FnAttribute.h>
List of all members.
Public Member Functions |
| | StringAttribute () |
| | StringAttribute (const std::string &value) |
| | StringAttribute (const char *value) |
| | StringAttribute (const value_type *values, int64_t valueCount, int64_t tupleSize) |
| | StringAttribute (const std::vector< std::string > &stringvec, int64_t tupleSize=1) |
| | StringAttribute (const char **values, int64_t valueCount, int64_t tupleSize) |
| | StringAttribute (const float *times, int64_t timeCount, const char ***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=value_type(), bool throwOnError=true) const |
| template<typename T , size_t N> |
| T | getValuesAs (const T &defValue=T(), bool throwOnError=true) const |
| const char * | getValueCStr (const char *defValue="", bool throwOnError=true) const & |
Static Public Member Functions |
| static FnKatAttributeType | getKatAttributeType () |
Detailed Description
A class representing a data attribute containing strings.
Constructor & Destructor Documentation
| Foundry::Katana::StringAttribute::StringAttribute |
( |
| ) |
[inline] |
Create empty attribute class (isValid() == false).
| Foundry::Katana::StringAttribute::StringAttribute |
( |
const std::string & |
value | ) |
[inline] |
Creates a string attribute containing one value.
- Parameters:
-
| value | The value for the new attribute, in the form of a std::string. |
| Foundry::Katana::StringAttribute::StringAttribute |
( |
const char * |
value | ) |
[inline] |
Creates a string attribute containing one value.
- Parameters:
-
| value | The value for the new attribute, in the form of a C string. |
| Foundry::Katana::StringAttribute::StringAttribute |
( |
const value_type * |
values, |
|
|
int64_t |
valueCount, |
|
|
int64_t |
tupleSize |
|
) |
| |
Creates a string attribute containing a number of values, grouped into tuples of a given size.
- Parameters:
-
| values | An array of std::strings containing the values |
| valueCount | The total number of values. Must be a multiple of tupleSize |
| tupleSize | The size of tuples to group values into. |
| Foundry::Katana::StringAttribute::StringAttribute |
( |
const std::vector< std::string > & |
stringvec, |
|
|
int64_t |
tupleSize = 1 |
|
) |
| |
Creates a string attribute containing a number of values, grouped into tuples of a given size.
- Parameters:
-
| stringvec | A vector of std::string containing the values |
| tupleSize | The size of tuples to group values into. |
| Foundry::Katana::StringAttribute::StringAttribute |
( |
const char ** |
values, |
|
|
int64_t |
valueCount, |
|
|
int64_t |
tupleSize |
|
) |
| [inline] |
Creates a string attribute containing a number of values, grouped into tuples of a given size.
- Parameters:
-
| values | An array of C strings containing the values |
| valueCount | The total number of values. Must be a multiple of tupleSize |
| tupleSize | The size of tuples to group values into. |
| Foundry::Katana::StringAttribute::StringAttribute |
( |
const float * |
times, |
|
|
int64_t |
timeCount, |
|
|
const char *** |
values, |
|
|
int64_t |
valueCount, |
|
|
int64_t |
tupleSize, |
|
|
void * |
context = NULL, |
|
|
FnAttributeFreeOwnedDataFunc |
freeOwnedDataFunc = NULL |
|
) |
| [inline] |
Creates a string 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 C string 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
| static FnKatAttributeType Foundry::Katana::StringAttribute::getKatAttributeType |
( |
| ) |
[inline, static] |
Returns the intended type of this Attribute, without needing a valid handle.
| array_type Foundry::Katana::StringAttribute::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::StringAttribute::getSamples |
( |
| ) |
const [inline] |
| value_type Foundry::Katana::StringAttribute::getValue |
( |
const value_type & |
defValue = value_type(), |
|
|
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. |
| const char* Foundry::Katana::StringAttribute::getValueCStr |
( |
const char * |
defValue = "", |
|
|
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. |
- Warning:
- The pointer returned by this function may be invalidated if *this is destroyed.
template<typename T , size_t N>
| T Foundry::Katana::StringAttribute::getValuesAs |
( |
const T & |
defValue = T(), |
|
|
bool |
throwOnError = true |
|
) |
| const [inline] |
The documentation for this class was generated from the following file: