Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
MetaInfo Class Reference

A Type-Name-Value tuple class. More...

#include <OpenMS/METADATA/MetaInfo.h>

Public Member Functions

 MetaInfo ()
 Constructor. More...
 
 MetaInfo (const MetaInfo &rhs)
 Copy constructor. More...
 
 ~MetaInfo ()
 Destructor. More...
 
MetaInfooperator= (const MetaInfo &rhs)
 Assignment operator. More...
 
bool operator== (const MetaInfo &rhs) const
 Equality operator. More...
 
bool operator!= (const MetaInfo &rhs) const
 Equality operator. More...
 
const DataValuegetValue (const String &name) const
 Returns the value corresponding to a string (or DataValue::EMPTY if not found) More...
 
const DataValuegetValue (UInt index) const
 Returns the value corresponding to an index (or DataValue::EMPTY if not found) More...
 
bool exists (const String &name) const
 Returns whether an entry with the given name exists. More...
 
bool exists (UInt index) const
 Returns whether an entry with the given index exists. More...
 
void setValue (const String &name, const DataValue &value)
 Sets the DataValue corresponding to a name. More...
 
void setValue (UInt index, const DataValue &value)
 Sets the DataValue corresponding to an index. More...
 
void removeValue (const String &name)
 Removes the DataValue corresponding to name if it exists. More...
 
void removeValue (UInt index)
 Removes the DataValue corresponding to index if it exists. More...
 
void getKeys (std::vector< String > &keys) const
 Fills the given vector with a list of all keys for which a value is set. More...
 
void getKeys (std::vector< UInt > &keys) const
 Fills the given vector with a list of all keys for which a value is set. More...
 
bool empty () const
 Returns if the MetaInfo is empty. More...
 
void clear ()
 Removes all meta values. More...
 

Static Public Member Functions

static MetaInfoRegistryregistry ()
 Returns a reference to the MetaInfoRegistry. More...
 

Private Attributes

std::map< UInt, DataValueindex_to_value_
 The actual mapping of indexes to values. More...
 

Static Private Attributes

static MetaInfoRegistry registry_
 Static MetaInfoRegistry. More...
 

Detailed Description

A Type-Name-Value tuple class.

MetaInfo maps an index (an integer corresponding to a string) to DataValue objects. The mapping of strings to the index is performed 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 string in the MetaInfoRegistry.

If you wish to add a 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 and is more memory efficient if no meta info gets added.

Constructor & Destructor Documentation

◆ MetaInfo() [1/2]

MetaInfo ( )

Constructor.

◆ MetaInfo() [2/2]

MetaInfo ( const MetaInfo rhs)

Copy constructor.

◆ ~MetaInfo()

~MetaInfo ( )

Destructor.

Member Function Documentation

◆ clear()

void clear ( )

Removes all meta values.

◆ empty()

bool empty ( ) const

Returns if the MetaInfo is empty.

◆ exists() [1/2]

bool exists ( const String name) const

Returns whether an entry with the given name exists.

◆ exists() [2/2]

bool exists ( UInt  index) const

Returns whether an entry with the given index exists.

◆ getKeys() [1/2]

void getKeys ( std::vector< String > &  keys) const

Fills the given vector with a list of all keys for which a value is set.

◆ getKeys() [2/2]

void getKeys ( std::vector< UInt > &  keys) const

Fills the given vector with a list of all keys for which a value is set.

◆ getValue() [1/2]

const DataValue& getValue ( const String name) const

Returns the value corresponding to a string (or DataValue::EMPTY if not found)

◆ getValue() [2/2]

const DataValue& getValue ( UInt  index) const

Returns the value corresponding to an index (or DataValue::EMPTY if not found)

◆ operator!=()

bool operator!= ( const MetaInfo rhs) const

Equality operator.

◆ operator=()

MetaInfo& operator= ( const MetaInfo rhs)

Assignment operator.

◆ operator==()

bool operator== ( const MetaInfo rhs) const

Equality operator.

◆ registry()

static MetaInfoRegistry& registry ( )
static

Returns a reference to the MetaInfoRegistry.

◆ removeValue() [1/2]

void removeValue ( const String name)

Removes the DataValue corresponding to name if it exists.

◆ removeValue() [2/2]

void removeValue ( UInt  index)

Removes the DataValue corresponding to index if it exists.

◆ setValue() [1/2]

void setValue ( const String name,
const DataValue value 
)

Sets the DataValue corresponding to a name.

◆ setValue() [2/2]

void setValue ( UInt  index,
const DataValue value 
)

Sets the DataValue corresponding to an index.

Member Data Documentation

◆ index_to_value_

std::map<UInt, DataValue> index_to_value_
private

The actual mapping of indexes to values.

◆ registry_

MetaInfoRegistry registry_
staticprivate

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:10 using doxygen 1.8.13