#include <armadillo>
#include "pod.h"
#include "non-pod.h"
#include <h5cpp/all>
#include "generated.h"
#define CHUNK_SIZE 5
#define NROWS (4 * CHUNK_SIZE)
#define NCOLS (1 * CHUNK_SIZE)
int main() {
{
h5::current_dims{NROWS, NCOLS},
h5::chunk{1, CHUNK_SIZE} | h5::gzip{8});
}
{
h5::write(fd,
"orm/partial/vector one_shot", records);
h5::write(fd,
"orm/partial/vector custom_dims", records,
h5::max_dims{H5S_UNLIMITED}, h5::gzip{9} |
h5::chunk{20});
h5::write(fd,
"orm/partial/vector custom_dims different_order", records,
h5::chunk{20} | h5::gzip{9}, h5::max_dims{H5S_UNLIMITED},
h5::stride{6}, h5::block{4}, h5::current_dims{100}, h5::offset{2});
}
{
auto data =
h5::read<T>(fd,
"/orm/partial/vector one_shot");
for (const auto& r : data)
}
{
for (
size_t i = 0; i < records.
size(); ++i)
records[i].idx = i;
h5::current_dims{NROWS, NCOLS},
h5::chunk{1, CHUNK_SIZE} | h5::gzip{8});
}
{
sn::sensor::timeseries_t ts;
ts.timestamp_ns = 1'700'000'000'000'000'000ULL;
ts.tag = "accelerometer";
ts.internal_id = 42;
ts.readings = {1.0, 2.0, 3.0, 4.0, 5.0};
sn::sensor::timeseries_t ts_back;
h5::gather(fd, "/sensor/timeseries", ts_back);
std::cerr <<
"Tier-2 gather: timestamp=" << ts_back.timestamp_ns
<< " label=" << ts_back.tag
<< " readings=[";
for (size_t i = 0; i < ts_back.readings.size(); ++i)
std::cerr << (i ?
"," :
"") << ts_back.readings[i];
}
}
h5::at_t create(const hid_t &parent, const std::string &path, args_t &&... args)
Create a new attribute of element type T on a parent HDF5 object.
Definition H5Acreate.hpp:100
T aread(const hid_t &ds, const std::string &name, const h5::acpl_t &acpl=h5::default_acpl)
Read an attribute by name and return its value as type T.
Definition H5Aread.hpp:76
h5::gr_t write(const LOC &parent, const std::string &path, const T &src)
Write a sparse matrix or vector as a CSC group.
Definition H5Dsparse.hpp:185
h5::ds_t scatter(hid_t fd, const std::string &path, const T &obj)
Generic scatter (write) template for tier-2+ types.