// Copyright (2019-2022) Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-or-later #ifndef HDF5DATAFILE_H #define HDF5DATAFILE_H #include #include #include #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 data_file = nullptr; std::unique_ptr data_set = nullptr; std::unique_ptr data_set_spot_x = nullptr; std::unique_ptr data_set_spot_y = nullptr; std::unique_ptr data_set_spot_int = nullptr; std::unique_ptr data_set_spot_indexed = nullptr; std::unique_ptr result_group = nullptr; std::unique_ptr rad_int_group = 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 bunch_id; std::vector jf_info; std::vector timestamp; std::vector storage_cell; std::vector exptime; std::vector receiver_available_send_buffers; std::vector receiver_aq_dev_delay; std::vector rad_int_bin_to_q; std::vector rad_int_file_avg; std::vector indexing_lattice; std::vector spot_count; const size_t max_spots; std::vector indexing_result; void CreateFile(); public: HDF5DataFile(const std::string& name, int64_t width, int64_t height, int64_t pixel_depth_byte, bool is_signed, const std::vector& rad_int_bin_to_q, 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