OpenMS  3.0.0
CVTerm.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-2022.
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 #pragma once
36 
39 
40 namespace OpenMS
41 {
42 
52  class OPENMS_DLLAPI CVTerm
53  {
54 public:
55 
56  struct Unit
57  {
58 
60  Unit() = default;
61 
62  Unit(const String& p_accession, const String& p_name, const String& p_cv_ref) :
63  accession(p_accession),
64  name(p_name),
65  cv_ref(p_cv_ref)
66  {
67  }
68 
70  Unit(const Unit &) = default;
71 
73  Unit(Unit&&) = default;
74 
76  virtual ~Unit()
77  {
78  }
79 
81  Unit& operator=(const Unit&) = default;
82 
84  Unit& operator=(Unit&&)& = default;
85 
86  bool operator==(const Unit& rhs) const
87  {
88  return accession == rhs.accession &&
89  name == rhs.name &&
90  cv_ref == rhs.cv_ref;
91  }
92 
93  bool operator!=(const Unit& rhs) const
94  {
95  return !(*this == rhs);
96  }
97 
101  };
102 
104  CVTerm() = default;
105 
107  CVTerm(const String& accession, const String& name = "", const String& cv_identifier_ref = "", const String& value = "", const Unit& unit = Unit());
108 
110  CVTerm(const CVTerm&) = default;
111 
113  CVTerm(CVTerm&&) = default;
114 
116  virtual ~CVTerm();
117 
119  CVTerm& operator=(const CVTerm&) = default;
120 
122  CVTerm& operator=(CVTerm&&)& = default;
123 
127  void setAccession(const String& accession);
129 
131  const String& getAccession() const;
132 
134  void setName(const String& name);
135 
137  const String& getName() const;
138 
140  void setCVIdentifierRef(const String& cv_identifier_ref);
141 
143  const String& getCVIdentifierRef() const;
144 
146  void setValue(const DataValue& value);
147 
149  const DataValue& getValue() const;
150 
152  void setUnit(const Unit& unit);
153 
155  const Unit& getUnit() const;
157 
161  bool operator==(const CVTerm& rhs) const;
163 
165  bool operator!=(const CVTerm& rhs) const;
166 
168  bool hasValue() const;
169 
171  bool hasUnit() const;
172  //}
173 
174 protected:
175 
177 
179 
181 
183 
185  };
186 
187 } // namespace OpenMS
188 
OpenMS::CVTerm::value_
DataValue value_
Definition: CVTerm.h:184
OpenMS::CVTerm::cv_identifier_ref_
String cv_identifier_ref_
Definition: CVTerm.h:180
OpenMS::CVTerm::Unit::operator==
bool operator==(const Unit &rhs) const
Definition: CVTerm.h:86
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::CVTerm::Unit::name
String name
Definition: CVTerm.h:99
KDTree::operator!=
bool operator!=(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:824
OpenMS::CVTerm::Unit::accession
String accession
Definition: CVTerm.h:98
OpenMS::CVTerm::Unit
Definition: CVTerm.h:56
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
OpenMS::DataValue
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition: DataValue.h:58
OpenMS::CVTerm::Unit::Unit
Unit(const String &p_accession, const String &p_name, const String &p_cv_ref)
Definition: CVTerm.h:62
OpenMS::CVTerm::accession_
String accession_
Definition: CVTerm.h:176
OpenMS::CVTerm::Unit::operator!=
bool operator!=(const Unit &rhs) const
Definition: CVTerm.h:93
OpenMS::CVTerm::unit_
Unit unit_
Definition: CVTerm.h:182
OpenMS::Internal::operator==
bool operator==(const IDBoostGraph::ProteinGroup &lhs, const IDBoostGraph::ProteinGroup &rhs)
OpenMS::CVTerm
Representation of controlled vocabulary term.
Definition: CVTerm.h:52
OpenMS::CVTerm::Unit::cv_ref
String cv_ref
Definition: CVTerm.h:100
DataValue.h
String.h
OpenMS::CVTerm::name_
String name_
Definition: CVTerm.h:178
OpenMS::CVTerm::Unit::~Unit
virtual ~Unit()
Destructor.
Definition: CVTerm.h:76