mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-04-22 08:24:35 +02:00
Make core-buffer folder with all common stuff used in the buffer
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#ifndef BUFFER_UTILS_HPP
|
||||
#define BUFFER_UTILS_HPP
|
||||
|
||||
const size_t FILE_MOD = 1000;
|
||||
const size_t FOLDER_MOD = 100000;
|
||||
|
||||
std::string get_filename(
|
||||
std::string root_folder,
|
||||
std::string device_name,
|
||||
uint64_t pulse_id)
|
||||
{
|
||||
uint64_t folder_base = pulse_id / FOLDER_MOD;
|
||||
folder_base *= FOLDER_MOD;
|
||||
|
||||
uint64_t file_base = pulse_id / FILE_MOD;
|
||||
file_base *= FILE_MOD;
|
||||
|
||||
std::stringstream folder;
|
||||
folder << root_folder << "/";
|
||||
folder << device_name << "/";
|
||||
folder << folder_base << "/";
|
||||
folder << file_base << ".h5";
|
||||
|
||||
return folder.str();
|
||||
}
|
||||
|
||||
std::size_t get_file_frame_index(uint64_t pulse_id)
|
||||
{
|
||||
uint64_t file_base = pulse_id / FILE_MOD;
|
||||
file_base *= FILE_MOD;
|
||||
|
||||
return pulse_id - file_base;
|
||||
}
|
||||
|
||||
#endif //BUFFER_UTILS_HPP
|
||||
Reference in New Issue
Block a user