OpenMS
Loading...
Searching...
No Matches
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
15
16namespace OpenMS
17{
28 class OPENMS_DLLAPI Sample :
30 {
31public:
33 enum class SampleState {SAMPLENULL, SOLID, LIQUID, GAS, SOLUTION, EMULSION, SUSPENSION, SIZE_OF_SAMPLESTATE};
35 static const std::string NamesOfSampleState[static_cast<size_t>(SampleState::SIZE_OF_SAMPLESTATE)];
36
39
42 static const std::string& sampleStateToString(SampleState state);
43
46 static SampleState toSampleState(const std::string& name);
47
51 Sample(const Sample & source);
53 Sample(Sample&&) = default;
56
58 Sample & operator=(const Sample & source);
60 Sample& operator=(Sample&&) & = default;
61
63 bool operator==(const Sample & rhs) const;
64
66 const std::string & getName() const;
68 void setName(const std::string & name);
69
71 const std::string & getOrganism() const;
73 void setOrganism(const std::string & organism);
74
76 const std::string & getNumber() const;
78 void setNumber(const std::string & number);
79
81 const std::string & getComment() const;
83 void setComment(const std::string & comment);
84
88 void setState(SampleState state);
89
91 double getMass() const;
93 void setMass(double mass);
94
96 double getVolume() const;
98 void setVolume(double volume);
99
101 double getConcentration() const;
103 void setConcentration(double concentration);
104
106 std::vector<Sample> & getSubsamples();
108 const std::vector<Sample> & getSubsamples() const;
110 void setSubsamples(const std::vector<Sample> & subsamples);
111
112protected:
113 std::string name_;
114 std::string number_;
115 std::string comment_;
116 std::string organism_;
118 double mass_;
119 double volume_;
121 std::vector<Sample> subsamples_;
122 };
123} // namespace OpenMS
124
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:30
bool operator==(const Sample &rhs) const
Equality operator.
double mass_
Definition Sample.h:118
double getConcentration() const
returns the concentration (in g/l) (default: 0.0)
std::string number_
Definition Sample.h:114
void setConcentration(double concentration)
sets the concentration (in g/l)
static SampleState toSampleState(const std::string &name)
const std::string & getName() const
returns the sample name (default: "")
SampleState
state of aggregation of the sample
Definition Sample.h:33
Sample & operator=(Sample &&) &=default
Move assignment operator.
std::vector< Sample > & getSubsamples()
returns a mutable reference to the vector of subsamples that were combined to create this sample
std::string name_
Definition Sample.h:113
Sample(const Sample &source)
Copy constructor.
double concentration_
Definition Sample.h:120
const std::vector< Sample > & getSubsamples() const
returns a const reference to the vector of subsamples that were combined to create this sample
Sample(Sample &&)=default
Move constructor.
std::string comment_
Definition Sample.h:115
std::string organism_
Definition Sample.h:116
void setState(SampleState state)
sets the state of aggregation
const std::string & getOrganism() const
returns the sample name (default: "")
double getVolume() const
returns the volume (in ml) (default: 0.0)
~Sample()
Destructor.
void setOrganism(const std::string &organism)
sets the sample name
void setName(const std::string &name)
sets the sample name
void setNumber(const std::string &number)
sets the sample number (e.g. sample ID)
void setMass(double mass)
sets the mass (in gram)
Sample & operator=(const Sample &source)
Assignment operator.
void setVolume(double volume)
sets the volume (in ml)
const std::string & getNumber() const
returns the sample number (default: "")
static StringList getAllNamesOfSampleState()
returns all sample state names known to OpenMS
const std::string & getComment() const
returns the comment (default: "")
static const std::string & sampleStateToString(SampleState state)
SampleState getState() const
returns the state of aggregation (default: SAMPLENULL)
void setComment(const std::string &comment)
sets the comment (may contain newline characters)
SampleState state_
Definition Sample.h:117
Sample()
Default constructor.
double volume_
Definition Sample.h:119
double getMass() const
returns the mass (in gram) (default: 0.0)
std::vector< Sample > subsamples_
Definition Sample.h:121
void setSubsamples(const std::vector< Sample > &subsamples)
sets the vector of subsamples that were combined to create this sample
std::vector< std::string > StringList
Vector of String.
Definition ListUtils.h:44
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19