Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

MetaInfoRegistry.h (Maintainer: Marc Sturm)

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // --------------------------------------------------------------------------
00005 //                   OpenMS Mass Spectrometry Framework
00006 // --------------------------------------------------------------------------
00007 //  Copyright (C) 2003-2008 -- Oliver Kohlbacher, Knut Reinert
00008 //
00009 //  This library is free software; you can redistribute it and/or
00010 //  modify it under the terms of the GNU Lesser General Public
00011 //  License as published by the Free Software Foundation; either
00012 //  version 2.1 of the License, or (at your option) any later version.
00013 //
00014 //  This library is distributed in the hope that it will be useful,
00015 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 //  Lesser General Public License for more details.
00018 //
00019 //  You should have received a copy of the GNU Lesser General Public
00020 //  License along with this library; if not, write to the Free Software
00021 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //
00023 // --------------------------------------------------------------------------
00024 // $Maintainer: Marc Sturm $
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 } // namespace OpenMS
00131 
00132 #endif // OPENMS_METADATA_METAINFOREGISTRY_H

Generated Tue Apr 1 15:36:36 2008 -- using doxygen 1.5.4 OpenMS / TOPP 1.1