From d2d42ddf6085b7d71ac40f12b59be720b5a4d0e7 Mon Sep 17 00:00:00 2001 From: Andrej Babic Date: Tue, 16 Jun 2020 14:13:49 +0200 Subject: [PATCH] Add library to mock blocks --- sf-writer/test/mock/data.hpp | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 sf-writer/test/mock/data.hpp diff --git a/sf-writer/test/mock/data.hpp b/sf-writer/test/mock/data.hpp new file mode 100644 index 0000000..59f167d --- /dev/null +++ b/sf-writer/test/mock/data.hpp @@ -0,0 +1,53 @@ +#ifndef SF_DAQ_BUFFER_DATA_HPP +#define SF_DAQ_BUFFER_DATA_HPP + +#include +#include + +#include "buffer_config.hpp" + +auto get_test_buffer_block( + const uint64_t start_pulse_id, + const uint64_t stop_pulse_id, + const size_t n_modules, + const int pulse_id_step) +{ + using namespace std; + using namespace buffer_config; + + auto metadata = make_shared(); + metadata->block_start_pulse_id = start_pulse_id; + metadata->block_stop_pulse_id = start_pulse_id + BUFFER_BLOCK_SIZE - 1; + + for (uint64_t pulse_id=start_pulse_id; + pulse_id<=stop_pulse_id; + pulse_id++) { + + metadata->pulse_id[pulse_id] = pulse_id; + metadata->frame_index[pulse_id] = pulse_id + 10; + metadata->daq_rec[pulse_id] = pulse_id + 100; + metadata->is_good_image[pulse_id] = 1; + } + + auto image_buffer = make_unique( + MODULE_N_PIXELS * n_modules * BUFFER_BLOCK_SIZE); + + for (int i_block=0; i_block<=BUFFER_BLOCK_SIZE; i_block++) { + for (int i_module=0; i_module, unique_ptr> value( + metadata, move(image_buffer)); + + return value; +} + + +#endif //SF_DAQ_BUFFER_DATA_HPP