OpenMS
CVTerm.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, 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 #pragma once
10 
13 
14 namespace OpenMS
15 {
16 
26  class OPENMS_DLLAPI CVTerm
27  {
28 public:
29 
30  struct Unit
31  {
32 
34  Unit() = default;
35 
36  Unit(const String& p_accession, const String& p_name, const String& p_cv_ref) :
37  accession(p_accession),
38  name(p_name),
39  cv_ref(p_cv_ref)
40  {
41  }
42 
44  Unit(const Unit &) = default;
45 
47  Unit(Unit&&) = default;
48 
50  virtual ~Unit()
51  {
52  }
53 
55  Unit& operator=(const Unit&) = default;
56 
58  Unit& operator=(Unit&&)& = default;
59 
60  bool operator==(const Unit& rhs) const
61  {
62  return accession == rhs.accession &&
63  name == rhs.name &&
64  cv_ref == rhs.cv_ref;
65  }
66 
67  bool operator!=(const Unit& rhs) const
68  {
69  return !(*this == rhs);
70  }
71 
75  };
76 
78  CVTerm() = default;
79 
81  CVTerm(const String& accession, const String& name = "", const String& cv_identifier_ref = "", const String& value = "", const Unit& unit = Unit());
82 
84  CVTerm(const CVTerm&) = default;
85 
87  CVTerm(CVTerm&&) = default;
88 
90  virtual ~CVTerm();
91 
93  CVTerm& operator=(const CVTerm&) = default;
94 
96  CVTerm& operator=(CVTerm&&)& = default;
97 
102  void setAccession(const String& accession);
103 
105  const String& getAccession() const;
106 
108  void setName(const String& name);
109 
111  const String& getName() const;
112 
114  void setCVIdentifierRef(const String& cv_identifier_ref);
115 
117  const String& getCVIdentifierRef() const;
118 
120  void setValue(const DataValue& value);
121 
123  const DataValue& getValue() const;
124 
126  void setUnit(const Unit& unit);
127 
129  const Unit& getUnit() const;
131 
136  bool operator==(const CVTerm& rhs) const;
137 
139  bool operator!=(const CVTerm& rhs) const;
140 
142  bool hasValue() const;
143 
145  bool hasUnit() const;
146  //}
147 
148 protected:
149 
151 
153 
155 
157 
159  };
160 
161 } // namespace OpenMS
162 
Representation of controlled vocabulary term.
Definition: CVTerm.h:27
bool operator==(const CVTerm &rhs) const
equality operator
const String & getCVIdentifierRef() const
returns the cv identifier reference string
virtual ~CVTerm()
Destructor.
void setUnit(const Unit &unit)
sets the unit of the term
Unit unit_
Definition: CVTerm.h:156
String name_
Definition: CVTerm.h:152
DataValue value_
Definition: CVTerm.h:158
CVTerm(const CVTerm &)=default
Copy constructor.
CVTerm(CVTerm &&)=default
Move constructor.
CVTerm & operator=(CVTerm &&) &=default
Move assignment operator.
void setCVIdentifierRef(const String &cv_identifier_ref)
sets the cv identifier reference string, e.g. UO for unit obo
void setName(const String &name)
sets the name of the term
const Unit & getUnit() const
returns the unit
void setValue(const DataValue &value)
set the value of the term
const String & getAccession() const
returns the accession string of the term
String accession_
Definition: CVTerm.h:150
const String & getName() const
returns the name of the term
void setAccession(const String &accession)
sets the accession string of the term
bool hasUnit() const
checks whether the term has a unit
const DataValue & getValue() const
returns the value of the term
bool operator!=(const CVTerm &rhs) const
inequality operator
String cv_identifier_ref_
Definition: CVTerm.h:154
CVTerm & operator=(const CVTerm &)=default
Assignment operator.
bool hasValue() const
checks whether the term has a value
CVTerm()=default
Default constructor.
CVTerm(const String &accession, const String &name="", const String &cv_identifier_ref="", const String &value="", const Unit &unit=Unit())
Detailed constructor.
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition: DataValue.h:33
A more convenient string class.
Definition: String.h:34
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22
Definition: CVTerm.h:31
bool operator!=(const Unit &rhs) const
Definition: CVTerm.h:67
Unit()=default
Default constructor.
String cv_ref
Definition: CVTerm.h:74
Unit & operator=(Unit &&) &=default
Move assignment operator.
virtual ~Unit()
Destructor.
Definition: CVTerm.h:50
String name
Definition: CVTerm.h:73
String accession
Definition: CVTerm.h:72
Unit(const String &p_accession, const String &p_name, const String &p_cv_ref)
Definition: CVTerm.h:36
Unit(Unit &&)=default
Move constructor.
Unit & operator=(const Unit &)=default
Assignment operator.
bool operator==(const Unit &rhs) const
Definition: CVTerm.h:60
Unit(const Unit &)=default
Copy constructor.