OpenMS
MSDataTransformingConsumer Class Reference

Transforming consumer of MS data. More...

#include <OpenMS/FORMAT/DATAACCESS/MSDataTransformingConsumer.h>

Inheritance diagram for MSDataTransformingConsumer:
[legend]
Collaboration diagram for MSDataTransformingConsumer:
[legend]

Public Member Functions

 MSDataTransformingConsumer ()
 Constructor. More...
 
 ~MSDataTransformingConsumer () override
 Default destructor. More...
 
void setExpectedSize (Size, Size) override
 ignored More...
 
void consumeSpectrum (SpectrumType &s) override
 Consume a spectrum. More...
 
virtual void setSpectraProcessingFunc (std::function< void(SpectrumType &)> f_spec)
 Sets the lambda function to be called for every spectrum which is passed to this interface. More...
 
void consumeChromatogram (ChromatogramType &c) override
 Consume a chromatogram. More...
 
virtual void setChromatogramProcessingFunc (std::function< void(ChromatogramType &)> f_chrom)
 Sets the lambda function to be called for every chromatogram which is passed to this interface. More...
 
virtual void setExperimentalSettingsFunc (std::function< void(const OpenMS::ExperimentalSettings &)> f_exp_settings)
 Sets the lambda function to be called when setExperimentalSettings is called via this interface. More...
 
void setExperimentalSettings (const OpenMS::ExperimentalSettings &) override
 ignored More...
 
- Public Member Functions inherited from IMSDataConsumer
virtual ~IMSDataConsumer ()
 

Protected Attributes

std::function< void(SpectrumType &)> lambda_spec_
 
std::function< void(ChromatogramType &)> lambda_chrom_
 
std::function< void(const OpenMS::ExperimentalSettings &)> lambda_exp_settings_
 

Additional Inherited Members

- Public Types inherited from IMSDataConsumer
typedef MSSpectrum SpectrumType
 
typedef MSChromatogram ChromatogramType
 

Detailed Description

Transforming consumer of MS data.

Is able to work on spectrum/chromatogram on the fly while it is read using a lambda function provided by the user. The lambda can transform the spectrum/chromatogram in-place or just extract some information and store it in locally captured variables. Just make sure the captured variables are still in scope when this consumer is used.

Constructor & Destructor Documentation

◆ MSDataTransformingConsumer()

Constructor.

◆ ~MSDataTransformingConsumer()

Default destructor.

Member Function Documentation

◆ consumeChromatogram()

void consumeChromatogram ( ChromatogramType c)
overridevirtual

Consume a chromatogram.

The chromatogram will be consumed by the implementation and possibly modified.

Note
The implementation might not allow to consume spectra and chromatograms in any order
Parameters
cThe chromatogram to be consumed

Implements IMSDataConsumer.

◆ consumeSpectrum()

void consumeSpectrum ( SpectrumType s)
overridevirtual

Consume a spectrum.

The spectrum will be consumed by the implementation and possibly modified.

Note
The implementation might not allow to consume spectra and chromatograms in any order
Parameters
sThe spectrum to be consumed

Implements IMSDataConsumer.

◆ setChromatogramProcessingFunc()

virtual void setChromatogramProcessingFunc ( std::function< void(ChromatogramType &)>  f_chrom)
virtual

Sets the lambda function to be called for every chromatogram which is passed to this interface.

The lambda can contain locally captured variables, which allow to change some state. Make sure that the captured variables are still in scope (i.e. not destroyed at the point of calling the lambda). Pass a nullptr if the chromatogram should be left unchanged.

◆ setExpectedSize()

void setExpectedSize ( Size  ,
Size   
)
overridevirtual

ignored

Implements IMSDataConsumer.

◆ setExperimentalSettings()

void setExperimentalSettings ( const OpenMS::ExperimentalSettings )
overridevirtual

ignored

Implements IMSDataConsumer.

◆ setExperimentalSettingsFunc()

virtual void setExperimentalSettingsFunc ( std::function< void(const OpenMS::ExperimentalSettings &)>  f_exp_settings)
virtual

Sets the lambda function to be called when setExperimentalSettings is called via this interface.

The lambda can contain locally captured variables, which allow to change some state. Make sure that the captured variables are still in scope (i.e. not destroyed at the point of calling the lambda). Pass a nullptr if nothing should happen (default).

◆ setSpectraProcessingFunc()

virtual void setSpectraProcessingFunc ( std::function< void(SpectrumType &)>  f_spec)
virtual

Sets the lambda function to be called for every spectrum which is passed to this interface.

The lambda can contain locally captured variables, which allow to change some state. Make sure that the captured variables are still in scope (i.e. not destroyed at the point of calling the lambda). Pass a nullptr if the spectrum should be left unchanged.

Member Data Documentation

◆ lambda_chrom_

std::function<void (ChromatogramType&)> lambda_chrom_
protected

◆ lambda_exp_settings_

std::function<void (const OpenMS::ExperimentalSettings&)> lambda_exp_settings_
protected

◆ lambda_spec_

std::function<void (SpectrumType&)> lambda_spec_
protected