| OpenMS 2.5.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:

## 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

typedef MSChromatogram ChromatogramType

## ◆ SpectrumType

typedef MSSpectrum SpectrumType

## Constructor & Destructor Documentation

## ◆ ~IMSDataConsumer()

virtual ~IMSDataConsumer | ( |  | ) |

inline virtual

## 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

  s | The chromatogram to be consumed

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

## ◆ 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

  s | The spectrum to be consumed

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

## ◆ 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

  expectedSpectra | Number of spectra expected
  expectedChromatograms | Number of chromatograms expected

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

## ◆ 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

  exp | Experimental settings meta data for the data to be consumed

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