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

IMSElement.h

Go to the documentation of this file.
00001 // --------------------------------------------------------------------------
00002 //                   OpenMS -- Open-Source Mass Spectrometry
00003 // --------------------------------------------------------------------------
00004 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
00005 // ETH Zurich, and Freie Universitaet Berlin 2002-2012.
00006 //
00007 // This software is released under a three-clause BSD license:
00008 //  * Redistributions of source code must retain the above copyright
00009 //    notice, this list of conditions and the following disclaimer.
00010 //  * Redistributions in binary form must reproduce the above copyright
00011 //    notice, this list of conditions and the following disclaimer in the
00012 //    documentation and/or other materials provided with the distribution.
00013 //  * Neither the name of any author or any participating institution
00014 //    may be used to endorse or promote products derived from this software
00015 //    without specific prior written permission.
00016 // For a full list of authors, refer to the file AUTHORS.
00017 // --------------------------------------------------------------------------
00018 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00019 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
00022 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00023 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00024 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00025 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00026 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00027 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00028 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029 //
00030 // --------------------------------------------------------------------------
00031 // $Maintainer: Stephan Aiche $
00032 // $Authors: Anton Pervukhin <Anton.Pervukhin@CeBiTec.Uni-Bielefeld.DE> $
00033 // --------------------------------------------------------------------------
00034 //
00035 
00036 #ifndef OPENMS_CHEMISTRY_MASSDECOMPOSITION_IMS_IMSELEMENT_H
00037 #define OPENMS_CHEMISTRY_MASSDECOMPOSITION_IMS_IMSELEMENT_H
00038 
00039 #include <string>
00040 #include <ostream>
00041 #include <iostream>
00042 
00043 #include <OpenMS/CHEMISTRY/MASSDECOMPOSITION/IMS/IMSIsotopeDistribution.h>
00044 
00045 namespace OpenMS
00046 {
00047   namespace ims
00048   {
00049 
00061     class OPENMS_DLLAPI IMSElement
00062     {
00063 public:
00065       typedef std::string name_type;
00066 
00068       typedef IMSIsotopeDistribution isotopes_type;
00069 
00071       typedef isotopes_type::mass_type mass_type;
00072 
00074       typedef isotopes_type::nominal_mass_type nominal_mass_type;
00075 
00077       typedef isotopes_type::size_type size_type;
00078 
00080       static const mass_type ELECTRON_MASS_IN_U;
00081 
00083       IMSElement()
00084       {}
00085 
00087       IMSElement(const IMSElement & element) :
00088         name_(element.name_),
00089         sequence_(element.sequence_),
00090         isotopes_(element.isotopes_)
00091       {}
00092 
00094       IMSElement(const name_type & name,
00095                  const isotopes_type & isotopes) :
00096         name_(name),
00097         sequence_(name),
00098         isotopes_(isotopes)
00099       {}
00100 
00102       IMSElement(const name_type & name,
00103                  mass_type mass) :
00104         name_(name),
00105         sequence_(name),
00106         isotopes_(mass)
00107       {}
00108 
00110       IMSElement(const name_type & name,
00111                  nominal_mass_type nominal_mass = 0) :
00112         name_(name),
00113         sequence_(name),
00114         isotopes_(nominal_mass)
00115       {}
00116 
00123       const name_type & getName() const
00124       {
00125         return name_;
00126       }
00127 
00134       void setName(const name_type & name)
00135       {
00136         this->name_ = name;
00137       }
00138 
00144       const name_type & getSequence() const
00145       {
00146         return sequence_;
00147       }
00148 
00154       void setSequence(const name_type & sequence)
00155       {
00156         this->sequence_ = sequence;
00157       }
00158 
00164       nominal_mass_type getNominalMass() const
00165       {
00166         return isotopes_.getNominalMass();
00167       }
00168 
00175       mass_type getMass(size_type index = 0) const
00176       {
00177         return isotopes_.getMass(index);
00178       }
00179 
00185       mass_type getAverageMass() const
00186       {
00187         return isotopes_.getAverageMass();
00188       }
00189 
00196       mass_type getIonMass(int electrons_number = 1) const
00197       {
00198         return this->getMass() - electrons_number * ELECTRON_MASS_IN_U;
00199       }
00200 
00206       const IMSIsotopeDistribution & getIsotopeDistribution() const
00207       {
00208         return isotopes_;
00209       }
00210 
00216       void setIsotopeDistribution(const IMSIsotopeDistribution & isotopes)
00217       {
00218         this->isotopes_ = isotopes;
00219       }
00220 
00227       IMSElement & operator=(const IMSElement & element);
00228 
00236       bool operator==(const IMSElement & element) const;
00237 
00245       bool operator!=(const IMSElement & element) const;
00246 
00248       virtual ~IMSElement() {}
00249 
00250 private:
00252       name_type name_;
00253 
00255       name_type sequence_;
00256 
00258       isotopes_type isotopes_;
00259     };
00260 
00267     OPENMS_DLLAPI std::ostream & operator<<(std::ostream & os, const IMSElement & element);
00268 
00269   } // namespace ims
00270 } // namespace OpenMS
00271 
00272 #endif // OPENMS_CHEMISTRY_MASSDECOMPOSITION_IMS_ELEMENT_H

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