diff --git a/src/H5Format.cpp b/src/H5Format.cpp index 5362303..660ffc1 100644 --- a/src/H5Format.cpp +++ b/src/H5Format.cpp @@ -280,7 +280,11 @@ void H5FormatUtils::write_attribute(H5::H5Object& target, const h5_attr& attribu void H5FormatUtils::write_format_data(H5::Group& file_node, const h5_parent& format_node, const std::map& values) { - auto node_group = H5FormatUtils::create_group(file_node, format_node.name); + H5::Group node_group = file_node; + + if (format_node.node_type == GROUP) { + node_group = H5FormatUtils::create_group(file_node, format_node.name); + } for (const auto item_ptr : format_node.items) { const h5_base& item = *item_ptr; diff --git a/src/H5Format.hpp b/src/H5Format.hpp index 9212b50..e803aeb 100644 --- a/src/H5Format.hpp +++ b/src/H5Format.hpp @@ -13,6 +13,7 @@ typedef boost::any h5_value; enum NODE_TYPE { + EMPTY_ROOT, ATTRIBUTE, DATASET, GROUP @@ -63,7 +64,7 @@ struct h5_parent: public h5_base struct h5_group : public h5_parent { - h5_group(const std::string& name, const std::list>& items) : + h5_group(const std::string& name, const std::list>& items={}) : h5_parent(name, GROUP, items) {}; };