OpenMS  2.8.0
Public Member Functions | Private Attributes | List of all members
MSDataChainingConsumer Class Reference

Consumer class that passes all consumed data through a set of operations. More...

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

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

Public Member Functions

 MSDataChainingConsumer ()
 Default Constructor. More...
 
 MSDataChainingConsumer (std::vector< Interfaces::IMSDataConsumer * > consumers)
 Constructor. More...
 
 ~MSDataChainingConsumer () override
 Destructor. More...
 
void appendConsumer (Interfaces::IMSDataConsumer *consumer)
 Append a consumer to the chain of consumers to be executed. More...
 
void setExperimentalSettings (const ExperimentalSettings &settings) override
 Set experimental settings for all consumers. More...
 
void setExpectedSize (Size s_size, Size c_size) override
 Set expected size for all consumers. More...
 
void consumeSpectrum (SpectrumType &s) override
 Call all consumers in the specified order for the given spectrum. More...
 
void consumeChromatogram (ChromatogramType &c) override
 Call all consumers in the specified order for the given chromatogram. More...
 
- Public Member Functions inherited from IMSDataConsumer
virtual ~IMSDataConsumer ()
 

Private Attributes

std::vector< Interfaces::IMSDataConsumer * > consumers_
 

Additional Inherited Members

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

Detailed Description

Consumer class that passes all consumed data through a set of operations.

This consumer allows to chain multiple data consumers and applying them in a pre-specified order. This can be useful if a certain operation on a dataset needs to be performed but some pre-processing (data reduction etc.) or post-processing (writing to disk, caching on disk). The different processing steps can be added to the chaining consumer (in the correct order) without knowledge of the specific pre/post processing steps.

Usage:

MSDataTransformingConsumer * transforming_consumer_first = new MSDataTransformingConsumer(); // apply some transformation
MSDataTransformingConsumer * transforming_consumer_second = new MSDataTransformingConsumer(); // apply second transformation
MSDataWritingConsumer * writing_consumer = new MSDataWritingConsumer(outfile); // writing to disk
std::vector<Interfaces::IMSDataConsumer *> consumer_list;
consumer_list.push_back(transforming_consumer_first);
consumer_list.push_back(transforming_consumer_second);
consumer_list.push_back(writing_consumer);
MSDataChainingConsumer * chaining_consumer = new MSDataChainingConsumer(consumer_list);
// now chaining_consumer can be passed to a function expecting a IMSDataConsumer interface
MSDataChainingConsumer()
Default Constructor.

Constructor & Destructor Documentation

◆ MSDataChainingConsumer() [1/2]

Default Constructor.

◆ MSDataChainingConsumer() [2/2]

MSDataChainingConsumer ( std::vector< Interfaces::IMSDataConsumer * >  consumers)

Constructor.

Pass a list of consumers that should be called sequentially

Note
By default, this does not transfers ownership - it is the callers responsibility to delete the pointer to consumer afterwards.

◆ ~MSDataChainingConsumer()

~MSDataChainingConsumer ( )
override

Destructor.

Does nothing. Does not destroy underlying consumers, therefore is the responsibility of the caller to destroy all consumers.

Member Function Documentation

◆ appendConsumer()

void appendConsumer ( Interfaces::IMSDataConsumer consumer)

Append a consumer to the chain of consumers to be executed.

Note
This does not transfer ownership - it is the callers responsibility to delete the pointer to consumer afterwards.

◆ consumeChromatogram()

void consumeChromatogram ( ChromatogramType c)
overridevirtual

Call all consumers in the specified order for the given chromatogram.

Implements IMSDataConsumer.

◆ consumeSpectrum()

void consumeSpectrum ( SpectrumType s)
overridevirtual

Call all consumers in the specified order for the given spectrum.

Implements IMSDataConsumer.

◆ setExpectedSize()

void setExpectedSize ( Size  s_size,
Size  c_size 
)
overridevirtual

Set expected size for all consumers.

Will set the expected size for all chained consumers

Implements IMSDataConsumer.

◆ setExperimentalSettings()

void setExperimentalSettings ( const ExperimentalSettings settings)
overridevirtual

Set experimental settings for all consumers.

Will set the experimental settings for all chained consumers

Implements IMSDataConsumer.

Member Data Documentation

◆ consumers_

std::vector<Interfaces::IMSDataConsumer *> consumers_
private