h5cpp  0.5.0
A modern C++ wrapper for the HDF5 C library
Users Guide

Througout this manual we assume that every source snippet has somewhere

#include<h5cpp/h5cpp.hpp>
namespace h5 = h5cpp;

included.

Managing files

//creating a new file
h5::file f1 = h5::file::create("name.h5",....);
//opening an existing file
h5::file f2 = h5::file::open("name.h5",....);

Unlike in the C-API an instance of h5::file is not a valid parent object. For this purpose one has get the root group of the file with

h5::group root_group = f.root();

with groups

h5::group g = root_group.create("new_group",....);

Need to find a good way how to handle group creation property lists.

Groups should provide a STL compliant iterator interface

std::vector<h5::dataset> datasets;
h5::group g = ....;
std::copy_if(g.begin(),g.end(),std::back_inserter(datasets),
[](const auto &o) { return h5::is_dataset(o); });

hello

Datasets

and writing data

container adapter

using value_type = std::vector<double>;
using adapter_type = h5::container_type<value_type>;
h5::dataset d = group["detector_data"];
//container adapter for dataset d along the first dimension
adapter_type frames(d,0);
for(auto frame: frames)
{
//process the frame
}

Attributes

hdf5::dataspace::create
TypeTrait< T >::DataspaceType create(const T &value)
factory function for dataspaces
Definition: type_trait.hpp:89
hdf5::file::open
File open(const fs::path &path, AccessFlags flags=AccessFlags::ReadOnly, const property::FileAccessList &fapl=property::FileAccessList())
open an existing file
h5cpp.hpp