Files
Jungfraujoch/writer/HDF5DataFile.h

60 lines
1.5 KiB
C++

// Copyright (2019-2022) Paul Scherrer Institute
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef HDF5DATAFILE_H
#define HDF5DATAFILE_H
#include <queue>
#include <string>
#include <chrono>
#include "HDF5Objects.h"
#include "../common/SpotToSave.h"
#include "../frame_serialize/ImageMessage.h"
struct HDF5DataFileStatistics {
std::string filename;
uint64_t max_image_number;
uint64_t total_images;
};
class HDF5DataFile {
std::string filename;
std::unique_ptr<HDF5File> data_file = nullptr;
std::unique_ptr<HDF5DataSet> data_set = nullptr;
size_t xpixel;
size_t ypixel;
size_t max_image_number;
size_t nimages;
HDF5Dcpl dcpl;
HDF5DataType data_type;
std::string image_units;
std::vector<uint64_t> bunch_id;
std::vector<uint32_t> jf_info;
std::vector<uint64_t> timestamp;
std::vector<float> spot_x;
std::vector<float> spot_y;
std::vector<float> spot_intensity;
std::vector<uint32_t> spot_count;
const size_t max_spots;
std::vector<uint8_t> indexing_result;
void CreateFile();
public:
HDF5DataFile(const std::string& name, int64_t width, int64_t height, int64_t pixel_depth_byte,
bool is_signed, CompressionAlgorithm compression = CompressionAlgorithm::BSHUF_LZ4,
size_t max_spots = 0);
~HDF5DataFile();
void Write(const DataMessage& msg, uint64_t image_number);
HDF5DataFileStatistics GetStatistics() const;
size_t GetNumImages() const;
};
#endif //HDF5DATAFILE_H