CiftiLib
A C++ library for CIFTI-2 and CIFTI-1 files
Public Member Functions | List of all members
cifti::MetaData Class Reference

Public Member Functions

 MetaData (const MetaData &o)
 
MetaDataoperator= (const MetaData &o)
 
bool operator== (const MetaData &rhs) const
 
bool operator!= (const MetaData &rhs) const
 
void clear ()
 
void append (const MetaData &smd)
 
void replace (const MetaData &smd)
 
void set (const AString &name, const AString &value)
 
void setInt (const AString &name, const int32_t value)
 
void setFloat (const AString &name, const float value)
 
void replaceWithMap (const std::map< AString, AString > &map)
 
std::map< AString, AString > getAsMap () const
 
void remove (const AString &name)
 
bool exists (const AString &name) const
 
AString get (const AString &name) const
 
int32_t getInt (const AString &name, bool &ok) const
 
float getFloat (const AString &name, bool &ok) const
 
std::vector< AString > getAllMetaDataNames () const
 
void writeCiftiXML1 (XmlWriter &xmlWriter) const
 
void writeCiftiXML2 (XmlWriter &xmlWriter) const
 
void readCiftiXML1 (XmlReader &xml)
 
void readCiftiXML2 (XmlReader &xml)
 

Member Function Documentation

§ append()

void MetaData::append ( const MetaData smd)

Append the metadata to this metadata. A comment is always appended. Other metadata are added only if the name is not in "this" metadata.

Parameters
smdMetadata that is to be appended to "this".

§ clear()

void MetaData::clear ( )

Clear the metadata.

§ exists()

bool MetaData::exists ( const AString &  name) const

See if a metadata entry "name" exists.

Parameters
nameName of metadata entry.
Returns
Returns true if the metadata entry "name" exists, else false.

§ get()

AString MetaData::get ( const AString &  name) const

Get a value for metadata entry.

Parameters
nameName of metadata entry.
Returns
The value of the metadata entry "name". If the metadata entry "name" does not exist an empty string is returned.

§ getAllMetaDataNames()

std::vector< AString > MetaData::getAllMetaDataNames ( ) const

Get names of all metadata.

Returns
List of all metadata names.

§ getAsMap()

std::map< AString, AString > MetaData::getAsMap ( ) const
Returns
ALL of the metadata in map.

§ getFloat()

float MetaData::getFloat ( const AString &  name,
bool &  ok 
) const

Get the metadata as an float value. If the metadata does not exist or its string representation is not a number, zero is returned.

Parameters
name- name of metadata.
ok- is set to false if key not found, or value not numeric
Returns
Float value associated with the metadata.

§ getInt()

int32_t MetaData::getInt ( const AString &  name,
bool &  ok 
) const

Get the metadata as an integer value. If the metadata does not exist or its string representation is not a number, zero is returned.

Parameters
name- name of metadata.
ok- is set to false if key not found, or value not integer
Returns
Integer value associated with the metadata.

§ remove()

void MetaData::remove ( const AString &  name)

Remove a metadata entry.

Parameters
nameName of metadata entry that is to be removed.

§ replace()

void MetaData::replace ( const MetaData smd)

Clears this metadata and then copies all metadata from "smd"

Parameters
smdMetadata that is to be copied to "this".

§ replaceWithMap()

void MetaData::replaceWithMap ( const std::map< AString, AString > &  map)

Replace ALL of the metadata with the data in the given map.

Parameters
mapNew metadata that replaces all existing metadata.

§ set()

void MetaData::set ( const AString &  name,
const AString &  value 
)

Sets metadata. If a metadata entry named "name" already exists, it is replaced.

Parameters
nameName of metadata entry.
valueValue for metadata entry.

§ setFloat()

void MetaData::setFloat ( const AString &  name,
const float  value 
)

Set metadata with an float value.

Parameters
name- name of metadata.
value- value of metadata.

§ setInt()

void MetaData::setInt ( const AString &  name,
const int32_t  value 
)

Set metadata with an integer value.

Parameters
name- name of metadata.
value- value of metadata.

The documentation for this class was generated from the following files: