ritsuko
Helper utilities for ArtifactDB C++ code
Loading...
Searching...
No Matches
ritsuko::hdf5::vls::Stream1dArray< Offset_, Length_ > Class Template Reference

Stream a 1-dimensional VLS array into memory. More...

#include <Stream1dArray.hpp>

Public Member Functions

 Stream1dArray (const H5::DataSet *pointers, const H5::DataSet *heap, hsize_t length, hsize_t buffer_size)
 
 Stream1dArray (const H5::DataSet *pointers, const H5::DataSet *heap, 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

template<typename Offset_, typename Length_>
class ritsuko::hdf5::vls::Stream1dArray< Offset_, Length_ >

Stream a 1-dimensional VLS array into memory.

Template Parameters
Offset_Unsigned integer type for the starting offset on the heap.
Length_Unsigned integer type for the length of the string.

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

Constructor & Destructor Documentation

◆ Stream1dArray() [1/2]

template<typename Offset_ , typename Length_ >
ritsuko::hdf5::vls::Stream1dArray< Offset_, Length_ >::Stream1dArray ( const H5::DataSet * pointers,
const H5::DataSet * heap,
hsize_t length,
hsize_t buffer_size )
inline
Parameters
pointersPointer to a HDF5 dataset handle containing the VLS pointers, see open_pointers().
heapPointer to a HDF5 dataset handle containing the VLS heap, see open_heap().
lengthLength of the pointers dataset as a 1-dimensional vector.
buffer_sizeSize of the buffer for holding streamed blocks of strings. Larger buffers improve speed at the cost of some memory efficiency.

◆ Stream1dArray() [2/2]

template<typename Offset_ , typename Length_ >
ritsuko::hdf5::vls::Stream1dArray< Offset_, Length_ >::Stream1dArray ( const H5::DataSet * pointers,
const H5::DataSet * heap,
hsize_t buffer_size )
inline

Overloaded constructor where the length is automatically determined.

Parameters
pointersPointer to a HDF5 dataset handle containing the VLS pointers, see open_pointers().
heapPointer to a HDF5 dataset handle containing the VLS heap, see open_heap().
buffer_sizeSize of the buffer for holding streamed blocks of strings. Larger buffers improve speed at the cost of some memory efficiency.

Member Function Documentation

◆ get()

template<typename Offset_ , typename Length_ >
std::string ritsuko::hdf5::vls::Stream1dArray< Offset_, Length_ >::get ( )
inline
Returns
String at the current position of the stream.

◆ length()

template<typename Offset_ , typename Length_ >
hsize_t ritsuko::hdf5::vls::Stream1dArray< Offset_, Length_ >::length ( ) const
inline
Returns
Length of the dataset.

◆ next()

template<typename Offset_ , typename Length_ >
void ritsuko::hdf5::vls::Stream1dArray< Offset_, Length_ >::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()

template<typename Offset_ , typename Length_ >
hsize_t ritsuko::hdf5::vls::Stream1dArray< Offset_, Length_ >::position ( ) const
inline
Returns
Current position on the stream.

◆ steal()

template<typename Offset_ , typename Length_ >
std::string ritsuko::hdf5::vls::Stream1dArray< Offset_, Length_ >::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: