ritsuko
Helper utilities for ArtifactDB C++ code
Loading...
Searching...
No Matches
ritsuko::hdf5::Stream1dStringDataset< DataSetPointer_ > Class Template Reference

Stream a 1-dimensional HDF5 string dataset into memory. More...

#include <Stream1dStringDataset.hpp>

Public Member Functions

 Stream1dStringDataset (DataSetPointer_ data_ptr, hsize_t length)
 
hsize_t chunk_size () const
 
hsize_t load (std::string *buffer)
 
hsize_t start () const
 

Detailed Description

template<class DataSetPointer_ = const H5::DataSet*>
class ritsuko::hdf5::Stream1dStringDataset< DataSetPointer_ >

Stream a 1-dimensional HDF5 string dataset into memory.

Template Parameters
DataSetPointer_Class of a pointer to a H5::DataSet. This can be raw or smart depending on the caller's management of its lifetime.

This streams in a 1-dimensional HDF5 string dataset in a chunk-wise manner. The aim is to enable inspection of the dataset contents while minimizing memory usage.

Constructor & Destructor Documentation

◆ Stream1dStringDataset()

template<class DataSetPointer_ = const H5::DataSet*>
ritsuko::hdf5::Stream1dStringDataset< DataSetPointer_ >::Stream1dStringDataset ( DataSetPointer_ data_ptr,
hsize_t length )
inline
Parameters
data_ptrPointer to a HDF5 dataset. It is assumed that this dataset is 1-dimensional. It is also assumed that its datatype is an integer or float.

If data_ptr is a raw pointer, it should not be deleted before the last call to any methods of this Stream1dStringDataset instance.

Parameters
lengthLength of the dataset, i.e., the extent of its sole dimension.

Member Function Documentation

◆ chunk_size()

template<class DataSetPointer_ = const H5::DataSet*>
hsize_t ritsuko::hdf5::Stream1dStringDataset< DataSetPointer_ >::chunk_size ( ) const
inline
Returns
Size of each chunk, in terms of the number of elements.

◆ load()

template<class DataSetPointer_ = const H5::DataSet*>
hsize_t ritsuko::hdf5::Stream1dStringDataset< DataSetPointer_ >::load ( std::string * buffer)
inline

Load the contents of the next chunk in the dataset.

Parameters
[out]bufferPointer to an array of chunk_size(), where each entry is a valid std::string. On output, this contains the contents of the current chunk in its first $X$ elements, where $X$ is the return value of this method.
Returns
Number of elements loaded in the current chunk. If zero is returned, the dataset traversal is complete.

◆ start()

template<class DataSetPointer_ = const H5::DataSet*>
hsize_t ritsuko::hdf5::Stream1dStringDataset< DataSetPointer_ >::start ( ) const
inline

Get the start position of the current chunk, i.e., the index of the first element in the chunk. That is, buffer[j] corresponds to the start() + j-th element of the dataset. This should only be called after load().

Returns
Start position of the current chunk.

The documentation for this class was generated from the following file: