35 #ifndef OPENMS_FORMAT_DATAACCESS_MSDATACACHEDCONSUMER_H 36 #define OPENMS_FORMAT_DATAACCESS_MSDATACACHEDCONSUMER_H 70 ofs_(filename.c_str(),
std::ios::binary),
71 clearData_(clearData),
73 chromatograms_written_(0)
76 ofs_.write((
char*)&file_identifier,
sizeof(file_identifier));
87 ofs_.write((
char*)&spectra_written_,
sizeof(spectra_written_));
88 ofs_.write((
char*)&chromatograms_written_,
sizeof(chromatograms_written_));
101 if (chromatograms_written_ > 0)
104 "Cannot write spectra after writing chromatograms.");
106 writeSpectrum_(s, ofs_);
108 if (clearData_) {s.
clear(
false);}
116 writeChromatogram_(c, ofs_);
117 chromatograms_written_++;
118 if (clearData_) {c.
clear(
false);}
Size spectra_written_
Definition: MSDataCachedConsumer.h:128
A more convenient string class.
Definition: String.h:57
The representation of a chromatogram.
Definition: MSChromatogram.h:55
Size chromatograms_written_
Definition: MSDataCachedConsumer.h:129
~MSDataCachedConsumer()
Destructor.
Definition: MSDataCachedConsumer.h:84
Transforming and cached writing consumer of MS data.
Definition: MSDataCachedConsumer.h:55
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
MSDataCachedConsumer(String filename, bool clearData=true)
Constructor.
Definition: MSDataCachedConsumer.h:69
std::ofstream ofs_
Definition: MSDataCachedConsumer.h:126
The representation of a 1D spectrum.
Definition: MSSpectrum.h:67
A method or algorithm argument contains illegal values.
Definition: Exception.h:649
MSSpectrum SpectrumType
Definition: MSDataCachedConsumer.h:59
void clear(bool clear_meta_data)
Clears all data and meta data.
void consumeChromatogram(ChromatogramType &c)
Write a chromatogram to the output file.
Definition: MSDataCachedConsumer.h:114
void setExperimentalSettings(const ExperimentalSettings &)
Set experimental settings (meta-data) of the data to be consumed.
Definition: MSDataCachedConsumer.h:123
An class that uses on-disk caching to read and write spectra and chromatograms.
Definition: CachedMzML.h:64
MSChromatogram ChromatogramType
Definition: MSDataCachedConsumer.h:60
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
The interface of a consumer of spectra and chromatograms.
Definition: IMSDataConsumer.h:68
void setExpectedSize(Size, Size)
Set expected size of spectra and chromatograms to be consumed.
Definition: MSDataCachedConsumer.h:121
bool clearData_
Definition: MSDataCachedConsumer.h:127
#define CACHED_MZML_FILE_IDENTIFIER
Definition: CachedMzML.h:50
void clear(bool clear_meta_data)
Clears all data and meta data.
void consumeSpectrum(SpectrumType &s)
Write a spectrum to the output file.
Definition: MSDataCachedConsumer.h:99
Description of the experimental settings.
Definition: ExperimentalSettings.h:59