OpenMS  2.6.0
Sample.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-2020.
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: Marc Sturm $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
37 #include <list>
38 
42 
43 namespace OpenMS
44 {
45  class SampleTreatment;
46 
59  class OPENMS_DLLAPI Sample :
60  public MetaInfoInterface
61  {
62 public:
64  enum SampleState {SAMPLENULL, SOLID, LIQUID, GAS, SOLUTION, EMULSION, SUSPENSION, SIZE_OF_SAMPLESTATE};
66  static const std::string NamesOfSampleState[SIZE_OF_SAMPLESTATE];
67 
69  Sample();
71  Sample(const Sample & source);
73  Sample(Sample&&) = default;
75  ~Sample();
76 
78  Sample & operator=(const Sample & source);
80  Sample& operator=(Sample&&) & = default;
81 
83  bool operator==(const Sample & rhs) const;
84 
86  const String & getName() const;
88  void setName(const String & name);
89 
91  const String & getOrganism() const;
93  void setOrganism(const String & organism);
94 
96  const String & getNumber() const;
98  void setNumber(const String & number);
99 
101  const String & getComment() const;
103  void setComment(const String & comment);
104 
106  SampleState getState() const;
108  void setState(SampleState state);
109 
111  double getMass() const;
113  void setMass(double mass);
114 
116  double getVolume() const;
118  void setVolume(double volume);
119 
121  double getConcentration() const;
123  void setConcentration(double concentration);
124 
126  std::vector<Sample> & getSubsamples();
128  const std::vector<Sample> & getSubsamples() const;
130  void setSubsamples(const std::vector<Sample> & subsamples);
131 
140  void addTreatment(const SampleTreatment & treatment, Int before_position = -1);
141 
147  SampleTreatment & getTreatment(UInt position);
148 
154  const SampleTreatment & getTreatment(UInt position) const;
155 
161  void removeTreatment(UInt position);
162 
164  Int countTreatments() const;
165 
166 protected:
172  double mass_;
173  double volume_;
175  std::vector<Sample> subsamples_;
176 
177  // note: default move constructor / assignment operator will work on this,
178  // since it will move the whole vector over to the new object who will then
179  // own the memory.
180  std::list<SampleTreatment *> treatments_;
181 
182  };
183 } // namespace OpenMS
184 
OpenMS::Sample::SampleState
SampleState
state of aggregation of the sample
Definition: Sample.h:64
OpenMS::Sample::mass_
double mass_
Definition: Sample.h:172
OpenMS::Sample
Meta information about the sample.
Definition: Sample.h:59
OpenMS::Sample::volume_
double volume_
Definition: Sample.h:173
OpenMS::String
A more convenient string class.
Definition: String.h:59
OpenMS::Sample::comment_
String comment_
Definition: Sample.h:169
OpenMS::Sample::number_
String number_
Definition: Sample.h:168
OpenMS::Sample::name_
String name_
Definition: Sample.h:167
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
Exception.h
OpenMS::SampleTreatment
Base class for sample treatments (Digestion, Modification, Tagging, ...)
Definition: SampleTreatment.h:51
OpenMS::Sample::subsamples_
std::vector< Sample > subsamples_
Definition: Sample.h:175
OpenMS::MetaInfoInterface
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:60
int
OpenMS::Sample::concentration_
double concentration_
Definition: Sample.h:174
OpenMS::Sample::SUSPENSION
Definition: Sample.h:64
OpenMS::Sample::organism_
String organism_
Definition: Sample.h:170
OpenMS::UInt
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
OpenMS::Sample::state_
SampleState state_
Definition: Sample.h:171
OpenMS::Internal::operator==
bool operator==(const IDBoostGraph::ProteinGroup &lhs, const IDBoostGraph::ProteinGroup &rhs)
MetaInfoInterface.h
String.h
OpenMS::Sample::treatments_
std::list< SampleTreatment * > treatments_
Definition: Sample.h:180
seqan::position
Size< TNeedle >::Type position(const PatternAuxData< TNeedle > &dh)
Definition: AhoCorasickAmbiguous.h:561