BTK  0.3dev.0
Open-source library to visualize/process biomechanical data
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends
btk::MetaData Class Reference

Store data which cannot be embedded within timeseries data (calibration matrix, subject informations, ...). More...

#include <btkMetaData.h>

Inheritance diagram for btk::MetaData:
Inheritance graph
[legend]

Public Types

typedef std::list
< MetaData::Pointer >
::const_iterator 
ConstIterator
 
typedef btkSharedPtr< const
MetaData
ConstPointer
 
typedef std::list
< MetaData::Pointer >
::iterator 
Iterator
 
typedef btkNullPtr< MetaDataNullPointer
 
typedef btkSharedPtr< MetaDataPointer
 
- Public Types inherited from btk::DataObjectLabeled
typedef btkSharedPtr< const
DataObjectLabeled
ConstPointer
 
typedef btkSharedPtr
< DataObjectLabeled
Pointer
 
- Public Types inherited from btk::DataObject
typedef btkSharedPtr< const
DataObject
ConstPointer
 
typedef btkNullPtr< DataObjectNullPointer
 
typedef btkSharedPtr< DataObjectPointer
 
- Public Types inherited from btk::Object
typedef btkSharedPtr< const
Object
ConstPointer
 
typedef btkSharedPtr< ObjectPointer
 

Public Member Functions

bool AppendChild (MetaData::Pointer entry)
 
MetaData::Iterator Begin ()
 
MetaData::ConstIterator Begin () const
 
void ClearChildren ()
 
Pointer Clone () const
 
MetaData::Iterator End ()
 
MetaData::ConstIterator End () const
 
MetaDataInfo::Pointer ExtractChildInfo (const std::string &l, MetaDataInfo::Format f, int numDims, bool noPossibleEmptyValue=true)
 
Iterator FindChild (const std::string &label)
 
ConstIterator FindChild (const std::string &label) const
 
MetaData::Pointer GetChild (int idx)
 
MetaData::ConstPointer GetChild (int idx) const
 
MetaData::Pointer GetChild (const std::string &label)
 
MetaData::ConstPointer GetChild (const std::string &label) const
 
int GetChildNumber () const
 
MetaDataInfo::Pointer GetInfo ()
 
MetaDataInfo::ConstPointer GetInfo () const
 
bool GetUnlockState (void) const
 
bool HasChildren () const
 
bool HasInfo () const
 
bool HasMetaDataAsParent () const
 
bool InsertChild (Iterator loc, MetaData::Pointer entry)
 
bool InsertChild (int idx, MetaData::Pointer entry)
 
Iterator RemoveChild (Iterator loc)
 
void RemoveChild (int idx)
 
void RemoveChild (const std::string &label)
 
void SetChild (int idx, MetaData::Pointer entry)
 
void SetInfo (MetaDataInfo::Pointer val)
 
void SetLabel (const std::string &label)
 
void SetParent (DataObject *parent=0)
 
void SetParent (MetaData *parent=0)
 
void SetUnlockState (bool isUnlocked)
 
MetaData::Pointer TakeChild (Iterator loc)
 
MetaData::Pointer TakeChild (int idx)
 
MetaData::Pointer TakeChild (const std::string &label)
 
- Public Member Functions inherited from btk::DataObjectLabeled
const std::string & GetDescription () const
 
const std::string & GetLabel () const
 
virtual void SetDescription (const std::string &description)
 
- Public Member Functions inherited from btk::DataObject
DataObjectGetParent () const
 
bool HasParent () const
 
void Modified ()
 
void SetParent (DataObject *parent)
 
void Update ()
 
- Public Member Functions inherited from btk::Object
unsigned long int GetTimestamp () const
 

Static Public Member Functions

static Pointer New (const std::string &label, const std::string &desc="", bool isUnlocked=true)
 
static Pointer New (const std::string &label, int8_t val, const std::string &desc="", bool isUnlocked=true)
 
static Pointer New (const std::string &label, int16_t val, const std::string &desc="", bool isUnlocked=true)
 
static Pointer New (const std::string &label, float val, const std::string &desc="", bool isUnlocked=true)
 
static Pointer New (const std::string &label, const std::string &val, const std::string &desc="", bool isUnlocked=true)
 
static Pointer New (const std::string &label, const std::vector< int8_t > &val, const std::string &desc="", bool isUnlocked=true)
 
static Pointer New (const std::string &label, const std::vector< int16_t > &val, const std::string &desc="", bool isUnlocked=true)
 
static Pointer New (const std::string &label, const std::vector< float > &val, const std::string &desc="", bool isUnlocked=true)
 
static Pointer New (const std::string &label, const std::vector< std::string > &val, const std::string &desc="", bool isUnlocked=true)
 
static Pointer New (const std::string &label, const std::vector< uint8_t > &dim, const std::vector< int8_t > &val, const std::string &desc="", bool isUnlocked=true)
 
