OpenMS
Element.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg $
6 // $Authors: Andreas Bertsch $
7 // --------------------------------------------------------------------------
8 //
9 
10 #pragma once
11 
12 #include <OpenMS/CONCEPT/Types.h>
14 
15 #include <string>
16 
17 #define OPENMS_CHEMISTRY_ELEMENT_NAME_DEFAULT "unknown"
18 #define OPENMS_CHEMISTRY_ELEMENT_SYMBOL_DEFAULT "??"
19 #define OPENMS_CHEMISTRY_ELEMENT_WEIGHT_DEFAULT 0.0
20 #define OPENMS_CHEMISTRY_ELEMENT_ATOMICNUMBER_DEFAULT 0
21 
22 namespace OpenMS
23 {
31  class OPENMS_DLLAPI Element
32  {
33 public:
34 
35 
41 
43  Element(const Element & element);
44 
46  Element(const std::string & name,
47  const std::string & symbol,
48  unsigned int atomic_number,
49  double average_weight,
50  double mono_weight,
51  const IsotopeDistribution & isotopes);
52 
54  virtual ~Element();
56 
61  void setAtomicNumber(unsigned int atomic_number);
62 
64  unsigned int getAtomicNumber() const;
65 
67  void setAverageWeight(double weight);
68 
70  double getAverageWeight() const;
71 
73  void setMonoWeight(double weight);
74 
76  double getMonoWeight() const;
77 
80 
83 
85  void setName(const std::string & name);
86 
88  const std::string & getName() const;
89 
91  void setSymbol(const std::string & symbol);
92 
94  const std::string & getSymbol() const;
96 
101  Element & operator=(const Element & element);
103 
108  bool operator==(const Element & element) const;
109 
111  bool operator!=(const Element & element) const;
112 
114  bool operator<(const Element & element) const;
116 
118  friend OPENMS_DLLAPI std::ostream & operator<<(std::ostream & os, const Element & element);
119 
120 protected:
121 
123  std::string name_;
124 
126  std::string symbol_;
127 
129  unsigned int atomic_number_;
130 
133 
135  double mono_weight_;
136 
139  };
140 
141  OPENMS_DLLAPI std::ostream & operator<<(std::ostream &, const Element &);
142 
143 } // namespace OpenMS
144 
Representation of an element.
Definition: Element.h:32
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:123
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:138
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:129
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:132
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:135
std::string symbol_
symbol of the element
Definition: Element.h:126
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:39
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)