OpenMS
Loading...
Searching...
No Matches
DataArrays.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
12#include <OpenMS/CONCEPT/Helpers.h> // for ADL version of <=> for STL containers
13
14#include <compare>
15
16namespace OpenMS
17{
18 namespace DataArrays
19 {
20
24 public std::vector<float>
25 {
26 using std::vector<float>::vector; // to allow for aggregate initialization of FloatDataArray
27
28 public:
30 bool operator<(const FloatDataArray& rhs) const
31 {
32 const MetaInfoDescription& lhs_meta = *this;
33 const MetaInfoDescription& rhs_meta = rhs;
34 if (lhs_meta != rhs_meta)
35 return lhs_meta < rhs_meta;
36 return static_cast<const std::vector<float>&>(*this) < static_cast<const std::vector<float>&>(rhs);
37 }
38
40 bool operator<=(const FloatDataArray& rhs) const
41 {
42 return *this < rhs || *this == rhs;
43 }
44
46 bool operator>(const FloatDataArray& rhs) const
47 {
48 return !(*this <= rhs);
49 }
50
52 bool operator>=(const FloatDataArray& rhs) const
53 {
54 return !(*this < rhs);
55 }
56
58 bool operator!=(const FloatDataArray& rhs) const
59 {
60 return !(*this == rhs);
61 }
62
64 bool operator==(const FloatDataArray& rhs) const
65 {
66 return static_cast<const MetaInfoDescription&>(*this) == static_cast<const MetaInfoDescription&>(rhs) &&
67 static_cast<const std::vector<float>&>(*this) == static_cast<const std::vector<float>&>(rhs);
68 }
69 };
70
74 public std::vector<Int>
75 {
76 using std::vector<int>::vector; // to allow for aggregate initialization of IntegerDataArray
77
78 public:
80 bool operator<(const IntegerDataArray& rhs) const
81 {
82 const MetaInfoDescription& lhs_meta = *this;
83 const MetaInfoDescription& rhs_meta = rhs;
84 if (lhs_meta != rhs_meta)
85 return lhs_meta < rhs_meta;
86 return static_cast<const std::vector<Int>&>(*this) < static_cast<const std::vector<Int>&>(rhs);
87 }
88
90 bool operator<=(const IntegerDataArray& rhs) const
91 {
92 return *this < rhs || *this == rhs;
93 }
94
96 bool operator>(const IntegerDataArray& rhs) const
97 {
98 return !(*this <= rhs);
99 }
100
102 bool operator>=(const IntegerDataArray& rhs) const
103 {
104 return !(*this < rhs);
105 }
106
108 bool operator!=(const IntegerDataArray& rhs) const
109 {
110 return !(*this == rhs);
111 }
112
114 bool operator==(const IntegerDataArray& rhs) const
115 {
116 return static_cast<const MetaInfoDescription&>(*this) == static_cast<const MetaInfoDescription&>(rhs) &&
117 static_cast<const std::vector<Int>&>(*this) == static_cast<const std::vector<Int>&>(rhs);
118 }
119 };
120
123 public MetaInfoDescription,
124 public std::vector<String>
125 {
126 using std::vector<String>::vector; // to allow for aggregate initialization of StringDataArray
127
128 public:
130 bool operator<(const StringDataArray& rhs) const
131 {
132 const MetaInfoDescription& lhs_meta = *this;
133 const MetaInfoDescription& rhs_meta = rhs;
134 if (lhs_meta != rhs_meta)
135 return lhs_meta < rhs_meta;
136 return static_cast<const std::vector<String>&>(*this) < static_cast<const std::vector<String>&>(rhs);
137 }
138
140 bool operator<=(const StringDataArray& rhs) const
141 {
142 return *this < rhs || *this == rhs;
143 }
144
146 bool operator>(const StringDataArray& rhs) const
147 {
148 return !(*this <= rhs);
149 }
150
152 bool operator>=(const StringDataArray& rhs) const
153 {
154 return !(*this < rhs);
155 }
156
158 bool operator!=(const StringDataArray& rhs) const
159 {
160 return !(*this == rhs);
161 }
162
164 bool operator==(const StringDataArray& rhs) const
165 {
166 return static_cast<const MetaInfoDescription&>(*this) == static_cast<const MetaInfoDescription&>(rhs) &&
167 static_cast<const std::vector<String>&>(*this) == static_cast<const std::vector<String>&>(rhs);
168 }
169 };
170
171 }
172} // namespace OpenMS
173
Float data array class.
Definition DataArrays.h:25
bool operator<=(const FloatDataArray &rhs) const
Less than or equal operator.
Definition DataArrays.h:40
bool operator==(const FloatDataArray &rhs) const
Equality operator.
Definition DataArrays.h:64
bool operator!=(const FloatDataArray &rhs) const
Not equal operator.
Definition DataArrays.h:58
bool operator>=(const FloatDataArray &rhs) const
Greater than or equal operator.
Definition DataArrays.h:52
bool operator>(const FloatDataArray &rhs) const
Greater than operator.
Definition DataArrays.h:46
bool operator<(const FloatDataArray &rhs) const
Less than operator.
Definition DataArrays.h:30
Integer data array class.
Definition DataArrays.h:75
bool operator<=(const IntegerDataArray &rhs) const
Less than or equal operator.
Definition DataArrays.h:90
bool operator==(const IntegerDataArray &rhs) const
Equality operator.
Definition DataArrays.h:114
bool operator>=(const IntegerDataArray &rhs) const
Greater than or equal operator.
Definition DataArrays.h:102
bool operator<(const IntegerDataArray &rhs) const
Less than operator.
Definition DataArrays.h:80
bool operator>(const IntegerDataArray &rhs) const
Greater than operator.
Definition DataArrays.h:96
bool operator!=(const IntegerDataArray &rhs) const
Not equal operator.
Definition DataArrays.h:108
String data array class.
Definition DataArrays.h:125
bool operator<=(const StringDataArray &rhs) const
Less than or equal operator.
Definition DataArrays.h:140
bool operator==(const StringDataArray &rhs) const
Equality operator.
Definition DataArrays.h:164
bool operator>(const StringDataArray &rhs) const
Greater than operator.
Definition DataArrays.h:146
bool operator<(const StringDataArray &rhs) const
Less than operator.
Definition DataArrays.h:130
bool operator>=(const StringDataArray &rhs) const
Greater than or equal operator.
Definition DataArrays.h:152
bool operator!=(const StringDataArray &rhs) const
Not equal operator.
Definition DataArrays.h:158
Description of the meta data arrays of MSSpectrum.
Definition MetaInfoDescription.h:25
A more convenient string class.
Definition String.h:34
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19