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

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

#include <Stream1dArray.hpp>

Public Member Functions

 Stream1dArray (DataSetPointer_ pointers_ptr, hsize_t length, DataSetPointer_ heap_ptr)
 
hsize_t chunk_size () const
 
hsize_t load (std::string *buffer)
 
hsize_t start () const
 

Detailed Description

template<typename Offset_, typename Length_, typename DataSetPointer_ = const H5::DataSet*>
class ritsuko::cvls::Stream1dArray< Offset_, Length_, DataSetPointer_ >

Stream a 1-dimensional compressed VLS array into memory.

Template Parameters
Offset_Unsigned integer type for the starting offset on the heap, see Pointer::offset.
Length_Unsigned integer type for the length of the string, see Pointer::length.
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 compressed VLS array in chunks. Callers can then iterate over the individual strings.

Constructor & Destructor Documentation

◆ Stream1dArray()

template<typename Offset_ , typename Length_ , typename DataSetPointer_ = const H5::DataSet*>
ritsuko::cvls::Stream1dArray< Offset_, Length_, DataSetPointer_ >::Stream1dArray ( DataSetPointer_ pointers_ptr,
hsize_t length,
DataSetPointer_ heap_ptr )
inline
Parameters
pointers_ptrPointer to a HDF5 dataset containing the compressed VLS pointers. It is assumed that this dataset satisfies validate_pointer_datatype(). It is also assumed that this dataset is 1-dimensional.
lengthLength of the pointers_ptr dataset, i.e., the extent of its sole dimension.
heap_ptrPointer to a HDF5 dataset containing the compressed VLS heap. It is assumed that this dataset already satisfies validate_heap().

Member Function Documentation

◆ chunk_size()

template<typename Offset_ , typename Length_ , typename DataSetPointer_ = const H5::DataSet*>
hsize_t ritsuko::cvls::Stream1dArray< Offset_, Length_, DataSetPointer_ >::chunk_size ( ) const
inline
Returns
Size of each chunk, in terms of the number of elements.

◆ load()

template<typename Offset_ , typename Length_ , typename DataSetPointer_ = const H5::DataSet*>
hsize_t ritsuko::cvls::Stream1dArray< Offset_, Length_, 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<typename Offset_ , typename Length_ , typename DataSetPointer_ = const H5::DataSet*>
hsize_t ritsuko::cvls::Stream1dArray< Offset_, Length_, 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: