OpenMS  2.7.0
Element.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2021.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Timo Sachsenberg $
32 // $Authors: Andreas Bertsch $
33 // --------------------------------------------------------------------------
34 //
35 
36 #pragma once
37 
38 #include <OpenMS/CONCEPT/Types.h>
41 
42 #include <string>
43 
44 #define OPENMS_CHEMISTRY_ELEMENT_NAME_DEFAULT "unknown"
45 #define OPENMS_CHEMISTRY_ELEMENT_SYMBOL_DEFAULT "??"
46 #define OPENMS_CHEMISTRY_ELEMENT_WEIGHT_DEFAULT 0.0
47 #define OPENMS_CHEMISTRY_ELEMENT_ATOMICNUMBER_DEFAULT 0
48 
49 namespace OpenMS
50 {
55  class OPENMS_DLLAPI Element
56  {
57 public:
58 
59 
65 
67  Element(const Element & element);
68 
70  Element(const std::string & name,
71  const std::string & symbol,
72  unsigned int atomic_number,
73  double average_weight,
74  double mono_weight,
75  const IsotopeDistribution & isotopes);
76 
78  virtual ~Element();
80 
85  void setAtomicNumber(unsigned int atomic_number);
86 
88  unsigned int getAtomicNumber() const;
89 
91  void setAverageWeight(double weight);
92 
94  double getAverageWeight() const;
95 
97  void setMonoWeight(double weight);
98 
100  double getMonoWeight() const;
101 
104 
107 
109  void setName(const std::string & name);
110 
112  const std::string & getName() const;
113 
115  void setSymbol(const std::string & symbol);
116 
118  const std::string & getSymbol() const;
120 
125  Element & operator=(const Element & element);
127 
132  bool operator==(const Element & element) const;
133 
135  bool operator!=(const Element & element) const;
136 
138  bool operator<(const Element & element) const;
140 
142  friend OPENMS_DLLAPI std::ostream & operator<<(std::ostream & os, const Element & element);
143 
144 protected:
145 
147  std::string name_;
148 
150  std::string symbol_;
151 
153  unsigned int atomic_number_;
154 
157 
159  double mono_weight_;
160 
163  };
164 
165  OPENMS_DLLAPI std::ostream & operator<<(std::ostream &, const Element &);
166 
167 } // namespace OpenMS
168 
Representation of an element.
Definition: Element.h:56
virtual ~Element()
destructor
bool operator==(const Element &element) const
equality operator
double getMonoWeight() const
returns the mono isotopic weight of the element
friend std::ostream & operator<<(std::ostream &os, const Element &element)
writes the element to an output stream
bool operator<(const Element &element) const
less operator
bool operator!=(const Element &element) const
inequality operator
std::string name_
name of the element
Definition: Element.h:147
const std::string & getSymbol() const
returns symbol of the element
Element(const std::string &name, const std::string &symbol, unsigned int atomic_number, double average_weight, double mono_weight, const IsotopeDistribution &isotopes)
detailed constructor
IsotopeDistribution isotopes_
distribution of the isotopes
Definition: Element.h:162
unsigned int getAtomicNumber() const
returns the unique atomic number
const std::string & getName() const
returns the name of the element
unsigned int atomic_number_
atomic number of the element
Definition: Element.h:153
double getAverageWeight() const
returns the average weight of the element
const IsotopeDistribution & getIsotopeDistribution() const
returns the isotope distribution of the element
void setName(const std::string &name)
set the name of the element
double average_weight_
average weight over all isotopes
Definition: Element.h:156
Element & operator=(const Element &element)
assignment operator
Element()
default constructor
void setAverageWeight(double weight)
sets the average weight of the element
Element(const Element &element)
copy constructor
void setSymbol(const std::string &symbol)
sets symbol of the element
void setAtomicNumber(unsigned int atomic_number)
sets unique atomic number
double mono_weight_
mono isotopic weight of the most frequent isotope
Definition: Element.h:159
std::string symbol_
symbol of the element
Definition: Element.h:150
void setIsotopeDistribution(const IsotopeDistribution &isotopes)
sets the isotope distribution of the element
void setMonoWeight(double weight)
sets the mono isotopic weight of the element
Definition: IsotopeDistribution.h:65
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)