OpenMS  2.7.0
Public Types | Public Member Functions | List of all members
IMSDataConsumer Class Referenceabstract

The interface of a consumer of spectra and chromatograms. More...

#include <OpenMS/INTERFACES/IMSDataConsumer.h>

Inheritance diagram for IMSDataConsumer:
[legend]

Public Types

typedef MSSpectrum SpectrumType
 
typedef MSChromatogram ChromatogramType
 

Public Member Functions

virtual ~IMSDataConsumer ()
 
virtual void consumeSpectrum (SpectrumType &s)=0
 Consume a spectrum. More...
 
virtual void consumeChromatogram (ChromatogramType &)=0
 Consume a chromatogram. More...
 
virtual void setExpectedSize (size_t expectedSpectra, size_t expectedChromatograms)=0
 Set expected size of spectra and chromatograms to be consumed. More...
 
virtual void setExperimentalSettings (const ExperimentalSettings &exp)=0
 Set experimental settings (meta-data) of the data to be consumed. More...
 

Detailed Description

The interface of a consumer of spectra and chromatograms.

The data consumer is able to consume data of type MSSpectrum and MSChromatogram and process them (it may modify the spectra). The consumer interface may be used when data is generated sequentially (e.g. by reading from disc) and needs to be processed as fast as possible without ever holding the full set of data in memory.

The consumer expects to be informed about the number of spectra and chromatograms to consume and potentially about the ExperimentalSettings before_consuming any spectra. This can be critical for consumers who write data to disk. Depending on the implementation, an exception may occur if the ExperimentalSettings and the size of the experiment are not set before consuming any spectra.

Implementations in OpenMS can be found in OpenMS/FORMAT/DATAACCESS

Note
The member functions setExpectedSize and setExperimentalSettings are expected to be called before consuming starts.

Member Typedef Documentation

◆ ChromatogramType

◆ SpectrumType

Constructor & Destructor Documentation

◆ ~IMSDataConsumer()

virtual ~IMSDataConsumer ( )
inlinevirtual

Member Function Documentation

◆ consumeChromatogram()

virtual void consumeChromatogram ( ChromatogramType )
pure virtual

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
sThe chromatogram to be consumed

Implemented in FullSwathFileConsumer, MSDataWritingConsumer, MSDataTransformingConsumer, MSDataStoringConsumer, MSDataSqlConsumer, MSDataChainingConsumer, MSDataCachedConsumer, MSDataAggregatingConsumer, NoopMSDataConsumer, and NoopMSDataWritingConsumer.

◆ consumeSpectrum()

virtual void consumeSpectrum ( SpectrumType s)
pure virtual

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

Implemented in MSDataWritingConsumer, MSDataTransformingConsumer, MSDataStoringConsumer, MSDataSqlConsumer, MSDataChainingConsumer, MSDataCachedConsumer, MSDataAggregatingConsumer, NoopMSDataConsumer, NoopMSDataWritingConsumer, and FullSwathFileConsumer.

◆ setExpectedSize()

virtual void setExpectedSize ( size_t  expectedSpectra,
size_t  expectedChromatograms 
)
pure virtual

Set expected size of spectra and chromatograms to be consumed.

Some implementations might care about the number of spectra and chromatograms to be consumed and need to be informed about this (usually before consuming starts).

Note
Calling this method is optional but good practice.
Parameters
expectedSpectraNumber of spectra expected
expectedChromatogramsNumber of chromatograms expected

Implemented in FullSwathFileConsumer, NoopMSDataConsumer, MSDataTransformingConsumer, MSDataSqlConsumer, MSDataCachedConsumer, MSDataAggregatingConsumer, MSDataStoringConsumer, MSDataChainingConsumer, and MSDataWritingConsumer.

◆ setExperimentalSettings()

virtual void setExperimentalSettings ( const ExperimentalSettings exp)
pure virtual

Set experimental settings (meta-data) of the data to be consumed.

Some implementations might need to know about the meta-data (or the context) of the spectra and chromatograms to be consumed. This method allows them learn this.

Note
Calling this method is optional but good practice.
Parameters
expExperimental settings meta data for the data to be consumed

Implemented in MSDataTransformingConsumer, MSDataAggregatingConsumer, MSDataStoringConsumer, MSDataChainingConsumer, FullSwathFileConsumer, MSDataWritingConsumer, NoopMSDataConsumer, NoopMSDataWritingConsumer, MSDataSqlConsumer, and MSDataCachedConsumer.