35 #ifndef OPENMS_FORMAT_DATAACCESS_MSDATACACHEDCONSUMER_H
36 #define OPENMS_FORMAT_DATAACCESS_MSDATACACHEDCONSUMER_H
67 ofs_(filename.c_str(), std::ios::binary),
68 clearData_(clearData),
70 chromatograms_written_(0)
73 ofs_.write((
char*)&file_identifier,
sizeof(file_identifier));
84 ofs_.write((
char*)&spectra_written_,
sizeof(spectra_written_));
85 ofs_.write((
char*)&chromatograms_written_,
sizeof(chromatograms_written_));
98 if (chromatograms_written_ > 0)
101 "Cannot write spectra after writing chromatograms.");
103 writeSpectrum_(s, ofs_);
105 if (clearData_) {s.
clear(
false);}
113 writeChromatogram_(c, ofs_);
114 chromatograms_written_++;
115 if (clearData_) {c.
clear(
false);}
Size spectra_written_
Definition: MSDataCachedConsumer.h:125
A more convenient string class.
Definition: String.h:57
Size chromatograms_written_
Definition: MSDataCachedConsumer.h:126
~MSDataCachedConsumer()
Destructor.
Definition: MSDataCachedConsumer.h:81
MapType::SpectrumType SpectrumType
Definition: MSDataCachedConsumer.h:56
Transforming and cached writing consumer of MS data.
Definition: MSDataCachedConsumer.h:51
MSDataCachedConsumer(String filename, bool clearData=true)
Constructor.
Definition: MSDataCachedConsumer.h:66
std::ofstream ofs_
Definition: MSDataCachedConsumer.h:123
A method or algorithm argument contains illegal values.
Definition: Exception.h:634
MSExperiment MapType
Definition: MSDataCachedConsumer.h:55
void clear(bool clear_meta_data)
Clears all data and meta data.
Definition: MSSpectrum.h:635
void consumeChromatogram(ChromatogramType &c)
Write a chromatogram to the output file.
Definition: MSDataCachedConsumer.h:111
void setExperimentalSettings(const ExperimentalSettings &)
Set experimental settings (meta-data) of the data to be consumed.
Definition: MSDataCachedConsumer.h:120
An class that uses on-disk caching to read and write spectra and chromatograms.
Definition: CachedMzML.h:62
The interface of a consumer of spectra and chromatograms.
Definition: IMSDataConsumer.h:68
MapType::ChromatogramType ChromatogramType
Definition: MSDataCachedConsumer.h:57
void setExpectedSize(Size, Size)
Set expected size of spectra and chromatograms to be consumed.
Definition: MSDataCachedConsumer.h:118
bool clearData_
Definition: MSDataCachedConsumer.h:124
#define CACHED_MZML_FILE_IDENTIFIER
Definition: CachedMzML.h:48
void clear(bool clear_meta_data)
Clears all data and meta data.
Definition: MSChromatogram.h:587
void consumeSpectrum(SpectrumType &s)
Write a spectrum to the output file.
Definition: MSDataCachedConsumer.h:96
Description of the experimental settings.
Definition: ExperimentalSettings.h:59