OpenMS
Loading...
Searching...
No Matches
Product.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
13#include <functional>
14
15namespace OpenMS
16{
24 class OPENMS_DLLAPI Product :
25 public CVTermList
26 {
27
28public:
29
31 Product() = default;
33 Product(const Product &) = default;
35 Product(Product&&) = default;
37 ~Product() override = default;
38
40 Product & operator=(const Product &) = default;
42 Product& operator=(Product&&) & = default;
43
45 bool operator==(const Product & rhs) const;
47 bool operator!=(const Product & rhs) const;
48
50 double getMZ() const;
52 void setMZ(double mz);
53
58
63
64protected:
65
66 double mz_ = 0.0;
67 double window_low_ = 0.0;
68 double window_up_ = 0.0;
69 };
70} // namespace OpenMS
71
72namespace std
73{
80 template<>
81 struct hash<OpenMS::Product>
82 {
83 std::size_t operator()(const OpenMS::Product& p) const noexcept
84 {
85 std::size_t seed = OpenMS::hash_float(p.getMZ());
86 OpenMS::hash_combine(seed, OpenMS::hash_float(p.getIsolationWindowLowerOffset()));
87 OpenMS::hash_combine(seed, OpenMS::hash_float(p.getIsolationWindowUpperOffset()));
88 OpenMS::hash_combine(seed, std::hash<OpenMS::CVTermList>{}(p));
89 return seed;
90 }
91 };
92} // namespace std
93
Representation of controlled vocabulary term list.
Definition CVTermList.h:29
Product meta information.
Definition Product.h:26
double getIsolationWindowLowerOffset() const
returns the lower offset from the target m/z
Product(const Product &)=default
Copy constructor.
Product(Product &&)=default
Move constructor.
void setIsolationWindowUpperOffset(double bound)
sets the upper offset from the target m/z
bool operator!=(const Product &rhs) const
Equality operator.
void setMZ(double mz)
sets the target m/z
Product & operator=(Product &&) &=default
Move assignment operator.
double getIsolationWindowUpperOffset() const
returns the upper offset from the target m/z
~Product() override=default
Destructor.
Product & operator=(const Product &)=default
Assignment operator.
Product()=default
Constructor.
void setIsolationWindowLowerOffset(double bound)
sets the lower offset from the target m/z
bool operator==(const Product &rhs) const
Equality operator.
double getMZ() const
returns the target m/z
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
void hash_combine(std::size_t &seed, std::size_t value) noexcept
Combine a hash value with additional data using golden ratio mixing.
Definition HashUtils.h:87
std::size_t hash_float(T value) noexcept
Hash for a floating point type (float or double).
Definition HashUtils.h:142
STL namespace.
std::size_t operator()(const OpenMS::Product &p) const noexcept
Definition Product.h:83