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 {
49  class OPENMS_DLLAPI CVTerm
51  {
52 public:
53 
54 
55  struct Unit
56  {
57  Unit()
58  {
59  }
60 
61  Unit(const String & p_accession, const String & p_name, const String & p_cv_ref) :
62  accession(p_accession),
63  name(p_name),
64  cv_ref(p_cv_ref)
65  {
66  }
67 
68  Unit(const Unit & rhs) :
69  accession(rhs.accession),
70  name(rhs.name),
71  cv_ref(rhs.cv_ref)
72  {
73  }
74 
75  virtual ~Unit()
76  {
77  }
78 
79  Unit & operator=(const Unit & rhs)
80  {
81  if (this != &rhs)
82  {
83  accession = rhs.accession;
84  name = rhs.name;
85  cv_ref = rhs.cv_ref;
86  }
87  return *this;
88  }
89 
90  bool operator==(const Unit & rhs) const
91  {
92  return accession == rhs.accession &&
93  name == rhs.name &&
94  cv_ref == rhs.cv_ref;
95  }
96 
97  bool operator!=(const Unit & rhs) const
98  {
99  return !(*this == rhs);
100  }
101 
105  };
106 
107 
109  CVTerm();
110 
112  CVTerm(const String & accession, const String & name, const String & cv_identifier_ref, const String & value, const Unit & unit);
113 
115  CVTerm(const CVTerm & rhs);
116 
118  virtual ~CVTerm();
119 
121  CVTerm & operator=(const CVTerm & rhs);
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:57
String name_
Definition: CVTerm.h:177
bool operator==(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:806
Unit()
Definition: CVTerm.h:57
String accession
Definition: CVTerm.h:102
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
bool operator!=(const Unit &rhs) const
Definition: CVTerm.h:97
Unit(const String &p_accession, const String &p_name, const String &p_cv_ref)
Definition: CVTerm.h:61
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:55
bool operator==(const Unit &rhs) const
Definition: CVTerm.h:90
String cv_identifier_ref_
Definition: CVTerm.h:179
Representation of controlled vocabulary term.
Definition: CVTerm.h:50
DataValue value_
Definition: CVTerm.h:183
bool operator!=(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:824
Unit & operator=(const Unit &rhs)
Definition: CVTerm.h:79
Unit(const Unit &rhs)
Definition: CVTerm.h:68
virtual ~Unit()
Definition: CVTerm.h:75
String cv_ref
Definition: CVTerm.h:104
String name
Definition: CVTerm.h:103