OpenMS
RangeManager.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Chris Bielow $
6 // $Authors: Chris Bielow $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <OpenMS/config.h>
14 
15 #include <cmath> // for nan()
16 #include <algorithm> // for min/max
17 #include <cassert>
18 #include <iosfwd> // for std::ostream
19 
20 namespace OpenMS
21 {
23  enum class MSDim
24  {
25  RT,
26  MZ,
27  INT,
28  IM
29  };
30 
31  struct RangeRT;
32  struct RangeMZ;
33  struct RangeIntensity;
34  struct RangeMobility;
35 
37  struct OPENMS_DLLAPI RangeBase
38  {
39  public:
41  RangeBase() = default;
42 
44  RangeBase(const double single) :
45  min_(single), max_(single)
46  {
47  }
48 
51  RangeBase(const double min, const double max) :
52  min_(min), max_(max)
53  {
54  if (min_ > max_)
55  throw Exception::InvalidRange(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Invalid initialization of range");
56  }
58  RangeBase(const RangeBase& rhs) = default;
59 
61  RangeBase(RangeBase&& rhs) noexcept = default;
62 
64  RangeBase& operator=(const RangeBase& rhs) = default;
65 
67  RangeBase& operator=(RangeBase&& rhs) noexcept = default;
68 
70  ~RangeBase() noexcept = default;
71 
73  operator RangeRT() const;
75  operator RangeMZ() const;
77  operator RangeIntensity() const;
79  operator RangeMobility() const;
80 
82  void clear()
83  {
84  *this = RangeBase(); // overwrite with fresh instance
85  }
86 
88  bool isEmpty() const
89  {
90  return min_ > max_;
91  }
92 
94  bool contains(const double value) const
95  {
96  return uint8_t(min_ <= value) & uint8_t(value <= max_); // using && leads to branches on all compilers in Debug and in Release on MVSC
97  }
98 
100  bool contains(const RangeBase& inner_range) const
101  {
102  return uint8_t(contains(inner_range.min_)) & uint8_t(contains(inner_range.max_)); // using && leads to branches on all compilers in Debug and in Release on MVSC
103  }
104 
110 
112  void setMin(const double min)
113  {
114  min_ = min;
115  if (max_ < min)
116  max_ = min;
117  }
118 
120  void setMax(const double max)
121  {
122  max_ = max;
123  if (min_ > max)
124  min_ = max;
125  }
126 
128  double getMin() const
129  {
130  return min_;
131  }
132 
134  double getMax() const
135  {
136  return max_;
137  }
139 
141  void extend(const RangeBase& other)
142  {
143  min_ = std::min(min_, other.min_);
144  max_ = std::max(max_, other.max_);
145  }
146 
148  void extend(const double value)
149  {
150  min_ = std::min(min_, value);
151  max_ = std::max(max_, value);
152  }
153 
157  void extendLeftRight(const double by)
158  {
159  if (isEmpty()) return;
160  min_ -= by;
161  max_ += by;
162  }
163 
169  void minSpanIfSingular(const double min_span)
170  {
171  if (min_ == max_) extendLeftRight(min_span / 2);
172  }
173 
180  void clampTo(const RangeBase& other)
181  {
182  if (isEmpty()) return;
183  if (other.isEmpty()) throw Exception::InvalidRange(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION);
184 
185  min_ = std::max(min_, other.min_);
186  max_ = std::min(max_, other.max_);
187  }
188 
194  void pushInto(const RangeBase& sandbox)
195  {
196  if (isEmpty()) return;
197  if (sandbox.isEmpty()) throw Exception::InvalidRange(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION);
198 
199  if (!sandbox.contains(*this))
200  {
201  if (getSpan() > sandbox.getSpan())
202  { // make interval fit into sandbox (= ensure full containment)
203  max_ = min_ + sandbox.getSpan();
204  }
205  if (min_ < sandbox.min_)
206  { // need to shift right (positive shift)
207  shift(sandbox.min_ - min_);
208  }
209  else if (max_ > sandbox.max_)
210  { // need to shift left (negative shift)
211  shift(sandbox.max_ - max_);
212  }
213  }
214  }
215 
226  void scaleBy(const double factor)
227  {
228  if (isEmpty()) return;
229  const double dist = max_ - min_;
230  const double extension = dist * (factor - 1) / 2;
231  min_ -= extension;
232  max_ += extension;
233  }
234 
237  void shift(const double distance)
238  {
239  if (isEmpty()) return;
240  min_ += distance;
241  max_ += distance;
242  }
243 
246  double center() const
247  {
248  if (isEmpty()) return nan("");
249  return min_ + (max_ - min_) / 2.0;
250  }
251 
254  double getSpan() const
255  {
256  if (isEmpty()) return nan("");
257  return max_ - min_;
258  }
259 
260  bool operator==(const RangeBase& rhs) const
261  {
262  return min_ == rhs.min_ && max_ == rhs.max_;
263  }
264 
269  std::pair<double, double> getNonEmptyRange() const
270  {
271  // pair with full range
272  if (isEmpty()) return {std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max()};
273  else return {min_, max_};
274  }
275 
276  protected:
277  // make members non-accessible to maintain invariant: min <= max (unless uninitialized)
278  double min_ = std::numeric_limits<double>::max();
279  double max_ = std::numeric_limits<double>::lowest();
280  };
281 
282  OPENMS_DLLAPI std::ostream& operator<<(std::ostream& out, const RangeBase& b);
283 
284  struct OPENMS_DLLAPI RangeRT : public RangeBase {
285 
286  const static MSDim DIM = MSDim::RT;
287 
288  // Rule of 0!
289  using RangeBase::RangeBase; // inherit C'tors from base
290 
296 
298  void setMinRT(const double min)
299  {
300  setMin(min);
301  }
302 
304  void setMaxRT(const double max)
305  {
306  setMax(max);
307  }
308 
310  double getMinRT() const
311  {
312  return min_;
313  }
314 
316  double getMaxRT() const
317  {
318  return max_;
319  }
321 
323  void extendRT(const double value)
324  {
325  extend(value);
326  }
327 
329  bool containsRT(const double value) const
330  {
331  return RangeBase::contains(value);
332  }
333 
335  bool containsRT(const RangeBase& inner_range) const
336  {
337  return RangeBase::contains(inner_range);
338  }
339  };
340 
341  OPENMS_DLLAPI std::ostream& operator<<(std::ostream& out, const RangeRT& range);
342 
343  struct OPENMS_DLLAPI RangeMZ : public RangeBase
344  {
345 
346  const static MSDim DIM = MSDim::MZ;
347 
348  // Rule of 0!
349  using RangeBase::RangeBase; // inherit C'tors from base
350 
356 
358  void setMinMZ(const double min)
359  {
360  setMin(min);
361  }
362 
364  void setMaxMZ(const double max)
365  {
366  setMax(max);
367  }
368 
370  double getMinMZ() const
371  {
372  return min_;
373  }
374 
376  double getMaxMZ() const
377  {
378  return max_;
379  }
381 
383  void extendMZ(const double value)
384  {
385  extend(value);
386  }
387 
389  bool containsMZ(const double value) const
390  {
391  return RangeBase::contains(value);
392  }
393 
395  bool containsMZ(const RangeBase& inner_range) const
396  {
397  return RangeBase::contains(inner_range);
398  }
399  };
400  OPENMS_DLLAPI std::ostream& operator<<(std::ostream& out, const RangeMZ& range);
401 
402  struct OPENMS_DLLAPI RangeIntensity : public RangeBase {
403 
404  const static MSDim DIM = MSDim::INT;
405 
406  // Rule of 0!
407  using RangeBase::RangeBase; // inherit C'tors from base
408 
414 
416  void setMinIntensity(const double min)
417  {
418  setMin(min);
419  }
420 
422  void setMaxIntensity(const double max)
423  {
424  setMax(max);
425  }
426 
428  double getMinIntensity() const
429  {
430  return min_;
431  }
432 
434  double getMaxIntensity() const
435  {
436  return max_;
437  }
439 
441  void extendIntensity(const double value)
442  {
443  extend(value);
444  }
445 
447  bool containsIntensity(const double value) const
448  {
449  return RangeBase::contains(value);
450  }
451 
453  bool containsIntensity(const RangeBase& inner_range) const
454  {
455  return RangeBase::contains(inner_range);
456  }
457  };
458  OPENMS_DLLAPI std::ostream& operator<<(std::ostream& out, const RangeIntensity& range);
459 
460  struct OPENMS_DLLAPI RangeMobility : public RangeBase
461  {
462  const static MSDim DIM = MSDim::IM;
463 
464  // Rule of 0!
465  using RangeBase::RangeBase; // inherit C'tors from base
466 
472 
474  void setMinMobility(const double min)
475  {
476  setMin(min);
477  }
478 
480  void setMaxMobility(const double max)
481  {
482  setMax(max);
483  }
484 
486  double getMinMobility() const
487  {
488  return min_;
489  }
490 
492  double getMaxMobility() const
493  {
494  return max_;
495  }
497 
499  void extendMobility(const double value)
500  {
501  extend(value);
502  }
503 
505  bool containsMobility(const double value) const
506  {
507  return RangeBase::contains(value);
508  }
509 
511  bool containsMobility(const RangeBase& inner_range) const
512  {
513  return RangeBase::contains(inner_range);
514  }
515  };
516 
517  OPENMS_DLLAPI std::ostream& operator<<(std::ostream& out, const RangeMobility& range);
518 
520  enum class HasRangeType
521  {
522  ALL,
523  SOME,
524  NONE
525  };
526 
542  template<typename... RangeBases>
543  class RangeManager : public RangeBases...
544  {
545  public:
546  using ThisRangeType = RangeManager<RangeBases...>;
547  // rule of 0 -- no need for a virtual d'tor or anything fancy
548  // ...
549 
550  bool operator==(const RangeManager& rhs) const
551  {
552  bool equal = true;
553  for_each_base_([&](auto* base) {
554  using T_BASE = std::decay_t<decltype(*base)>; // remove const/ref qualifiers
555  equal &= ((T_BASE&) rhs == (T_BASE&) *this);
556  });
557  return equal;
558  }
559 
560  bool operator!=(const RangeManager& rhs) const
561  {
562  return !operator==(rhs);
563  }
564 
569  template <typename... RangeBasesOther>
571  {
572  bool found = false;
573  for_each_base_([&](auto* base) {
574  using T_BASE = std::decay_t<decltype(*base)>; // remove const/ref qualifiers
575  if constexpr (std::is_base_of_v<T_BASE, RangeManager<RangeBasesOther...>>)
576  {
577  base->operator=((T_BASE&) rhs);
578  found = true;
579  }
580  });
581 
582  return found;
583  }
584 
589  template<typename... RangeBasesOther>
591  {
592  if (!assignUnsafe(rhs))
593  {
594  throw Exception::InvalidRange(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION , "No assignment took place (no dimensions in common!);");
595  }
596  return *this;
597  }
598 
603  template<typename... RangeBasesOther>
605  {
606  bool found = false;
607  for_each_base_([&](auto* base) {
608  using T_BASE = std::decay_t<decltype(*base)>; // remove const/ref qualifiers
609  if constexpr (std::is_base_of_v<T_BASE, RangeManager<RangeBasesOther...>>)
610  {
611  base->extend((T_BASE&) rhs);
612  found = true;
613  }
614  });
615  return found;
616  }
617 
622  template<typename... RangeBasesOther>
624  {
625  if (!extendUnsafe(rhs))
626  {
627  throw Exception::InvalidRange(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "No assignment took place (no dimensions in common!);");
628  }
629  }
630 
632  void scaleBy(const double factor)
633  {
634  for_each_base_([&](auto* base) {
635  base->scaleBy(factor);
636  });
637  }
638 
647  void minSpanIfSingular(const double min_span)
648  {
649  for_each_base_([&](auto* base) {
650  base->minSpanIfSingular(min_span);
651  });
652  }
653 
654 
660  template<typename... RangeBasesOther>
662  {
663  bool found = false;
664  for_each_base_([&](auto* base) {
665  using T_BASE = std::decay_t<decltype(*base)>; // remove const/ref qualifiers
666  if constexpr (std::is_base_of_v<T_BASE, RangeManager<RangeBasesOther...>>)
667  {
668  const auto& rhs_base = (T_BASE&)rhs;
669  if (!rhs_base.isEmpty()) base->pushInto(rhs_base);
670  found = true;
671  }
672  });
673  return found;
674  }
675 
681  template<typename... RangeBasesOther>
683  {
684  if (!pushIntoUnsafe(sandbox))
685  {
686  throw Exception::InvalidRange(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "No assignment took place (no dimensions in common!);");
687  }
688  }
689 
690 
695  template<typename... RangeBasesOther>
697  {
698  bool found = false;
699  for_each_base_([&](auto* base) {
700  using T_BASE = std::decay_t<decltype(*base)>; // remove const/ref qualifiers
701  if constexpr (std::is_base_of_v<T_BASE, RangeManager<RangeBasesOther...>>)
702  {
703  const auto& rhs_base = (T_BASE&)rhs;
704  if (!rhs_base.isEmpty()) base->clampTo(rhs_base);
705  found = true;
706  }
707  });
708  return found;
709  }
710 
716  template<typename... RangeBasesOther>
718  {
719  if (!clampToUnsafe(rhs))
720  {
721  throw Exception::InvalidRange(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "No assignment took place (no dimensions in common!);");
722  }
723  }
724 
726  const RangeBase& getRangeForDim(MSDim dim) const
727  {
728  RangeBase* r_base = nullptr;
729 
730  static_for_each_base_([&](auto* base) {
731  using Base = std::decay_t<decltype(*base)>; // remove const/ref qualifiers
732  if (base->DIM == dim)
733  r_base = (Base*)this;
734  });
735 
736  assert((r_base != nullptr) && "No base class has this MSDim!");
737  return *r_base;
738  }
739 
742  {
743  RangeBase* r_base = nullptr;
744 
745  static_for_each_base_([&](auto* base) {
746  using Base = std::decay_t<decltype(*base)>; // remove const/ref qualifiers
747  if (base->DIM == dim)
748  r_base = (Base*) this;
749  });
750 
751  assert((r_base != nullptr) && "No base class has this MSDim!");
752  return *r_base;
753  }
754 
757  {
758  constexpr size_t total{sizeof...(RangeBases)};// total number of bases
759  size_t count{0};
760  for_each_base_([&](auto* base) {
761  count += !base->isEmpty();
762  });
763  switch (count)
764  {
765  case 0:
766  return HasRangeType::NONE;
767  case total:
768  return HasRangeType::ALL;
769  default:
770  return HasRangeType::SOME;
771  }
772  }
773 
778  template<typename... RangeBasesOther>
780  {
781  bool contained = true; // assume rhs is contained, until proven otherwise
782  bool has_overlap = false;
783  for_each_base_([&](auto* base) {
784  using T_BASE = std::decay_t<decltype(*base)>; // remove const/ref qualifiers
785  if constexpr (std::is_base_of_v<T_BASE, RangeManager<RangeBasesOther...>>)
786  {
787  has_overlap = true; // at least one dimension overlaps
788  if (((T_BASE&)rhs).isEmpty()) return;
789  if (base->contains((T_BASE&) rhs)) return;
790  contained = false;
791  }
792  });
793  if (!has_overlap) throw Exception::InvalidRange(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION);
794 
795  return contained;
796  }
797 
799  void clearRanges()
800  {
801  for_each_base_([&](auto* base) {
802  base->clear();
803  });
804  }
805 
809  {
810  switch (range)
811  {
812  case DIM_UNIT::RT:
813  if constexpr (std::is_base_of_v<RangeRT, ThisRangeType>) this->RangeRT::clear();
814  break;
815  case DIM_UNIT::MZ:
816  if constexpr (std::is_base_of_v<RangeMZ, ThisRangeType>) this->RangeMZ::clear();
817  break;
818  case DIM_UNIT::INT:
819  if constexpr (std::is_base_of_v<RangeIntensity, ThisRangeType>) this->RangeIntensity::clear();
820  break;
821  // assume all ion mobility ranges are the same and never occur together. If this is violated at some point, then split RangeMobility into subclasses...
822  case DIM_UNIT::IM_MS:
823  case DIM_UNIT::IM_VSSC:
824  case DIM_UNIT::FAIMS_CV:
825  if constexpr (std::is_base_of_v<RangeMobility, ThisRangeType>) this->RangeMobility::clear();
826  break;
827  default:
828  // all cases should be covered above
829  assert(false && "This should never be reached. Did you forget to implement a new DIM_UNIT?");
830  }
831  return *this;
832  }
833 
835  void printRange(std::ostream& out) const
836  {
837  for_each_base_([&](auto* base) {
838  out << *base;
839  });
840  }
841 
842  protected:
844  template<typename Visitor>
845  void for_each_base_(Visitor&& visitor)
846  {
847  (void(visitor(static_cast<RangeBases*>(this))), ...);
848  }
850  template<typename Visitor>
851  void for_each_base_(Visitor&& visitor) const
852  {
853  (void(visitor(static_cast<const RangeBases*>(this))), ...);
854  }
855 
857  template<typename Visitor>
858  static void static_for_each_base_(Visitor&& visitor)
859  {
860  (void(visitor(static_cast<const RangeBases*>(nullptr))), ...);
861  }
862  };
863 
864  template<typename... Range>
865  std::ostream& operator<<(std::ostream& out, const RangeManager<Range...>& me)
866  {
867  me.printRange(out);
868  return out;
869  }
870 
873  template <typename ...RangeBases>
875  : public RangeManager<RangeBases...>
876  {
877  public:
878  using ThisRangeType = typename RangeManager<RangeBases...>::ThisRangeType;
879 
881  virtual ~RangeManagerContainer() = default; // required since we have virtual methods
882 
885  virtual void updateRanges() = 0;
886 
888  const ThisRangeType& getRange() const
889  {
890  return (ThisRangeType&)*this;
891  }
892 
895  {
896  return (ThisRangeType&)*this;
897  }
898  };
899 
902 
903 } // namespace OpenMS
Invalid range exception.
Definition: Exception.h:240
Definition: RangeManager.h:876
const ThisRangeType & getRange() const
get range of current data (call updateRanges() before to ensure the range is accurate)
Definition: RangeManager.h:888
typename RangeManager< RangeBases... >::ThisRangeType ThisRangeType
Definition: RangeManager.h:878
virtual void updateRanges()=0
ThisRangeType & getRange()
get mutable range, provided for efficiency reasons (avoid updateRanges(), if only minor changes were ...
Definition: RangeManager.h:894
virtual ~RangeManagerContainer()=default
D'tor.
Handles the management of a multidimensional range, e.g. RangeMZ and RangeIntensity for spectra.
Definition: RangeManager.h:544
void pushInto(const RangeManager< RangeBasesOther... > &sandbox)
Definition: RangeManager.h:682
bool assignUnsafe(const RangeManager< RangeBasesOther... > &rhs)
Definition: RangeManager.h:570
const RangeBase & getRangeForDim(MSDim dim) const
obtain a range dimension at runtime using dim
Definition: RangeManager.h:726
bool pushIntoUnsafe(const RangeManager< RangeBasesOther... > &rhs)
Definition: RangeManager.h:661
bool clampToUnsafe(const RangeManager< RangeBasesOther... > &rhs)
Definition: RangeManager.h:696
HasRangeType hasRange() const
is any/some/all dimension in this range populated?
Definition: RangeManager.h:756
RangeBase & getRangeForDim(MSDim dim)
obtain a range dimension at runtime using dim
Definition: RangeManager.h:741
bool operator==(const RangeManager &rhs) const
Definition: RangeManager.h:550
void for_each_base_(Visitor &&visitor)
use fold expression to iterate over all RangeBases of RangeManager and apply a lambda (Visitor) for e...
Definition: RangeManager.h:845
void for_each_base_(Visitor &&visitor) const
.. and a const version
Definition: RangeManager.h:851
ThisRangeType & clear(const DIM_UNIT range)
Definition: RangeManager.h:808
void clampTo(const RangeManager< RangeBasesOther... > &rhs)
Definition: RangeManager.h:717
void scaleBy(const double factor)
calls RangeBase::scale() for each dimension
Definition: RangeManager.h:632
void minSpanIfSingular(const double min_span)
If any dimension is a single point, e.g. min==max, then extend this dimension by min_span / 2 on eith...
Definition: RangeManager.h:647
auto & assign(const RangeManager< RangeBasesOther... > &rhs)
Definition: RangeManager.h:590
bool extendUnsafe(const RangeManager< RangeBasesOther... > &rhs)
Definition: RangeManager.h:604
void clearRanges()
Resets all ranges.
Definition: RangeManager.h:799
void printRange(std::ostream &out) const
print each dimension (base classes) to a stream
Definition: RangeManager.h:835
void extend(const RangeManager< RangeBasesOther... > &rhs)
Definition: RangeManager.h:623
bool operator!=(const RangeManager &rhs) const
Definition: RangeManager.h:560
bool containsAll(const RangeManager< RangeBasesOther... > &rhs) const
Definition: RangeManager.h:779
static void static_for_each_base_(Visitor &&visitor)
use fold expression to iterate over all RangeBases of RangeManager and apply a lambda (Visitor) for e...
Definition: RangeManager.h:858
bool contains(T value, T min, T max)
Is a value contained in [min, max] ?
Definition: MathFunctions.h:62
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
DIM
Definition: DimMapper.h:601
MSDim
Dimensions of data acquisition for MS data.
Definition: RangeManager.h:24
DIM_UNIT
Definition: CommonEnums.h:20
@ IM_VSSC
volt-second per square centimeter (i.e. 1/K_0)
@ INT
intensity
@ FAIMS_CV
FAIMS compensation voltage.
@ RT
RT in seconds.
@ IM_MS
ion mobility milliseconds
HasRangeType
Enum listing state of dimensions (RangeBases)
Definition: RangeManager.h:521
@ ALL
all dimensions are filled
@ SOME
some dimensions are empty, some are filled
@ NONE
all dimensions are empty (=cleared)
Base class for a simple range with minimum and maximum.
Definition: RangeManager.h:38
double max_
Definition: RangeManager.h:279
double getSpan() const
Definition: RangeManager.h:254
RangeBase(const double single)
Cutom C'tor which sets the range to a singular point.
Definition: RangeManager.h:44
RangeBase(const RangeBase &rhs)=default
Copy C'tor.
void setMin(const double min)
sets the minimum (and the maximum, if uninitialized)
Definition: RangeManager.h:112
RangeBase & operator=(RangeBase &&rhs) noexcept=default
Move assignment (seems useless, but is required for completeness in derived classes' move c'tor)
std::pair< double, double > getNonEmptyRange() const
Return the current range, or (if empty) a full range (-1e308, 1e308).
Definition: RangeManager.h:269
void scaleBy(const double factor)
Scale the range of the dimension by a factor. A factor > 1 increases the range; factor < 1 decreases ...
Definition: RangeManager.h:226
RangeBase & operator=(const RangeBase &rhs)=default
Assignment operator.
void minSpanIfSingular(const double min_span)
If the current range is a single point, e.g. min==max, then extend the range by min_span / 2 on eithe...
Definition: RangeManager.h:169
void pushInto(const RangeBase &sandbox)
Definition: RangeManager.h:194
void shift(const double distance)
Definition: RangeManager.h:237
~RangeBase() noexcept=default
D'tor.
bool contains(const double value) const
is value within [min, max]?
Definition: RangeManager.h:94
double center() const
Definition: RangeManager.h:246
RangeBase()=default
C'tor: initialize with empty range.
void extend(const double value)
extend the range such that it includes the given value
Definition: RangeManager.h:148
void extendLeftRight(const double by)
Definition: RangeManager.h:157
RangeBase(RangeBase &&rhs) noexcept=default
Move C'tor (seems useless, but is required for completeness in derived classes' move c'tor)
bool contains(const RangeBase &inner_range) const
is the range inner_range within [min, max]?
Definition: RangeManager.h:100
void clampTo(const RangeBase &other)
Definition: RangeManager.h:180
double getMin() const
only useful if isEmpty() returns false
Definition: RangeManager.h:128
void clear()
make the range empty, i.e. isEmpty() will be true
Definition: RangeManager.h:82
void setMax(const double max)
sets the maximum (and the minimum, if uninitialized)
Definition: RangeManager.h:120
bool isEmpty() const
is the range empty (i.e. min > max)?
Definition: RangeManager.h:88
double min_
Definition: RangeManager.h:278
RangeBase(const double min, const double max)
Definition: RangeManager.h:51
bool operator==(const RangeBase &rhs) const
Definition: RangeManager.h:260
double getMax() const
only useful if isEmpty() returns false
Definition: RangeManager.h:134
void extend(const RangeBase &other)
ensure the range includes the range of other
Definition: RangeManager.h:141
Definition: RangeManager.h:402
void setMinIntensity(const double min)
sets the minimum (and the maximum, if uninitialized)
Definition: RangeManager.h:416
double getMinIntensity() const
only useful if isEmpty() returns false
Definition: RangeManager.h:428
void extendIntensity(const double value)
extend the range such that it includes the given value
Definition: RangeManager.h:441
bool containsIntensity(const double value) const
is value within [min, max]?
Definition: RangeManager.h:447
double getMaxIntensity() const
only useful if isEmpty() returns false
Definition: RangeManager.h:434
bool containsIntensity(const RangeBase &inner_range) const
is the range inner_range within [min, max] of this range?
Definition: RangeManager.h:453
void setMaxIntensity(const double max)
sets the maximum (and the minimum, if uninitialized)
Definition: RangeManager.h:422
Definition: RangeManager.h:344
bool containsMZ(const RangeBase &inner_range) const
is the range inner_range within [min, max] of this range?
Definition: RangeManager.h:395
void setMaxMZ(const double max)
sets the maximum (and the minimum, if uninitialized)
Definition: RangeManager.h:364
void extendMZ(const double value)
extend the range such that it includes the given value
Definition: RangeManager.h:383
void setMinMZ(const double min)
sets the minimum (and the maximum, if uninitialized)
Definition: RangeManager.h:358
double getMaxMZ() const
only useful if isEmpty() returns false
Definition: RangeManager.h:376
double getMinMZ() const
only useful if isEmpty() returns false
Definition: RangeManager.h:370
bool containsMZ(const double value) const
is value within [min, max]?
Definition: RangeManager.h:389
Definition: RangeManager.h:461
bool containsMobility(const double value) const
is value within [min, max]?
Definition: RangeManager.h:505
void extendMobility(const double value)
extend the range such that it includes the given value
Definition: RangeManager.h:499
double getMinMobility() const
only useful if isEmpty() returns false
Definition: RangeManager.h:486
bool containsMobility(const RangeBase &inner_range) const
is the range inner_range within [min, max] of this range?
Definition: RangeManager.h:511
double getMaxMobility() const
only useful if isEmpty() returns false
Definition: RangeManager.h:492
void setMinMobility(const double min)
sets the minimum (and the maximum, if uninitialized)
Definition: RangeManager.h:474
void setMaxMobility(const double max)
sets the maximum (and the minimum, if uninitialized)
Definition: RangeManager.h:480
Definition: RangeManager.h:284
bool containsRT(const RangeBase &inner_range) const
is the range inner_range within [min, max] of this range?
Definition: RangeManager.h:335
void extendRT(const double value)
extend the range such that it includes the given value
Definition: RangeManager.h:323
double getMaxRT() const
only useful if isEmpty() returns false
Definition: RangeManager.h:316
void setMaxRT(const double max)
sets the maximum (and the minimum, if uninitialized)
Definition: RangeManager.h:304
void setMinRT(const double min)
sets the minimum (and the maximum, if uninitialized)
Definition: RangeManager.h:298
double getMinRT() const
only useful if isEmpty() returns false
Definition: RangeManager.h:310
bool containsRT(const double value) const
is value within [min, max]?
Definition: RangeManager.h:329