OpenMS
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-2023.
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>
40 
41 #include <string>
42 
43 #define OPENMS_CHEMISTRY_ELEMENT_NAME_DEFAULT "unknown"
44 #define OPENMS_CHEMISTRY_ELEMENT_SYMBOL_DEFAULT "??"
45 #define OPENMS_CHEMISTRY_ELEMENT_WEIGHT_DEFAULT 0.0
46 #define OPENMS_CHEMISTRY_ELEMENT_ATOMICNUMBER_DEFAULT 0
47 
48 namespace OpenMS
49 {
57  class OPENMS_DLLAPI Element
58  {
59 public:
60 
61 
67 
69  Element(const Element & element);
70 
72  Element(const std::string & name,
73  const std::string & symbol,
74  unsigned int atomic_number,
75  double average_weight,
76  double mono_weight,
77  const IsotopeDistribution & isotopes);
78 
80  virtual ~Element();
82 
87  void setAtomicNumber(unsigned int atomic_number);
88 
90  unsigned int getAtomicNumber() const;
91 
93  void setAverageWeight(double weight);
94 
96  double getAverageWeight() const;
97 
99  void setMonoWeight(double weight);
100 
102  double getMonoWeight() const;
103 
106 
109 
111  void setName(const std::string & name);
112 
114  const std::string & getName() const;
115 
117  void setSymbol(const std::string & symbol);
118 
120  const std::string & getSymbol() const;
122 
127  Element & operator=(const Element & element);
129 
134  bool operator==(const Element & element) const;
135 
137  bool operator!=(const Element & element) const;
138 
140  bool operator<(const Element & element) const;
142 
144  friend OPENMS_DLLAPI std::ostream & operator<<(std::ostream & os, const Element & element);
145 
146 protected:
147 
149  std::string name_;
150 
152  std::string symbol_;
153 
155  unsigned int atomic_number_;
156 
159 
161  double mono_weight_;
162 
165  };
166 
167  OPENMS_DLLAPI std::ostream & operator<<(std::ostream &, const Element &);
168 
169 } // namespace OpenMS
170 
Representation of an element.
Definition: Element.h:58
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:149
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 (mass and natural frequency)
Definition: Element.h:164
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:155
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:158
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:161
std::string symbol_
symbol of the element
Definition: Element.h:152
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:48
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)