BTK
0.3dev.0
Open-source library to visualize/process biomechanical data
|
Container class to store data of a MetaData object. More...
#include <btkMetaDataInfo.h>
Public Types | |
typedef btkSharedPtr< const MetaDataInfo > | ConstPointer |
enum | Format { Char =-1, Byte =1, Integer =2, Real =4 } |
typedef btkNullPtr< MetaDataInfo > | NullPointer |
typedef btkSharedPtr < MetaDataInfo > | Pointer |
Public Member Functions | |
Pointer | Clone () const |
uint8_t | GetDimension (int idx) const |
const std::vector< uint8_t > & | GetDimensions () const |
int | GetDimensionsProduct (int start=0) const |
Format | GetFormat () const |
std::string | GetFormatAsString () const |
void * | GetValue (int idx) const |
const std::vector< void * > & | GetValues () const |
bool | HasValues () const |
void | ResizeDimensions (int nb) |
void | SetDimension (int idx, uint8_t val) |
void | SetDimensions (const std::vector< uint8_t > &dims) |
void | SetFormat (Format format) |
void | SetValue (int idx, int8_t val) |
void | SetValue (int idx, int16_t val) |
void | SetValue (int idx, float val) |
void | SetValue (int idx, const std::string &val) |
void | SetValue (int idx, int val) |
void | SetValue (int idx, double val) |
void | SetValues (int8_t val) |
void | SetValues (int16_t val) |
void | SetValues (float val) |
void | SetValues (const std::string &val) |
void | SetValues (const std::vector< int8_t > &val) |
void | SetValues (const std::vector< int16_t > &val) |
void | SetValues (const std::vector< float > &val) |
void | SetValues (const std::vector< std::string > &val) |
void | SetValues (const std::vector< uint8_t > &dims, const std::vector< int8_t > &val) |
void | SetValues (const std::vector< uint8_t > &dims, const std::vector< int16_t > &val) |
void | SetValues (const std::vector< uint8_t > &dims, const std::vector< float > &val) |
void | SetValues (const std::vector< uint8_t > &dims, const std::vector< std::string > &val) |
double | ToDouble (int idx) const |
const std::vector< double > | ToDouble () const |
void | ToDouble (std::vector< double > &val) const |
float | ToFloat (int idx) const |
const std::vector< float > | ToFloat () const |
void | ToFloat (std::vector< float > &val) const |
int | ToInt (int idx) const |
const std::vector< int > | ToInt () const |
void | ToInt (std::vector< int > &val) const |
int16_t | ToInt16 (int idx) const |
const std::vector< int16_t > | ToInt16 () const |
void | ToInt16 (std::vector< int16_t > &val) const |
int8_t | ToInt8 (int idx) const |
const std::vector< int8_t > | ToInt8 () const |
void | ToInt8 (std::vector< int8_t > &val) const |
const std::string | ToString (int idx) const |
const std::vector< std::string > | ToString () const |
void | ToString (std::vector< std::string > &val) const |
unsigned int | ToUInt (int idx) const |
const std::vector< unsigned int > | ToUInt () const |
void | ToUInt (std::vector< unsigned int > &val) const |
uint16_t | ToUInt16 (int idx) const |
const std::vector< uint16_t > | ToUInt16 () const |
void | ToUInt16 (std::vector< uint16_t > &val) const |
uint8_t | ToUInt8 (int idx) const |
const std::vector< uint8_t > | ToUInt8 () const |
void | ToUInt8 (std::vector< uint8_t > &val) const |
Static Public Member Functions | |
static Pointer | New (int8_t val) |
static Pointer | New (int16_t val) |
static Pointer | New (float val) |
static Pointer | New (const std::string &val) |
static Pointer | New (const std::vector< int8_t > &val) |
static Pointer | New (const std::vector< int16_t > &val) |
static Pointer | New (const std::vector< float > &val) |
static Pointer | New (const std::vector< std::string > &val) |
static Pointer | New (const std::vector< uint8_t > &dim, const std::vector< int8_t > &val) |
static Pointer | New (const std::vector< uint8_t > &dim, const std::vector< int16_t > &val) |
static Pointer | New (const std::vector< uint8_t > &dim, const std::vector< float > &val) |
static Pointer | New (const std::vector< uint8_t > &dim, const std::vector< std::string > &val) |
static NullPointer | Null () |
Protected Member Functions | |
MetaDataInfo (const std::string &val) | |
MetaDataInfo (const std::vector< std::string > &val) | |
MetaDataInfo (const std::vector< uint8_t > &dims, const std::vector< int8_t > &val) | |
MetaDataInfo (const std::vector< uint8_t > &dims, const std::vector< int16_t > &val) | |
MetaDataInfo (const std::vector< uint8_t > &dims, const std::vector< float > &val) | |
MetaDataInfo (const std::vector< uint8_t > &dims, const std::vector< std::string > &val) | |
Friends | |
bool | operator!= (const MetaDataInfo &rLHS, const MetaDataInfo &rRHS) |
bool | operator== (const MetaDataInfo &rLHS, const MetaDataInfo &rRHS) |
Container class to store data of a MetaData object.
You can store integer value(s), real or string. This class has also methods to convert the native type into other, like integer into string.
Only four types can be stored into a MetaDataInfo object:
Smart pointer associated with a const MetaDataInfo object.
Special null pointer associated with a MetaDataInfo object. This type should be used only internally to test the nullity of a smart pointer. See the static method Null() instead.
Smart pointer associated with a MetaDataInfo object.
|
protected |
Constructor which store val in a Char format with a dimension equal to 1. The dimension's value is equal to the size of val.
|
protected |
Constructor which store val in a Char format as an array (array's dimensions automalicaly generated)
|
protected |
Constructor which store val in a Byte format with the dimensions dims. If the product of the dimensions is not equal to the size of val, then the number of values is adjusted to fit with it. The value added is "0".
|
protected |
Constructor which store val in an Integer format with the dimensions dims. If the product of the dimensions is not equal to the size of val, then the number of values is adjusted to fit with it. The value added is "0".
|
protected |
Constructor which store val in a Real format with the dimensions dims. If the product of the dimensions is not equal to the size of val, then the number of values is adjusted to fit with it. The value added is "0".
|
protected |
Constructor which store val in a Char format with the dimensions dims. If the product of the dimensions is not equal to the size of val, then the number of values is adjusted to fit with it. The value added is " " if the dimension is null. Otherwise, it is a string of white spaces. The size of this string corresponds to the first dimension.
|
inline |
Returns a deep copy of the object as a smart pointer.
uint8_t btk::MetaDataInfo::GetDimension | ( | int | idx | ) | const |
Returns the dimension for the given idx or 0 if idx is out of range.
|
inline |
Returns the dimensions associated with the values.
int btk::MetaDataInfo::GetDimensionsProduct | ( | int | start = 0 | ) | const |
Compute the product of the dimensions from the idx start.
|
inline |
Returns the format of the values.
std::string btk::MetaDataInfo::GetFormatAsString | ( | ) | const |
Returns the format of the values as a string.
void * btk::MetaDataInfo::GetValue | ( | int | idx | ) | const |
Returns the value for the given idx or 0 if idx is out of range.
|
inline |
Returns the values as a vector of strings.
|
inline |
Returns if there is or not some data.
|
inlinestatic |
Creates a smart pointer from the MetaDataInfo(int8_t) constructor.
|
inlinestatic |
Creates a smart pointer from the MetaDataInfo(int16_t) constructor.
|
inlinestatic |
Creates a smart pointer from the MetaDataInfo(float) constructor.
|
inlinestatic |
Creates a smart pointer from the MetaDataInfo(std::string) constructor.
|
inlinestatic |
Creates a smart pointer from the MetaDataInfo(const std::vector<int8_t>&) constructor.
|
inlinestatic |
Creates a smart pointer from the MetaDataInfo(const std::vector<int16_t>&) constructor.
|
inlinestatic |
Creates a smart pointer from the MetaDataInfo(const std::vector<float>&) constructor.
|
inlinestatic |
Creates a smart pointer from the MetaDataInfo(const std::vector<std::string>&) constructor.
|
inlinestatic |
Creates a smart pointer from the MetaDataInfo(const std::vector<uint8_t>&, const std::vector<int8_t>&) constructor.
|
inlinestatic |
Creates a smart pointer from the MetaDataInfo(const std::vector<uint8_t>&, const std::vector<int16_t>&) constructor.
|
inlinestatic |
Creates a smart pointer from the MetaDataInfo(const std::vector<uint8_t>&, const std::vector<float>&) constructor.
|
inlinestatic |
Creates a smart pointer from the MetaDataInfo(const std::vector<uint8_t>&, const std::vector<std::string>&) constructor.
|
inlinestatic |
Static function to return a special null pointer type.
void btk::MetaDataInfo::ResizeDimensions | ( | int | nb | ) |
Resize the dimensions and adapt the values and their structure. If the number of dimensions is greater, then the new dimensions are equal to 1. If the number of dimensions is lower, then the values are shrunken.
void btk::MetaDataInfo::SetDimension | ( | int | idx, |
uint8_t | val | ||
) |
Sets val as the new dimension for the given idx or do nothing if idx is out of range. This method alterates the values' structure and set default values ("0" or a string with white spaces).
void btk::MetaDataInfo::SetDimensions | ( | const std::vector< uint8_t > & | dims | ) |
Sets dims as the new dimensions and adapt the values and their structure. This method can add default values ("0" or a string with white spaces).
void btk::MetaDataInfo::SetFormat | ( | Format | format | ) |
Sets the format of the values and adapt the values. This method erases the values and set default values ("0" or a string with white spaces).
void btk::MetaDataInfo::SetValue | ( | int | idx, |
int8_t | val | ||
) |
Sets val as the value for the given index idx.
void btk::MetaDataInfo::SetValue | ( | int | idx, |
int16_t | val | ||
) |
Sets val as the value (if necessary, adapt it to fit the format) for the given index idx.
void btk::MetaDataInfo::SetValue | ( | int | idx, |
float | val | ||
) |
Sets val as the value (if necessary, adapt it to fit the format) for the given index idx.
void btk::MetaDataInfo::SetValue | ( | int | idx, |
const std::string & | val | ||
) |
Sets val as the value (if necessary, adapt it to fit the format) for the given index idx. Dimensions are updated if necessary.
void btk::MetaDataInfo::SetValue | ( | int | idx, |
int | val | ||
) |
Sets val as the value (if necessary, adapt it to fit the format) for the given index idx.
void btk::MetaDataInfo::SetValue | ( | int | idx, |
double | val | ||
) |
Sets val as the value (if necessary, adapt it to fit the format) for the given index idx.
|
inline |
Overwrite the data to store val in a Byte format with a null dimension.
|
inline |
Overwrite the data to store val in a Integer format with a null dimension.
|
inline |
Overwrite the data to store val in a Real format with a null dimension.
|
inline |
Overwrite the data to store val in a Char format with one dimension equals to the size of the strings.
|
inline |
Overwrite the data to store val in a Byte format as a 1D vector.
|
inline |
Overwrite the data to store val in a Integer format as a 1D vector.
|
inline |
Overwrite the data to store val in a Real format as a 1D vector.
void btk::MetaDataInfo::SetValues | ( | const std::vector< std::string > & | val | ) |
Overwrite the data to store val in a Char format as an array with auto-generated dimensions.
void btk::MetaDataInfo::SetValues | ( | const std::vector< uint8_t > & | dims, |
const std::vector< int8_t > & | val | ||
) |
Overwrite the data to store val in an Byte format with the dimensions dims. If the product of the dimensions is not equal to the size of val, then the number of values is adjusted to fit with it. The value added is "0".
void btk::MetaDataInfo::SetValues | ( | const std::vector< uint8_t > & | dims, |
const std::vector< int16_t > & | val | ||
) |
Overwrite the data to store val in an Integer format with the dimensions dims. If the product of the dimensions is not equal to the size of val, then the number of values is adjusted to fit with it. The value added is "0".
void btk::MetaDataInfo::SetValues | ( | const std::vector< uint8_t > & | dims, |
const std::vector< float > & | val | ||
) |
Overwrite the data to store val in an Real format with the dimensions dims. If the product of the dimensions is not equal to the size of val, then the number of values is adjusted to fit with it. The value added is "0".
void btk::MetaDataInfo::SetValues | ( | const std::vector< uint8_t > & | dims, |
const std::vector< std::string > & | val | ||
) |
Overwrite the data to store val in a Char format with the dimensions dims. If the product of the dimensions is not equal to the size of val, then the number of values is adjusted to fit with it. The value added is " " if the dimension is null. Otherwise, it is a string of white spaces. The size of this string corresponds to the first dimension.
double btk::MetaDataInfo::ToDouble | ( | int | idx | ) | const |
Convert stored value at index idx into double.
const std::vector< double > btk::MetaDataInfo::ToDouble | ( | ) | const |
Convert stored values into a vector of doubles.
void btk::MetaDataInfo::ToDouble | ( | std::vector< double > & | val | ) | const |
Convert stored values into a vector of doubles.
float btk::MetaDataInfo::ToFloat | ( | int | idx | ) | const |
Convert stored value at index idx into float.
const std::vector< float > btk::MetaDataInfo::ToFloat | ( | ) | const |
Convert stored values into a vector of floats.
void btk::MetaDataInfo::ToFloat | ( | std::vector< float > & | val | ) | const |
Convert stored values into a vector of floats.
int btk::MetaDataInfo::ToInt | ( | int | idx | ) | const |
Convert stored value at index idx into integer.
const std::vector< int > btk::MetaDataInfo::ToInt | ( | ) | const |
Convert stored values into a vector of integers.
void btk::MetaDataInfo::ToInt | ( | std::vector< int > & | val | ) | const |
Convert stored values into a vector of integers.
int16_t btk::MetaDataInfo::ToInt16 | ( | int | idx | ) | const |
Convert stored value at index idx into 16-bits integer.
const std::vector< int16_t > btk::MetaDataInfo::ToInt16 | ( | ) | const |
Convert stored values into a vector of 16-bits integers.
void btk::MetaDataInfo::ToInt16 | ( | std::vector< int16_t > & | val | ) | const |
Convert stored values into a vector of 16-bits integers.
int8_t btk::MetaDataInfo::ToInt8 | ( | int | idx | ) | const |
Convert stored value at index idx into 8-bits integer.
const std::vector< int8_t > btk::MetaDataInfo::ToInt8 | ( | ) | const |
Convert stored values into a vector of 8-bits integers.
void btk::MetaDataInfo::ToInt8 | ( | std::vector< int8_t > & | val | ) | const |
Convert stored values into a vector of 8-bits integers.
const std::string btk::MetaDataInfo::ToString | ( | int | idx | ) | const |
Convert stored value at index idx into string.
const std::vector< std::string > btk::MetaDataInfo::ToString | ( | ) | const |
Convert stored value at index idx into string.
void btk::MetaDataInfo::ToString | ( | std::vector< std::string > & | val | ) | const |
Convert stored values into a vector of strings.
unsigned int btk::MetaDataInfo::ToUInt | ( | int | idx | ) | const |
Convert stored value at index idx into unsigned integer.
const std::vector< unsigned int > btk::MetaDataInfo::ToUInt | ( | ) | const |
Convert stored values into a vector of unsigned integers.
void btk::MetaDataInfo::ToUInt | ( | std::vector< unsigned int > & | val | ) | const |
Convert stored values into a vector of unsigned integers.
uint16_t btk::MetaDataInfo::ToUInt16 | ( | int | idx | ) | const |
Convert stored value at index idx into 16-bits unsigned integer.
const std::vector< uint16_t > btk::MetaDataInfo::ToUInt16 | ( | ) | const |
Convert stored values into a vector of 16-bis unsigned integers.
void btk::MetaDataInfo::ToUInt16 | ( | std::vector< uint16_t > & | val | ) | const |
Convert stored values into a vector of 16-bits unsigned integers.
uint8_t btk::MetaDataInfo::ToUInt8 | ( | int | idx | ) | const |
Convert stored value at index idx into 8-bits unsigned integer.
const std::vector< uint8_t > btk::MetaDataInfo::ToUInt8 | ( | ) | const |
Convert stored values into a vector of 8-bits unsigned integers.
void btk::MetaDataInfo::ToUInt8 | ( | std::vector< uint8_t > & | val | ) | const |
Convert stored values into a vector of 8-bits unsigned integers.
|
friend |
Inequality operator.
|
friend |
Equality operator.