static Pointer New (const std::string &label, const std::vector< uint8_t > &dim, const std::vector< int16_t > &val, const std::string &desc="", bool isUnlocked=true)
 
static Pointer New (const std::string &label, const std::vector< uint8_t > &dim, const std::vector< float > &val, const std::string &desc="", bool isUnlocked=true)
 
static Pointer New (const std::string &label, const std::vector< uint8_t > &dim, const std::vector< std::string > &val, const std::string &desc="", bool isUnlocked=true)
 
static NullPointer Null ()
 
- Static Public Member Functions inherited from btk::DataObject
static NullPointer Null ()
 

Protected Member Functions

 MetaData (const std::string &label, const std::string &desc="", bool isUnlocked=true)
 
 MetaData (const std::string &label, int8_t val, const std::string &desc="", bool isUnlocked=true)
 
 MetaData (const std::string &label, int16_t val, const std::string &desc="", bool isUnlocked=true)
 
 MetaData (const std::string &label, float val, const std::string &desc="", bool isUnlocked=true)
 
 MetaData (const std::string &label, const std::string &val, const std::string &desc="", bool isUnlocked=true)
 
 MetaData (const std::string &label, const std::vector< int8_t > &val, const std::string &desc="", bool isUnlocked=true)
 
 MetaData (const std::string &label, const std::vector< int16_t > &val, const std::string &desc="", bool isUnlocked=true)
 
 MetaData (const std::string &label, const std::vector< float > &val, const std::string &desc="", bool isUnlocked=true)
 
 MetaData (const std::string &label, const std::vector< std::string > &val, const std::string &desc="", bool isUnlocked=true)
 
 MetaData (const std::string &label, const std::vector< uint8_t > &dim, const std::vector< int8_t > &val, const std::string &desc="", bool isUnlocked=true)
 
 MetaData (const std::string &label, const std::vector< uint8_t > &dim, const std::vector< int16_t > &val, const std::string &desc="", bool isUnlocked=true)
 
 MetaData (const std::string &label, const std::vector< uint8_t > &dim, const std::vector< float > &val, const std::string &desc="", bool isUnlocked=true)
 
 MetaData (const std::string &label, const std::vector< uint8_t > &dim, const std::vector< std::string > &val, const std::string &desc="", bool isUnlocked=true)
 
- Protected Member Functions inherited from btk::DataObjectLabeled
 DataObjectLabeled (const std::string &label="", const std::string &description="")
 
 DataObjectLabeled (const DataObjectLabeled &toCopy)
 
- Protected Member Functions inherited from btk::DataObject
 DataObject ()
 
 DataObject (const DataObject &toCopy)
 
virtual ~DataObject ()
 
- Protected Member Functions inherited from btk::Object
 Object ()
 
 Object (const Object &toCopy)
 
virtual ~Object ()
 

Friends

bool operator!= (const MetaData &rLHS, const MetaData &rRHS)
 
bool operator== (const MetaData &rLHS, const MetaData &rRHS)
 

Additional Inherited Members

- Protected Attributes inherited from btk::DataObjectLabeled
std::string m_Description
 
std::string m_Label
 
- Protected Attributes inherited from btk::Object
unsigned long int m_Timestamp
 

Detailed Description

Store data which cannot be embedded within timeseries data (calibration matrix, subject informations, ...).

Each object can store children metadata. Theoretically, the number of sub-level is infinite. However, the main common use of the metadata is to use 2 levels. This use was introduced in the C3D format.

The values in a metadata are stored in a MetaDataInfo object and are accessible using the method GetInfo().

The unlock member accessible using the methods GetUnlock() and SetUnlock() doesn't affect the setting of the values, but is used only to inform the user/developer.

See Also
MetaDataCollapseChildrenValues(), MetaDataCreateChild() (located in btkMetaDataUtils.h) to create or collapse Metadata objects.

Member Typedef Documentation

Const Iterator related to the children of the entry.

Smart pointer associated with a const MetaData object.

Iterator related to the children of the entry.

Special null pointer associated with a MetaData 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 MetaData object.

Constructor & Destructor Documentation

btk::MetaData::MetaData ( const std::string &  label,
const std::string &  desc = "",
bool  isUnlocked = true 
)
protected

Constructor for an entry without a MetaDataInfo.

