OpenMS  2.4.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-2018.
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;
83  Unit& operator=(Unit&&) & = default;
84 
85  bool operator==(const Unit & rhs) const
86  {
87  return accession == rhs.accession &&
88  name == rhs.name &&
89  cv_ref == rhs.cv_ref;
90  }
91 
92  bool operator!=(const Unit & rhs) const
93  {
94  return !(*this == rhs);
95  }
96 
100  };
101 
103  CVTerm() = default;
104 
106  CVTerm(const String & accession, const String & name, const String & cv_identifier_ref, const String & value, const Unit & unit);
107 
109  CVTerm(const CVTerm &) = default;
110 
112  CVTerm(CVTerm&&) = default;
113 
115  virtual ~CVTerm();
116 
118  CVTerm & operator=(const CVTerm &) = default;
119 
121  CVTerm& operator=(CVTerm&&) & = default;
122 
126  void setAccession(const String & accession);
128 
130  const String & getAccession() const;
131 
133  void setName(const String & name);
134 
136  const String & getName() const;
137 
139  void setCVIdentifierRef(const String & cv_identifier_ref);
140 
142  const String & getCVIdentifierRef() const;
143 
145  void setValue(const DataValue & value);
146 
148  const DataValue & getValue() const;
149 
151  void setUnit(const Unit & unit);
152 
154  const Unit & getUnit() const;
156 
160  bool operator==(const CVTerm & rhs) const;
162 
164  bool operator!=(const CVTerm & rhs) const;
165 
167  bool hasValue() const;
168 
170  bool hasUnit() const;
171  //}
172 
173 protected:
174 
176 
178 
180 
182 
184  };
185 
186 } // namespace OpenMS
187 
Unit unit_
Definition: CVTerm.h:181
A more convenient string class.
Definition: String.h:58
String name_
Definition: CVTerm.h:177
bool operator==(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:806
String accession
Definition: CVTerm.h:97
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
bool operator!=(const Unit &rhs) const
Definition: CVTerm.h:92
Unit(const String &p_accession, const String &p_name, const String &p_cv_ref)
Definition: CVTerm.h:62
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition: DataValue.h:56
String accession_
Definition: CVTerm.h:175
Definition: CVTerm.h:56
bool operator==(const Unit &rhs) const
Definition: CVTerm.h:85
String cv_identifier_ref_
Definition: CVTerm.h:179
Representation of controlled vocabulary term.
Definition: CVTerm.h:52
DataValue value_
Definition: CVTerm.h:183
bool operator!=(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:824
virtual ~Unit()
Destructor.
Definition: CVTerm.h:76
String cv_ref
Definition: CVTerm.h:99
String name
Definition: CVTerm.h:98