c3d-utils
|
#include <uuc3d.hpp>
Public Types | |
enum | DataType { DtChar = -1, DtByte = 1, DtShort = 2, DtFloat = 4 } |
Public Member Functions | |
Parameter () | |
Parameter (bool locked, int id, std::string name, int data_type, std::vector< int > const &dimension_size, unsigned char const *data_start, unsigned char const *data_end, std::string const &description, boost::shared_ptr< BasicIO > io) | |
Accessors | |
DataType | data_type () const |
Get the data type of the array elements. | |
std::vector< int > | bounds () const |
Get the bounds of the multidimensional array. | |
unsigned char | get_byte (std::vector< int > const &index) const |
unsigned char | get_byte (int i1) const |
unsigned char | get_the_byte () const |
char | get_char (std::vector< int > const &index) const |
char | get_char (int i1) const |
char | get_the_char () const |
bool | contains_string () const |
std::string | get_string (std::vector< int > const &index) const |
std::string | get_string (int i1) const |
std::string | get_the_string () const |
int | get_short (std::vector< int > const &index) const |
int | get_short (int i1) const |
int | get_the_short () const |
unsigned | get_ushort (std::vector< int > const &index) const |
unsigned | get_ushort (int i1) const |
unsigned | get_the_ushort () const |
float | get_float (std::vector< int > const &index) const |
float | get_float (int i1) const |
float | get_the_float () const |
int | representation_size () const |
std::vector< unsigned char > const & | raw_data () const |
bool | check_index (std::vector< int > const &index) const |
bool | check_string_index (std::vector< int > const &index) const |
Mutating operations | |
This part of the interface is not yet complete. | |
void | set_the_ushort (unsigned16_t val) |
void | set_ushort (int i1, unsigned16_t val) |
void | set_strings (std::vector< std::string > const &strings, char pad) |
A C3d parameter A parameter is a multidimensional array (up to 7 dimensions) of type char, byte, short (16 bit value) or float (32 bit).
An enum describing the four base types that a parameter can contain.
UuIcsC3d::Parameter::Parameter | ( | ) | [inline] |
Constructs an empty parameter. An empty parameter is not valid in a C3d file, so values like id, name, data type and value will have to be set later.
UuIcsC3d::Parameter::Parameter | ( | bool | locked, |
int | id, | ||
std::string | name, | ||
int | data_type, | ||
std::vector< int > const & | dimension_size, | ||
unsigned char const * | data_start, | ||
unsigned char const * | data_end, | ||
std::string const & | description, | ||
boost::shared_ptr< BasicIO > | io | ||
) |
Construct a complete parameter.
[in] | locked | Whether this parameter is locked. |
[in] | id | Numeric identifier. |
[in] | name | Name of the parameter. |
[in] | data_type | One of the enumeration types indicating the type stored in the multidimensional array. |
[in] | dimension_size | Vector describing the number and sizes of the array dimensions. Each dimension size should be positive and not larger than 256. |
[in] | data_start | Begin iterator of an array of unsigned chars storing the raw data of the array. |
[in] | data_end | (Past the) end iterator of an array of unsigned chars storing the raw data of the array. |
[in] | description | Description of the parameter. |
[in] | io | Shared pointer to an IO object for decoding the raw character data. |
bool UuIcsC3d::Parameter::check_index | ( | std::vector< int > const & | index | ) | const |
Checks whether index is valid with respects to the array bounds. The dimension (number of elements) must be the same as the dimension of bounds and for every dimension the value should non negative and less than the value of bounds of that dimension.
bool UuIcsC3d::Parameter::check_string_index | ( | std::vector< int > const & | index | ) | const |
Check whether index is valid for a string access. This is equivalent to appending a 0 to index and then calling check_index(index)
bool UuIcsC3d::Parameter::contains_string | ( | ) | const |
Returns true iff de tata type is DtChar and the array is one or higher dimensional.
unsigned char UuIcsC3d::Parameter::get_byte | ( | int | i1 | ) | const |
Short form for getting a byte for the case that the data array is one dimensional.
unsigned char UuIcsC3d::Parameter::get_byte | ( | std::vector< int > const & | index | ) | const |
Get a byte.
[in] | index | The index (0 based) in the multidimensional array. |
char UuIcsC3d::Parameter::get_char | ( | std::vector< int > const & | index | ) | const |
Get a character.
[in] | index | The index (0 based) in the multidimensional array. |
char UuIcsC3d::Parameter::get_char | ( | int | i1 | ) | const |
Short form for getting a char for the case that the data array is one dimensional.
float UuIcsC3d::Parameter::get_float | ( | std::vector< int > const & | index | ) | const |
Get a float.
[in] | index | The index (0 based) in the multidimensional array. |
float UuIcsC3d::Parameter::get_float | ( | int | i1 | ) | const |
Short form for get_float for the case that the data array is one dimensional.
int UuIcsC3d::Parameter::get_short | ( | std::vector< int > const & | index | ) | const |
Get a short integer.
[in] | index | The index (0 based) in the multidimensional array. |
int UuIcsC3d::Parameter::get_short | ( | int | i1 | ) | const |
Short form for get_short for the case that the data array is one dimensional.
std::string UuIcsC3d::Parameter::get_string | ( | std::vector< int > const & | index | ) | const |
Returns the string indicated by index. All strings in a parameter have the same length. The last value of the bounds indicates the length of each string.
std::string UuIcsC3d::Parameter::get_string | ( | int | i1 | ) | const |
Short form of getting a string for the case that the data array is two dimensional (so can be seen as a one dimensional string array).
unsigned char UuIcsC3d::Parameter::get_the_byte | ( | ) | const |
Shorter form for get_byte for the case that the there is exactly one value in the data array.
char UuIcsC3d::Parameter::get_the_char | ( | ) | const |
Shorter form for get_char for the case that the there is exactly one value in the data array.
float UuIcsC3d::Parameter::get_the_float | ( | ) | const |
Shorter form for get_float for the case that the there is exactly one value in the data array.
int UuIcsC3d::Parameter::get_the_short | ( | ) | const |
Shorter form for get_short for the case that the there is exactly one value in the data array.
std::string UuIcsC3d::Parameter::get_the_string | ( | ) | const |
Shorter form for get_string for the case that the there is exactly one string in the data array.
unsigned UuIcsC3d::Parameter::get_the_ushort | ( | ) | const |
Shorter form for get_ushort for the case that the there is exactly one value in the data array.
unsigned UuIcsC3d::Parameter::get_ushort | ( | std::vector< int > const & | index | ) | const |
Get an unsigned short integer.
[in] | index | The index (0 based) in the multidimensional array. |
unsigned UuIcsC3d::Parameter::get_ushort | ( | int | i1 | ) | const |
Short form for get_ushort for the case that the data array is one dimensional.
std::vector<unsigned char> const& UuIcsC3d::Parameter::raw_data | ( | ) | const [inline] |
The uninterpreted character data as found in the C3d file.
int UuIcsC3d::Parameter::representation_size | ( | ) | const |
Size (in bytes) that this parameter will take when written to a C3d file.
void UuIcsC3d::Parameter::set_strings | ( | std::vector< std::string > const & | strings, |
char | pad | ||
) |
Places an array of strings in the data array and adapts the bounds. All strings will be padded with the pad character such that they are as long as the longest initial string.
void UuIcsC3d::Parameter::set_the_ushort | ( | unsigned16_t | val | ) |
Set the value of the single unsigned short.
void UuIcsC3d::Parameter::set_ushort | ( | int | i1, |
unsigned16_t | val | ||
) |
Set the value of an unsigned short.