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

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

#include <Stream1dStringDataset.hpp>

Public Member Functions

 Stream1dStringDataset (const H5::DataSet *ptr, hsize_t length, hsize_t buffer_size)
 
 Stream1dStringDataset (const H5::DataSet *ptr, hsize_t buffer_size)
 
std::string get ()
 
std::string steal ()
 
void next (size_t jump=1)
 
hsize_t length () const
 
hsize_t position () const
 

Detailed Description

Stream a 1-dimensional HDF5 string dataset into memory.

This streams in a 1-dimensional HDF5 string dataset in contiguous blocks, using block sizes defined by pick_1d_block_size(). Callers can then iterate over the individual strings.

Constructor & Destructor Documentation

◆ Stream1dStringDataset() [1/2]

ritsuko::hdf5::Stream1dStringDataset::Stream1dStringDataset ( const H5::DataSet * ptr,
hsize_t length,
hsize_t buffer_size )
inline
Parameters
ptrPointer to a HDF5 dataset handle.
lengthLength of the dataset as a 1-dimensional vector.
buffer_sizeSize of the buffer for holding streamed blocks of values. Larger buffers improve speed at the cost of some memory efficiency.

◆ Stream1dStringDataset() [2/2]

ritsuko::hdf5::Stream1dStringDataset::Stream1dStringDataset ( const H5::DataSet * ptr,
hsize_t buffer_size )
inline

Overloaded constructor where the length is automatically determined.

Parameters
ptrPointer to a HDF5 dataset handle.
buffer_sizeSize of the buffer for holding streamed blocks of values.

Member Function Documentation

◆ get()

std::string ritsuko::hdf5::Stream1dStringDataset::get ( )
inline
Returns
String at the current position of the stream.

◆ length()

hsize_t ritsuko::hdf5::Stream1dStringDataset::length ( ) const
inline
Returns
Length of the dataset.

◆ next()

void ritsuko::hdf5::Stream1dStringDataset::next ( size_t jump = 1)
inline

Advance to the next position of the stream.

Parameters
jumpNumber of positions by which to advance the stream.

◆ position()

hsize_t ritsuko::hdf5::Stream1dStringDataset::position ( ) const
inline
Returns
Current position on the stream.

◆ steal()

std::string ritsuko::hdf5::Stream1dStringDataset::steal ( )
inline
Returns
String at the current position of the stream. Unlike get(), this avoids a copy by directly acquiring the string, but it invalidates all subsequent get() and steal() requests until next() is called.

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