00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef OPENMS_METADATA_METAINFOREGISTRY_H
00028 #define OPENMS_METADATA_METAINFOREGISTRY_H
00029
00030 #include <map>
00031 #include <string>
00032
00033 #include <OpenMS/CONCEPT/Exception.h>
00034 #include <OpenMS/CONCEPT/Types.h>
00035 #include <OpenMS/DATASTRUCTURES/String.h>
00036
00037 namespace OpenMS
00038 {
00039
00061 class MetaInfoRegistry
00062 {
00063 public:
00065 MetaInfoRegistry();
00066
00068 MetaInfoRegistry(const MetaInfoRegistry& rhs);
00069
00071 ~MetaInfoRegistry();
00072
00074 MetaInfoRegistry& operator = (const MetaInfoRegistry& rhs);
00075
00083 UInt registerName(const String& name, const String& description, const String& unit="") const;
00084
00086 void setDescription(UInt index, const String& description) throw(Exception::InvalidValue);
00087
00089 void setDescription(const String& name, const String& description) throw(Exception::InvalidValue);
00090
00092 void setUnit(UInt index, const String& unit) throw(Exception::InvalidValue);
00093
00095 void setUnit(const String& name, const String& unit) throw(Exception::InvalidValue);
00096
00101 UInt getIndex(const String& name) const;
00102
00104 String getName(UInt index) const throw(Exception::InvalidValue);
00105
00107 String getDescription(UInt index) const throw(Exception::InvalidValue);
00109 String getDescription(const String& name) const throw(Exception::InvalidValue);
00110
00112 String getUnit(UInt index) const throw(Exception::InvalidValue);
00114 String getUnit(const String& name) const throw(Exception::InvalidValue);
00115
00116 private:
00118 mutable UInt next_index_;
00120 mutable std::map<String,UInt> name_to_index_;
00122 mutable std::map<UInt,String> index_to_name_;
00124 mutable std::map<UInt,String> index_to_description_;
00126 mutable std::map<UInt,String> index_to_unit_;
00127
00128 };
00129
00130 }
00131
00132 #endif // OPENMS_METADATA_METAINFOREGISTRY_H