btk::MetaData::MetaData ( const std::string &  label,
int8_t  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
protected

Constructor for an entry containing a MetaDataInfo with a single BYTE.

btk::MetaData::MetaData ( const std::string &  label,
int16_t  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
protected

Constructor for an entry containing a MetaDataInfo with a single INTEGER.

btk::MetaData::MetaData ( const std::string &  label,
float  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
protected

Constructor for an entry containing a MetaDataInfo with a single FLOAT.

btk::MetaData::MetaData ( const std::string &  label,
const std::string &  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
protected

Constructor for an entry containing a MetaDataInfo with a single string.

btk::MetaData::MetaData ( const std::string &  label,
const std::vector< int8_t > &  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
protected

Constructor for an entry containing a MetaDataInfo of BYTE valuescorresponding to a 1D vector.

btk::MetaData::MetaData ( const std::string &  label,
const std::vector< int16_t > &  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
protected

Constructor for an entry containing a MetaDataInfo of INTEGER values corresponding to a 1D vector.

btk::MetaData::MetaData ( const std::string &  label,
const std::vector< float > &  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
protected

Constructor for an entry containing a MetaDataInfo of FLOAT values corresponding to a 1D vector.

btk::MetaData::MetaData ( const std::string &  label,
const std::vector< std::string > &  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
protected

Constructor for an entry containing a MetaDataInfo of string values corresponding to a 1D vector.

btk::MetaData::MetaData ( const std::string &  label,
const std::vector< uint8_t > &  dim,
const std::vector< int8_t > &  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
protected

Constructor for an entry containing a MetaDataInfo of BYTE values.

btk::MetaData::MetaData ( const std::string &  label,
const std::vector< uint8_t > &  dim,
const std::vector< int16_t > &  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
protected

Constructor for an entry containing a MetaDataInfo of INTEGER values.

btk::MetaData::MetaData ( const std::string &  label,
const std::vector< uint8_t > &  dim,
const std::vector< float > &  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
protected

Constructor for an entry containing a MetaDataInfo of FLOAT values.

btk::MetaData::MetaData ( const std::string &  label,
const std::vector< uint8_t > &  dim,
const std::vector< std::string > &  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
protected

Constructor for an entry containing a MetaDataInfo of string values.

Member Function Documentation

bool btk::MetaData::AppendChild ( MetaData::Pointer  entry)

Append the child entry. If entry has a label which already exists in the parent's list, then it is not inserted.

Returns
True if child has been inserted or false.
MetaData::Iterator btk::MetaData::Begin ( )
inline

Returns an iterator to the beginning of the list of children.

MetaData::ConstIterator btk::MetaData::Begin ( ) const
inline

Returns a const iterator to the beginning of the list of children.

void btk::MetaData::ClearChildren ( )

Removes every children.

MetaData::Pointer btk::MetaData::Clone ( ) const

Returns a deep copy of the object as a smart pointer. The clone doesn't copy the parent's value

MetaData::Iterator btk::MetaData::End ( )
inline

Returns an iterator just past the last child.

MetaData::ConstIterator btk::MetaData::End ( ) const
inline

Returns a const iterator just past the last child.

MetaDataInfo::Pointer btk::MetaData::ExtractChildInfo ( const std::string &  l,
MetaDataInfo::Format  f,
int  numDims,
bool  noPossibleEmptyValue = true 
)

Check if a child exists with the label l and correspond to the given format f plus the number of dimensions numDims with or without values (noPossibleEmptyValue). The informations of the metadata are extracted in info if all the checks are ok. Otherwise, info return an empty MetaDataInfo::Pointer.

MetaData::Iterator btk::MetaData::FindChild ( const std::string &  label)

Finds the children which has the label label and return it as an Iterator

MetaData::ConstIterator btk::MetaData::FindChild ( const std::string &  label) const

Finds the children which has the label label and return it as a ConstIterator

MetaData::Pointer btk::MetaData::GetChild ( int  idx)

Gets the entry for the given idx or throw an exception if the index is out of range.

MetaData::ConstPointer btk::MetaData::GetChild ( int  idx) const

Gets the entry for the given idx or throw an exception if the index is out of range.

MetaData::Pointer btk::MetaData::GetChild ( const std::string &  label)

Gets the entry which this label, or throw an exception if no entry is associated.

MetaData::ConstPointer btk::MetaData::GetChild ( const std::string &  label) const

Gets the entry which this label, or throw an exception if no entry is associated.

int btk::MetaData::GetChildNumber ( ) const
inline

Returns the number of children

MetaDataInfo::Pointer btk::MetaData::GetInfo ( )
inline

Gets the MetaDataInfo associated to the entry.

const MetaDataInfo::Pointer btk::MetaData::GetInfo ( ) const
inline

Gets the MetaDataInfo associated to the entry.

bool btk::MetaData::GetUnlockState ( void  ) const
inline

Gets the unlock state of the entry.

bool btk::MetaData::HasChildren ( ) const
inline

Checks if the entry has children

bool btk::MetaData::HasInfo ( ) const
inline

Checks if a MetaDataInfo is associated with the entry.

bool btk::MetaData::HasMetaDataAsParent ( ) const
inline

Checks if this object has a MetaData object as parents.

bool btk::MetaData::InsertChild ( Iterator  loc,
MetaData::Pointer  entry 
)

Insert the child entry for the given location given by the iterator loc. If entry has a label which already exists in the parent's list, then it is not inserted.

Returns
True if child has been inserted or false.
bool btk::MetaData::InsertChild ( int  idx,
MetaData::Pointer  entry 
)

Insert the child entry for the given idx

MetaData::Pointer btk::MetaData::New ( const std::string &  label,
const std::string &  desc = "",
bool  isUnlocked = true 
)
inlinestatic

Creates a smart pointer from the MetaData(const std::string&, const std::string&, bool) constructor.

MetaData::Pointer btk::MetaData::New ( const std::string &  label,
int8_t  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
inlinestatic

Creates a smart pointer from the MetaData(const std::string&, int8_t, const std::string&, bool) constructor.

MetaData::Pointer btk::MetaData::New ( const std::string &  label,
int16_t  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
inlinestatic

Creates a smart pointer from the MetaData(const std::string&, int16_t, const std::string&, bool) constructor.

MetaData::Pointer btk::MetaData::New ( const std::string &  label,
float  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
inlinestatic

Creates a smart pointer from the MetaData(const std::string&, float, const std::string&, bool) constructor.

MetaData::Pointer btk::MetaData::New ( const std::string &  label,
const std::string &  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
inlinestatic
MetaData::Pointer btk::MetaData::New ( const std::string &  label,
const std::vector< int8_t > &  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
inlinestatic
MetaData::Pointer btk::MetaData::New ( const std::string &  label,
const std::vector< int16_t > &  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
inlinestatic
MetaData::Pointer btk::MetaData::New ( const std::string &  label,
const std::vector< float > &  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
inlinestatic
MetaData::Pointer btk::MetaData::New ( const std::string &  label,
const std::vector< std::string > &  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
inlinestatic
MetaData::Pointer btk::MetaData::New ( const std::string &  label,
const std::vector< uint8_t > &  dim,
const std::vector< int8_t > &  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
inlinestatic
MetaData::Pointer btk::MetaData::New ( const std::string &  label,
const std::vector< uint8_t > &  dim,
const std::vector< int16_t > &  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
inlinestatic
MetaData::Pointer btk::MetaData::New ( const std::string &  label,
const std::vector< uint8_t > &  dim,
const std::vector< float > &  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
inlinestatic
MetaData::Pointer btk::MetaData::New ( const std::string &  label,
const std::vector< uint8_t > &  dim,
const std::vector< std::string > &  val,
const std::string &  desc = "",
bool  isUnlocked = true 
)
inlinestatic
static NullPointer btk::MetaData::Null ( )
inlinestatic

Static function to return a null pointer.

Note
This static method should be used only to test if a shared ponter is null or not. It is advised to call the method without parenthesis as special (in)equality operator are implemented to use a function pointer. See the description of the class NullPtr for an example.
MetaData::Iterator btk::MetaData::RemoveChild ( Iterator  loc)

Removes the child entry at the iterator loc.

void btk::MetaData::RemoveChild ( int  idx)

Removes the child entry at the index idx.

void btk::MetaData::RemoveChild ( const std::string &  label)

Removes the child entry with the label label.

void btk::MetaData::SetChild ( int  idx,
MetaData::Pointer  entry 
)

Sets the child entry for the given idx.

void btk::MetaData::SetInfo ( MetaDataInfo::Pointer  val)
inline

Sets the MetaDataInfo associated to the entry.

void btk::MetaData::SetLabel ( const std::string &  label)
virtual

Sets the label of the entry. If label already exist in the parent's list, then an exception is thrown.

Reimplemented from btk::DataObjectLabeled.

void btk::MetaData::SetParent ( DataObject parent = 0)
inline

Sets the parent of the entry.

void btk::MetaData::SetParent ( MetaData parent = 0)
inline

Sets the parent of the entry.

void btk::MetaData::SetUnlockState ( bool  isUnlocked)
inline

Sets the unlock state of the entry.

MetaData::Pointer btk::MetaData::TakeChild ( Iterator  loc)

Removes the child entry at the location given by the iterator loc and return it. If there is no child at the given location, then an empty Pointer is returned.

MetaData::Pointer btk::MetaData::TakeChild ( int  idx)

Removes the child entry at idx and return it. If there is no child at the given index, then an empty Pointer is returned.

MetaData::Pointer btk::MetaData::TakeChild ( const std::string &  label)

Removes the child entry which has this label and return it. If there is no child with the specified label, then an empty Pointer is returned.

Friends And Related Function Documentation

bool operator!= ( const MetaData rLHS,
const MetaData rRHS 
)
friend

Inequality operator.

bool operator== ( const MetaData rLHS,
const MetaData rRHS 
)
friend

Equality operator. Doesn't check the parent's value.