#include <OpenMS/METADATA/MetaInfo.h>
MetaInfo maps an index ( an integer corresponding to a string ) to DataValue objects. The mapping of strings to the index is perfomed by the MetaInfoRegistry, which can be accessed by the method registry().
There are two versions of nearly all members. One which operates with a string name and another one which operates on an index. The index version is always faster, as it does not need to look up the index corresponding to the the string in the MetaInfoRegistry.
If you wish to add one MetaInfo member to a class, consider deriving that class from MetaInfoInterface, instead of simply adding MetaInfo as member. MetaInfoInterface implements a full interface to a MetaInfo member.
Public Member Functions | |
MetaInfo () | |
constructor | |
MetaInfo (const MetaInfo &rhs) | |
copy constructor | |
~MetaInfo () | |
destructor | |
MetaInfo & | operator= (const MetaInfo &rhs) |
assignment operator | |
bool | operator== (const MetaInfo &rhs) const |
Equality operator. | |
bool | operator!= (const MetaInfo &rhs) const |
Equality operator. | |
const DataValue & | getValue (const String &name) const |
returns the value corresponding to a string | |
const DataValue & | getValue (UInt index) const |
returns the value corresponding to an index | |
bool | exists (const String &name) const |
returns if this MetaInfo is set | |
bool | exists (UInt index) const |
returns if this MetaInfo is set | |
void | setValue (const String &name, const String &value) |
sets the value (string) corresponding to a name | |
void | setValue (UInt index, const String &value) |
sets the value (string) corresponding to an index | |
void | setValue (const String &name, Int value) |
sets the value (integer) corresponding to a name | |
void | setValue (UInt index, Int value) |
sets the value (integer) corresponding to an index | |
void | setValue (const String &name, UInt value) |
sets the value (unsigned integer) corresponding to a name | |
void | setValue (UInt index, UInt value) |
sets the value (unsigned integer) corresponding to an index | |
void | setValue (const String &name, DoubleReal value) |
sets the value (double) corresponding to a name | |
void | setValue (UInt index, DoubleReal value) |
sets the value (double) corresponding to an index | |
void | setValue (const String &name, Real value) |
sets the value (float) corresponding to a name | |
void | setValue (UInt index, Real value) |
sets the value (float) corresponding to an index | |
void | setValue (const String &name, const DataValue &value) |
sets the DataValue corresponding to a name | |
void | setValue (UInt index, const DataValue &value) |
sets the DataValue corresponding to an index | |
void | removeValue (const String &name) |
Removes the DataValue corresponding to name if it exists. | |
void | removeValue (UInt index) |
Removes the DataValue corresponding to index if it exists. | |
void | getKeys (std::vector< String > &keys) const |
fills the given vector with a list of all keys for which a value is set | |
void | getKeys (std::vector< UInt > &keys) const |
fills the given vector with a list of all keys for which a value is set | |
bool | empty () const |
returns if the MetaInfo is empty | |
void | clear () |
removes all meta values | |
Static Public Member Functions | |
static MetaInfoRegistry & | registry () |
returns a reference to the MetaInfoRegistry | |
Private Attributes | |
std::map< UInt, DataValue > | index_to_value_ |
the actual mapping of index to the DataValue | |
Static Private Attributes | |
static MetaInfoRegistry | registry_ |
static MetaInfoRegistry |
MetaInfo | ( | ) |
constructor
~MetaInfo | ( | ) |
destructor
bool operator== | ( | const MetaInfo & | rhs | ) | const |
Equality operator.
bool operator!= | ( | const MetaInfo & | rhs | ) | const |
Equality operator.
sets the value (string) corresponding to a name
sets the value (string) corresponding to an index
sets the value (unsigned integer) corresponding to a name
sets the value (unsigned integer) corresponding to an index
void setValue | ( | const String & | name, | |
DoubleReal | value | |||
) |
sets the value (double) corresponding to a name
void setValue | ( | UInt | index, | |
DoubleReal | value | |||
) |
sets the value (double) corresponding to an index
sets the DataValue corresponding to a name
static MetaInfoRegistry& registry | ( | ) | [static] |
returns a reference to the MetaInfoRegistry
void getKeys | ( | std::vector< String > & | keys | ) | const |
fills the given vector with a list of all keys for which a value is set
void getKeys | ( | std::vector< UInt > & | keys | ) | const |
fills the given vector with a list of all keys for which a value is set
bool empty | ( | ) | const |
returns if the MetaInfo is empty
void clear | ( | ) |
removes all meta values
MetaInfoRegistry registry_ [static, private] |
static MetaInfoRegistry
std::map<UInt,DataValue> index_to_value_ [private] |
the actual mapping of index to the DataValue
Generated Tue Apr 1 15:36:46 2008 -- using doxygen 1.5.4 | OpenMS / TOPP 1.1 |