Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Member Functions | Private Attributes

MetaInfoRegistry Class Reference
[Metadata]

Registry which assigns unique integer indices to strings. More...

#include <OpenMS/METADATA/MetaInfoRegistry.h>

List of all members.

Public Member Functions

 MetaInfoRegistry ()
 default constructor
 MetaInfoRegistry (const MetaInfoRegistry &rhs)
 copy constructor
 ~MetaInfoRegistry ()
 destructor
MetaInfoRegistryoperator= (const MetaInfoRegistry &rhs)
 assignment operator
UInt registerName (const String &name, const String &description, const String &unit="") const
void setDescription (UInt index, const String &description)
 Sets the description (String), corresponding to an index.
void setDescription (const String &name, const String &description)
 Sets the description (String), corresponding to a name.
void setUnit (UInt index, const String &unit)
 Sets the unit (String), corresponding to an index.
void setUnit (const String &name, const String &unit)
 Sets the unit (String), corresponding to a name.
UInt getIndex (const String &name) const
String getName (UInt index) const
 Returns the corresponding name to an index.
String getDescription (UInt index) const
 returns the description of an index
String getDescription (const String &name) const
 returns the description of a name
String getUnit (UInt index) const
 returns the unit of an index
String getUnit (const String &name) const
 returns the unit of a name

Private Attributes

UInt next_index_
 internal counter, that stores the next index to assign
std::map< String, UIntname_to_index_
 map from name to index
std::map< UInt, Stringindex_to_name_
 map from index to name
std::map< UInt, Stringindex_to_description_
 map from index to description
std::map< UInt, Stringindex_to_unit_
 map from index to unit

Detailed Description

Registry which assigns unique integer indices to strings.

When registering a new name an index >= 1024 is assigned. Indices from 1 to 1023 are reserved for fast access and will never change:
1 - isotopic_range
2 - cluster_id
3 - label
4 - icon
5 - color
6 - RT
7 - MZ
8 - predicted_RT
9 - predicted_RT_p_value
10 - spectrum_reference
11 - ID
12 - low_quality
13 - charge


Constructor & Destructor Documentation

default constructor

MetaInfoRegistry ( const MetaInfoRegistry rhs  ) 

copy constructor

~MetaInfoRegistry (  ) 

destructor


Member Function Documentation

String getDescription ( UInt  index  )  const

returns the description of an index

Exceptions:
Exception::InvalidValue is thrown for unregistered indices
String getDescription ( const String name  )  const

returns the description of a name

Exceptions:
Exception::InvalidValue is thrown for unregistered names
UInt getIndex ( const String name  )  const

Returns the corresponding integer to a string. If the string is not registered yet, it registers the string (with empty description and empty unit) and returns the corresponding index.

String getName ( UInt  index  )  const

Returns the corresponding name to an index.

Exceptions:
Exception::InvalidValue is thrown for unregistered indices
String getUnit ( UInt  index  )  const

returns the unit of an index

Exceptions:
Exception::InvalidValue is thrown for unregistered indices
String getUnit ( const String name  )  const

returns the unit of a name

Exceptions:
Exception::InvalidValue is thrown for unregistered names
MetaInfoRegistry& operator= ( const MetaInfoRegistry rhs  ) 

assignment operator

UInt registerName ( const String name,
const String description,
const String unit = "" 
) const

Registers a string, stores its description and unit, and returns the corresponding index. If the string is already registered, it returns the index of the string.

Note:
This method is const, because getIndex(..) const must be able to call this method if the requested string is not registered yet. Therefor all changed fields are declared mutable.
void setDescription ( const String name,
const String description 
)

Sets the description (String), corresponding to a name.

Exceptions:
Exception::InvalidValue is thrown for unregistered names
void setDescription ( UInt  index,
const String description 
)

Sets the description (String), corresponding to an index.

Exceptions:
Exception::InvalidValue is thrown for unregistered indices
void setUnit ( const String name,
const String unit 
)

Sets the unit (String), corresponding to a name.

Exceptions:
Exception::InvalidValue is thrown for unregistered names
void setUnit ( UInt  index,
const String unit 
)

Sets the unit (String), corresponding to an index.

Exceptions:
Exception::InvalidValue is thrown for unregistered indices

Member Data Documentation

std::map<UInt, String> index_to_description_ [mutable, private]

map from index to description

std::map<UInt, String> index_to_name_ [mutable, private]

map from index to name

std::map<UInt, String> index_to_unit_ [mutable, private]

map from index to unit

std::map<String, UInt> name_to_index_ [mutable, private]

map from name to index

UInt next_index_ [mutable, private]

internal counter, that stores the next index to assign


OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:56 using doxygen 1.7.1