OpenMS
Sample.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, OpenMS Inc. -- 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 
14 
15 namespace OpenMS
16 {
27  class OPENMS_DLLAPI Sample :
28  public MetaInfoInterface
29  {
30 public:
32  enum SampleState {SAMPLENULL, SOLID, LIQUID, GAS, SOLUTION, EMULSION, SUSPENSION, SIZE_OF_SAMPLESTATE};
34  static const std::string NamesOfSampleState[SIZE_OF_SAMPLESTATE];
35 
37  Sample();
39  Sample(const Sample & source);
41  Sample(Sample&&) = default;
44 
46  Sample & operator=(const Sample & source);
48  Sample& operator=(Sample&&) & = default;
49 
51  bool operator==(const Sample & rhs) const;
52 
54  const String & getName() const;
56  void setName(const String & name);
57 
59  const String & getOrganism() const;
61  void setOrganism(const String & organism);
62 
64  const String & getNumber() const;
66  void setNumber(const String & number);
67 
69  const String & getComment() const;
71  void setComment(const String & comment);
72 
76  void setState(SampleState state);
77 
79  double getMass() const;
81  void setMass(double mass);
82 
84  double getVolume() const;
86  void setVolume(double volume);
87 
89  double getConcentration() const;
91  void setConcentration(double concentration);
92 
94  std::vector<Sample> & getSubsamples();
96  const std::vector<Sample> & getSubsamples() const;
98  void setSubsamples(const std::vector<Sample> & subsamples);
99 
100 protected:
106  double mass_;
107  double volume_;
109  std::vector<Sample> subsamples_;
110  };
111 } // namespace OpenMS
112 
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:35
Meta information about the sample.
Definition: Sample.h:29
String comment_
Definition: Sample.h:103
void setOrganism(const String &organism)
sets the sample name
Sample & operator=(Sample &&) &=default
Move assignment operator.
bool operator==(const Sample &rhs) const
Equality operator.
double mass_
Definition: Sample.h:106
void setComment(const String &comment)
sets the comment (may contain newline characters)
double getConcentration() const
returns the concentration (in g/l) (default: 0.0)
void setConcentration(double concentration)
sets the concentration (in g/l)
Sample & operator=(const Sample &source)
Assignment operator.
String number_
Definition: Sample.h:102
SampleState
state of aggregation of the sample
Definition: Sample.h:32
@ EMULSION
Definition: Sample.h:32
String name_
Definition: Sample.h:101
Sample(const Sample &source)
Copy constructor.
double concentration_
Definition: Sample.h:108
Sample(Sample &&)=default
Move constructor.
void setName(const String &name)
sets the sample name
String organism_
Definition: Sample.h:104
void setState(SampleState state)
sets the state of aggregation
const String & getOrganism() const
returns the sample name (default: "")
double getVolume() const
returns the volume (in ml) (default: 0.0)
~Sample()
Destructor.
std::vector< Sample > & getSubsamples()
returns a mutable reference to the vector of subsamples that were combined to create this sample
void setNumber(const String &number)
sets the sample number (e.g. sample ID)
void setMass(double mass)
sets the mass (in gram)
const std::vector< Sample > & getSubsamples() const
returns a const reference to the vector of subsamples that were combined to create this sample
void setVolume(double volume)
sets the volume (in ml)
const String & getName() const
returns the sample name (default: "")
const String & getNumber() const
returns the sample number (default: "")
const String & getComment() const
returns the comment (default: "")
SampleState getState() const
returns the state of aggregation (default: SAMPLENULL)
SampleState state_
Definition: Sample.h:105
Sample()
Default constructor.
double volume_
Definition: Sample.h:107
double getMass() const
returns the mass (in gram) (default: 0.0)
std::vector< Sample > subsamples_
Definition: Sample.h:109
void setSubsamples(const std::vector< Sample > &subsamples)
sets the vector of subsamples that were combined to create this sample
A more convenient string class.
Definition: String.h:34
static String number(double d, UInt n)
Definition: StringUtils.h:191
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19