mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-04-24 02:30:44 +02:00
Add dataset move logic to format
This commit is contained in:
+3
-1
@@ -340,5 +340,7 @@ void H5FormatUtils::write_format(H5::H5File& file, const H5Format& format,
|
||||
|
||||
write_format_data(file, format_definition, format_values);
|
||||
|
||||
file.move(config::raw_image_dataset_name.c_str(), format.get_frames_dataset_name().c_str());
|
||||
for (const auto& mapping : format.get_dataset_move_mapping()) {
|
||||
file.move(mapping.first.c_str(), mapping.second.c_str());
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -100,13 +100,13 @@ class H5Format
|
||||
virtual void add_input_values(std::unordered_map<std::string, boost::any>& values,
|
||||
const std::unordered_map<std::string, boost::any>& input_values) const = 0;
|
||||
|
||||
virtual std::string get_frames_dataset_name() const = 0;
|
||||
virtual const std::unordered_map<std::string, std::string>& get_dataset_move_mapping() const = 0;
|
||||
};
|
||||
|
||||
namespace H5FormatUtils
|
||||
{
|
||||
hsize_t expand_dataset(H5::DataSet& dataset, hsize_t frame_index, hsize_t dataset_increase_step);
|
||||
|
||||
|
||||
void compact_dataset(H5::DataSet& dataset, hsize_t max_frame_index);
|
||||
|
||||
H5::Group create_group(H5::Group& target, const std::string& name);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
||||
#include "../config.hpp"
|
||||
#include "../H5Format.hpp"
|
||||
|
||||
using namespace std;
|
||||
@@ -13,6 +14,7 @@ class NXmxFormat : public H5Format
|
||||
{
|
||||
shared_ptr<unordered_map<string, DATA_TYPE>> input_value_type = NULL;
|
||||
shared_ptr<unordered_map<string, boost::any>> default_values = NULL;
|
||||
shared_ptr<unordered_map<string, std::string>> dataset_move_mapping = NULL;
|
||||
shared_ptr<h5_group> file_format = NULL;
|
||||
|
||||
public:
|
||||
@@ -93,6 +95,11 @@ class NXmxFormat : public H5Format
|
||||
{"samz", NX_FLOAT},
|
||||
}));
|
||||
|
||||
dataset_move_mapping.reset(new std::unordered_map<string, string>(
|
||||
{
|
||||
{config::raw_image_dataset_name, "entry/plottable_data/image"},
|
||||
}));
|
||||
|
||||
// Default values used in the file format.
|
||||
default_values.reset(new std::unordered_map<string, boost::any>(
|
||||
{
|
||||
@@ -897,10 +904,6 @@ class NXmxFormat : public H5Format
|
||||
}));
|
||||
}
|
||||
|
||||
string get_frames_dataset_name() const override {
|
||||
return "entry/plottable_data/data";
|
||||
}
|
||||
|
||||
const h5_group& get_format_definition() const override {
|
||||
return *file_format;
|
||||
}
|
||||
@@ -1052,4 +1055,8 @@ class NXmxFormat : public H5Format
|
||||
return *input_value_type;
|
||||
}
|
||||
|
||||
const unordered_map<string, string>& get_dataset_move_mapping() const override {
|
||||
return *dataset_move_mapping;
|
||||
}
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user