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

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

#include <OpenMS/METADATA/MetaInfoRegistry.h>

Public Member Functions

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

Private Attributes

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

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

◆ MetaInfoRegistry() [1/2]

default constructor

◆ MetaInfoRegistry() [2/2]

copy constructor

◆ ~MetaInfoRegistry()

destructor

Member Function Documentation

◆ getDescription() [1/2]

String getDescription ( UInt  index) const

returns the description of an index

Exceptions
Exception::InvalidValueis thrown for unregistered indices

◆ getDescription() [2/2]

String getDescription ( const String name) const

returns the description of a name

Exceptions
Exception::InvalidValueis thrown for unregistered names

◆ getIndex()

UInt getIndex ( const String name) const

Returns the integer index corresponding to a string. If the string is not registered, returns UInt(-1) (= UINT_MAX).

◆ getName()

String getName ( UInt  index) const

Returns the corresponding name to an index.

Exceptions
Exception::InvalidValueis thrown for unregistered indices

◆ getUnit() [1/2]

String getUnit ( UInt  index) const

returns the unit of an index

Exceptions
Exception::InvalidValueis thrown for unregistered indices

◆ getUnit() [2/2]

String getUnit ( const String name) const

returns the unit of a name

Exceptions
Exception::InvalidValueis thrown for unregistered names

◆ operator=()

MetaInfoRegistry& operator= ( const MetaInfoRegistry rhs)

assignment operator

◆ registerName()

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

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.

◆ setDescription() [1/2]

void setDescription ( UInt  index,
const String description 
)

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

Exceptions
Exception::InvalidValueis thrown for unregistered indices

◆ setDescription() [2/2]

void setDescription ( const String name,
const String description 
)

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

Exceptions
Exception::InvalidValueis thrown for unregistered names

◆ setUnit() [1/2]

void setUnit ( UInt  index,
const String unit 
)

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

Exceptions
Exception::InvalidValueis thrown for unregistered indices

◆ setUnit() [2/2]

void setUnit ( const String name,
const String unit 
)

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

Exceptions
Exception::InvalidValueis thrown for unregistered names

Member Data Documentation

◆ index_to_description_

std::map<UInt, String> index_to_description_
private

map from index to description

◆ index_to_name_

std::map<UInt, String> index_to_name_
private

map from index to name

◆ index_to_unit_

std::map<UInt, String> index_to_unit_
private

map from index to unit

◆ name_to_index_

std::map<String, UInt> name_to_index_
private

map from name to index

◆ next_index_

UInt next_index_
private

internal counter, that stores the next index to assign


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