| 30 | } |
| 31 | |
| 32 | void CachedMzMLHandler::writeMemdump(const MapType& exp, const String& out) const |
| 33 | { |
| 34 | std::ofstream ofs(out.c_str(), std::ios::binary); |
| 35 | Size exp_size = exp.size(); |
| 36 | Size chrom_size = exp.getChromatograms().size(); |
| 37 | int file_identifier = CACHED_MZML_FILE_IDENTIFIER; |
| 38 | ofs.write((char*)&file_identifier, sizeof(file_identifier)); |
| 39 | |
| 40 | startProgress(0, exp.size() + exp.getChromatograms().size(), "storing binary data"); |
| 41 | for (Size i = 0; i < exp.size(); i++) |
| 42 | { |
| 43 | setProgress(i); |
| 44 | writeSpectrum_(exp[i], ofs); |
| 45 | } |
| 46 | |
| 47 | for (Size i = 0; i < exp.getChromatograms().size(); i++) |
| 48 | { |
| 49 | setProgress(i); |
| 50 | writeChromatogram_(exp.getChromatograms()[i], ofs); |
| 51 | } |
| 52 | |
| 53 | ofs.write((char*)&exp_size, sizeof(exp_size)); |
| 54 | ofs.write((char*)&chrom_size, sizeof(chrom_size)); |
| 55 | ofs.close(); |
| 56 | endProgress(); |
| 57 | } |
| 58 | |
| 59 | void CachedMzMLHandler::readMemdump(MapType& exp_reading, const String& filename) const |
| 60 | { |