OpenMS
2.8.0
|
Handles the management of a multidimensional range, e.g. RangeMZ and RangeIntensity for spectra. More...
#include <OpenMS/KERNEL/RangeManager.h>
Public Member Functions | |
bool | operator== (const RangeManager &rhs) const |
template<typename... RangeBasesOther> | |
bool | assignUnsafe (const RangeManager< RangeBasesOther... > &rhs) |
template<typename... RangeBasesOther> | |
void | assign (const RangeManager< RangeBasesOther... > &rhs) |
template<typename... RangeBasesOther> | |
bool | extendUnsafe (const RangeManager< RangeBasesOther... > &rhs) |
template<typename... RangeBasesOther> | |
void | extend (const RangeManager< RangeBasesOther... > &rhs) |
void | scaleBy (const double factor) |
calls RangeBase::scale() for each dimension More... | |
RangeBase & | getRangeForDim (MSDim dim) |
obtain a range dimension at runtime using dim More... | |
HasRangeType | hasRange () const |
is any/some/all dimension in this range populated? More... | |
template<typename... RangeBasesOther> | |
bool | containsAll (const RangeManager< RangeBasesOther... > &rhs) const |
void | clearRanges () |
Resets all ranges. More... | |
void | printRange (std::ostream &out) const |
print each dimension (base classes) to a stream More... | |
Protected Member Functions | |
template<typename Visitor > | |
void | for_each_base_ (Visitor &&visitor) |
use fold expression to iterate over all RangeBases of RangeManager and apply a lambda (Visitor) for each one More... | |
template<typename Visitor > | |
void | for_each_base_ (Visitor &&visitor) const |
.. and a const version More... | |
Static Protected Member Functions | |
template<typename Visitor > | |
static void | static_for_each_base_ (Visitor &&visitor) |
use fold expression to iterate over all RangeBases of RangeManager and apply a lambda (Visitor) for each one (for static members) More... | |
Handles the management of a multidimensional range, e.g. RangeMZ and RangeIntensity for spectra.
Instanciate it with the dimensions which are supported/required, e.g. RangeManager<RangeRT, RangeMZ> range_spec
for a spectrum and use the strongly typed features, such as range_spec.getMaxRT()/setMaxRT(500.0) or range_spec.extend(RangeMZ{100, 1500});
Use RangeManagerContainer as a base class for all peak and feature containers like MSSpectrum, MSExperiment and FeatureMap.
The implementation uses non-virtual multiple inheritance using variadic templates. Each dimension, e.g. RangeRT, is inherited from, thus all members of the base class become accessible in the RangeManager, e.g. ::getMaxRT(). Operations (e.g. assignment, or extension of ranges) across RangeManagers with a different, yet overlapping set of base classes is enabled using fold expressions and constexpr evaluations, which are resolved at compile time (see for_each_base_ member function).
|
inline |
copy all overlapping dimensions from rhs
to this instance. Dimensions which are not contained in rhs
are left untouched.
rhs | Range to copy from |
Exception::InvalidRange | if no dimensions overlapped |
References RangeManager< RangeBases >::assignUnsafe().
Referenced by LayerDataChrom::getRange(), LayerDataConsensus::getRange(), LayerDataFeature::getRange(), and LayerDataPeak::getRange().
|
inline |
copy all overlapping dimensions from rhs
to this instance. Dimensions which are not contained in rhs
are left untouched.
rhs | Range to copy from |
References RangeManager< RangeBases >::for_each_base_().
Referenced by RangeManager< RangeBases >::assign().
|
inline |
Resets all ranges.
References RangeManager< RangeBases >::for_each_base_().
|
inline |
Are all dimensions of rhs
(which overlap with this Range) contained in this range? An empty dimension is considered contained in the other dimension (even if that one is empty as well). If only all overlapping dimensions are empty, true is returned.
Exception::InvalidRange | if no dimensions overlap |
References RangeManager< RangeBases >::for_each_base_().
|
inline |
extend all dimensions which overlap with rhs
to contain the range of rhs
Dimensions which are not contained in rhs
are left untouched.
rhs | Range to extend from |
Exception::InvalidRange | if no dimensions overlapped |
References RangeManager< RangeBases >::extendUnsafe().
|
inline |
extend all dimensions which overlap with rhs
to contain the range of rhs
Dimensions which are not contained in rhs
are left untouched.
rhs | Range to extend from |
References RangeManager< RangeBases >::for_each_base_().
Referenced by RangeManager< RangeBases >::extend().
|
inlineprotected |
use fold expression to iterate over all RangeBases of RangeManager and apply a lambda (Visitor) for each one
Referenced by RangeManager< RangeBases >::assignUnsafe(), RangeManager< RangeBases >::clearRanges(), RangeManager< RangeBases >::containsAll(), RangeManager< RangeBases >::extendUnsafe(), RangeManager< RangeBases >::hasRange(), RangeManager< RangeBases >::operator==(), RangeManager< RangeBases >::printRange(), and RangeManager< RangeBases >::scaleBy().
|
inlineprotected |
.. and a const version
obtain a range dimension at runtime using dim
References RangeManager< RangeBases >::static_for_each_base_().
|
inline |
is any/some/all dimension in this range populated?
References OpenMS::ALL, RangeManager< RangeBases >::for_each_base_(), OpenMS::NONE, and OpenMS::SOME.
|
inline |
References RangeManager< RangeBases >::for_each_base_().
|
inline |
print each dimension (base classes) to a stream
References RangeManager< RangeBases >::for_each_base_().
Referenced by OpenMS::operator<<().
|
inline |
calls RangeBase::scale() for each dimension
References RangeManager< RangeBases >::for_each_base_().
|
inlinestaticprotected |
use fold expression to iterate over all RangeBases of RangeManager and apply a lambda (Visitor) for each one (for static members)
Referenced by RangeManager< RangeBases >::getRangeForDim().