diff --git a/core-writer/test/mock/TestH5Format.cpp b/core-writer/test/mock/TestH5Format.cpp new file mode 100644 index 0000000..04a945b --- /dev/null +++ b/core-writer/test/mock/TestH5Format.cpp @@ -0,0 +1,73 @@ +#include +#include +#include + +#include "config.hpp" +#include "H5Format.hpp" + +using namespace std; +using s_ptr = shared_ptr; + +class TestH5Format : public H5Format +{ + shared_ptr> input_value_type = NULL; + shared_ptr> default_values = NULL; + shared_ptr> dataset_move_mapping = NULL; + shared_ptr file_format = NULL; + +public: + ~TestH5Format(){}; + + TestH5Format(const string& dataset_name) + { + input_value_type.reset(new unordered_map()); + default_values.reset(new unordered_map()); + + // After format has been writen, where to move the raw datasets. + dataset_move_mapping.reset( + new std::unordered_map({})); + + // Definition of the file format. + file_format.reset( + new h5_parent("", EMPTY_ROOT, { + s_ptr(new h5_group("detector", {})) + })); + } + + const h5_parent& get_format_definition() const override + { + return *file_format; + } + + const unordered_map& get_default_values() const override + { + return *default_values; + } + + void add_calculated_values(unordered_map& values) const override + { + // No calculated values. + } + + void add_input_values(unordered_map& values, + const unordered_map& input_values) const override + { + // Input value mapping is 1:1. + for (const auto& input_value : input_values) { + const auto& name = input_value.first; + const auto& value = input_value.second; + + values[name] = value; + } + } + + const std::unordered_map& get_input_value_type() const override + { + return *input_value_type; + } + + const unordered_map& get_dataset_move_mapping() const override { + return *dataset_move_mapping; + } + +};