mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-04-26 11:10:45 +02:00
Passing the output file as a string
This commit is contained in:
@@ -17,12 +17,10 @@ struct DetWriterConfig {
|
||||
|
||||
return {
|
||||
config_parameters["detector_name"].GetString(),
|
||||
config_parameters["output_folder"].GetString()
|
||||
};
|
||||
}
|
||||
|
||||
const std::string detector_name;
|
||||
const std::string output_folder;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ extern "C" {
|
||||
class JFH5Writer {
|
||||
|
||||
const std::string detector_name_;
|
||||
const std::string root_folder_;
|
||||
|
||||
static const int64_t NO_RUN_ID = -1;
|
||||
|
||||
@@ -35,23 +34,23 @@ class JFH5Writer {
|
||||
void close_file();
|
||||
|
||||
public:
|
||||
explicit JFH5Writer(
|
||||
const std::string detector_name, const std::string root_folder);
|
||||
JFH5Writer(std::string detector_name);
|
||||
~JFH5Writer();
|
||||
|
||||
void open_run(int64_t run_id,
|
||||
uint32_t n_images,
|
||||
uint32_t image_y_size,
|
||||
uint32_t image_x_size,
|
||||
uint32_t bits_per_pixel);
|
||||
void open_run(const std::string& output_file,
|
||||
const int64_t run_id,
|
||||
const uint32_t n_images,
|
||||
const uint32_t image_y_size,
|
||||
const uint32_t image_x_size,
|
||||
const uint32_t bits_per_pixel);
|
||||
void close_run();
|
||||
|
||||
void write_data(int64_t run_id,
|
||||
uint32_t index,
|
||||
void write_data(const int64_t run_id,
|
||||
const uint32_t index,
|
||||
const char* data);
|
||||
|
||||
void write_meta(int64_t run_id,
|
||||
uint32_t index,
|
||||
void write_meta(const int64_t run_id,
|
||||
const uint32_t index,
|
||||
const ImageMetadata& meta);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <H5version.h>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
#include "JFH5Writer.hpp"
|
||||
#include "live_writer_config.hpp"
|
||||
@@ -15,10 +16,8 @@ using namespace std;
|
||||
using namespace buffer_config;
|
||||
using namespace live_writer_config;
|
||||
|
||||
JFH5Writer::JFH5Writer(
|
||||
const std::string detector_name, const std::string root_folder):
|
||||
detector_name_(detector_name),
|
||||
root_folder_(root_folder)
|
||||
JFH5Writer::JFH5Writer(std::string detector_name):
|
||||
detector_name_(std::move(detector_name))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -42,7 +41,8 @@ hid_t JFH5Writer::get_datatype(const int bits_per_pixel)
|
||||
}
|
||||
}
|
||||
|
||||
void JFH5Writer::open_run(const int64_t run_id,
|
||||
void JFH5Writer::open_run(const string& output_file,
|
||||
const int64_t run_id,
|
||||
const uint32_t n_images,
|
||||
const uint32_t image_y_size,
|
||||
const uint32_t image_x_size,
|
||||
@@ -50,10 +50,6 @@ void JFH5Writer::open_run(const int64_t run_id,
|
||||
{
|
||||
close_run();
|
||||
|
||||
const string output_folder = root_folder_ + "/" + OUTPUT_FOLDER_SYMLINK;
|
||||
// TODO: Maybe add leading zeros to filename?
|
||||
const string output_file = output_folder + to_string(run_id) + ".h5";
|
||||
|
||||
current_run_id_ = run_id;
|
||||
image_y_size_ = image_y_size;
|
||||
image_x_size_ = image_x_size;
|
||||
|
||||
@@ -45,7 +45,7 @@ int main (int argc, char *argv[])
|
||||
RamBuffer image_buffer(config.detector_name + "_assembler",
|
||||
sizeof(ImageMetadata), IMAGE_N_BYTES, 1, RAM_BUFFER_N_SLOTS);
|
||||
|
||||
JFH5Writer writer(config.detector_name, config.output_folder);
|
||||
JFH5Writer writer(config.detector_name);
|
||||
WriterStats stats(config.detector_name);
|
||||
|
||||
StoreStream meta = {};
|
||||
|
||||
Reference in New Issue
Block a user