OpenMS
Gradient.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: Marc Sturm $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
13 
14 #include <vector>
15 
16 namespace OpenMS
17 {
26  class OPENMS_DLLAPI Gradient
27  {
28 public:
30  Gradient() = default;
32  Gradient(const Gradient &) = default;
34  Gradient(Gradient&&) = default;
37 
39  Gradient & operator=(const Gradient &) = default;
41  Gradient& operator=(Gradient&&) & = default;
42 
44  bool operator==(const Gradient & source) const;
46  bool operator!=(const Gradient & source) const;
47 
53  void addEluent(const String & eluent);
55  void clearEluents();
57  const std::vector<String> & getEluents() const;
58 
64  void addTimepoint(Int timepoint);
68  const std::vector<Int> & getTimepoints() const;
69 
75  void setPercentage(const String & eluent, Int timepoint, UInt percentage);
76 
82  const std::vector<std::vector<UInt> > & getPercentages() const;
83 
89  UInt getPercentage(const String & eluent, Int timepoint) const;
90 
93 
95  bool isValid() const;
96 
97 protected:
98  std::vector<String> eluents_;
99  std::vector<Int> times_;
100  // first dimension is eluents, second is times
101  std::vector<std::vector<UInt> > percentages_;
102  };
103 
104 } // namespace OpenMS
105 
Representation of a HPLC gradient.
Definition: Gradient.h:27
bool operator==(const Gradient &source) const
Equality operator.
std::vector< Int > times_
Definition: Gradient.h:99
Gradient & operator=(const Gradient &)=default
Assignment operator.
void clearTimepoints()
removes all timepoints
void clearPercentages()
sets all percentage values to 0
void setPercentage(const String &eluent, Int timepoint, UInt percentage)
sets the percentage of eluent eluent at timepoint timepoint
bool isValid() const
checks if the percentages of all timepoints add up to 100%
const std::vector< Int > & getTimepoints() const
returns a const reference to the list of timepoints
Gradient(Gradient &&)=default
Move constructor.
void addTimepoint(Int timepoint)
Adds a timepoint at the end of the timepoint array.
~Gradient()
Destructor.
std::vector< std::vector< UInt > > percentages_
Definition: Gradient.h:101
Gradient & operator=(Gradient &&) &=default
Move assignment operator.
Gradient(const Gradient &)=default
Copy constructor.
const std::vector< String > & getEluents() const
returns a const reference to the list of eluents
Gradient()=default
Constructor.
void clearEluents()
removes all eluents
UInt getPercentage(const String &eluent, Int timepoint) const
returns the percentage of an eluent at a timepoint
bool operator!=(const Gradient &source) const
Equality operator.
void addEluent(const String &eluent)
Adds an eluent at the end of the eluent array.
std::vector< String > eluents_
Definition: Gradient.h:98
const std::vector< std::vector< UInt > > & getPercentages() const
returns a const reference to the percentages
A more convenient string class.
Definition: String.h:34
int Int
Signed integer type.
Definition: Types.h:76
unsigned int UInt
Unsigned integer type.
Definition: Types.h:68
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22