OpenMS  2.7.0
Public Member Functions | Public Attributes | List of all members
PeakIndex Struct Reference

Index of a peak or feature. More...

#include <OpenMS/KERNEL/PeakIndex.h>

Collaboration diagram for PeakIndex:
[legend]

Public Member Functions

 PeakIndex ()
 Default constructor. Creates an invalid peak reference. More...
 
 PeakIndex (Size lpeak)
 Constructor that sets the peak index (for feature maps) More...
 
 PeakIndex (Size lspectrum, Size lpeak)
 Constructor that sets the peak and spectrum index (for peak maps) More...
 
bool isValid () const
 returns if the current peak ref is valid More...
 
void clear ()
 Invalidates the current index. More...
 
template<typename FeatureMapType >
const FeatureMapType::value_type & getFeature (const FeatureMapType &map) const
 Access to the feature (or consensus feature) corresponding to this index. More...
 
template<typename PeakMapType >
const PeakMapType::PeakType & getPeak (const PeakMapType &map) const
 Access to a peak corresponding to this index. More...
 
template<typename PeakMapType >
const PeakMapType::SpectrumType & getSpectrum (const PeakMapType &map) const
 Access to a spectrum corresponding to this index. More...
 
bool operator== (const PeakIndex &rhs) const
 Equality operator. More...
 
bool operator!= (const PeakIndex &rhs) const
 Inequality operator. More...
 

Public Attributes

Size peak
 Peak or feature index. More...
 
Size spectrum
 Spectrum index. More...
 

Detailed Description

Index of a peak or feature.

This struct can be used to store both peak or feature indices.

Constructor & Destructor Documentation

◆ PeakIndex() [1/3]

PeakIndex ( )
inline

Default constructor. Creates an invalid peak reference.

◆ PeakIndex() [2/3]

PeakIndex ( Size  lpeak)
inlineexplicit

Constructor that sets the peak index (for feature maps)

◆ PeakIndex() [3/3]

PeakIndex ( Size  lspectrum,
Size  lpeak 
)
inline

Constructor that sets the peak and spectrum index (for peak maps)

Member Function Documentation

◆ clear()

void clear ( )
inline

Invalidates the current index.

References PeakIndex::peak, and PeakIndex::spectrum.

◆ getFeature()

const FeatureMapType::value_type& getFeature ( const FeatureMapType &  map) const
inline

Access to the feature (or consensus feature) corresponding to this index.

This method is intended for arrays of features e.g. FeatureMap

The main advantage of using this method instead accessing the data directly is that range check performed in debug mode.

Exceptions
Exception::Preconditionis thrown if this index is invalid for the map (only in debug mode)

References OPENMS_PRECONDITION, and PeakIndex::peak.

◆ getPeak()

const PeakMapType::PeakType& getPeak ( const PeakMapType &  map) const
inline

Access to a peak corresponding to this index.

This method is intended for arrays of DSpectra e.g. MSExperiment

The main advantage of using this method instead accessing the data directly is that range check performed in debug mode.

Exceptions
Exception::Preconditionis thrown if this index is invalid for the map (only in debug mode)

References OPENMS_PRECONDITION, PeakIndex::peak, and PeakIndex::spectrum.

◆ getSpectrum()

const PeakMapType::SpectrumType& getSpectrum ( const PeakMapType &  map) const
inline

Access to a spectrum corresponding to this index.

This method is intended for arrays of DSpectra e.g. MSExperiment.

The main advantage of using this method instead accessing the data directly is that range check performed in debug mode.

Exceptions
Exception::Preconditionis thrown if this index is invalid for the map (only in debug mode)

References OPENMS_PRECONDITION, and PeakIndex::spectrum.

◆ isValid()

bool isValid ( ) const
inline

returns if the current peak ref is valid

References PeakIndex::peak.

◆ operator!=()

bool operator!= ( const PeakIndex rhs) const
inline

Inequality operator.

References PeakIndex::peak, and PeakIndex::spectrum.

◆ operator==()

bool operator== ( const PeakIndex rhs) const
inline

Equality operator.

References PeakIndex::peak, and PeakIndex::spectrum.

Member Data Documentation

◆ peak

Size peak

◆ spectrum

Size spectrum