Add possibility of having an empty root

This commit is contained in:
2018-02-12 16:06:10 +01:00
parent a45c399edc
commit 3071706d42
2 changed files with 7 additions and 2 deletions
+5 -1
View File
@@ -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<std::string, h5_value>& 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;
+2 -1
View File
@@ -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<std::shared_ptr<h5_base>>& items) :
h5_group(const std::string& name, const std::list<std::shared_ptr<h5_base>>& items={}) :
h5_parent(name, GROUP, items) {};
};