h5::context< T > Struct Template Reference

to maintain dataset context for state-full operations, this way reducing H5 library calls More...

Public Member Functions

 context (hid_t ds)
 
 ~context ()
 
void append (const T &ref)
 
void flush ()
 
 context (hid_t ds)
 
 ~context ()
 
void append (const T &ref)
 
void flush ()
 

Detailed Description

template<typename T>
struct h5::context< T >

to maintain dataset context for state-full operations, this way reducing H5 library calls

Examples:
arma-perf.cpp, struct-perf.cpp, and struct.cpp.

Constructor & Destructor Documentation

template<typename T>
h5::context< T >::context ( hid_t  ds)
inline
Parameters
dsvalud dataset descriptor which must be held open until context destroyed
Template Parameters
T::= pod struct | integral type
hid_t ds = ... get datatset descriptor ...
{ // new code block
... repetative append operations ...
} // flush is called, when ctx destroyed
H5Dclose(ds); // descriptor remains valid inside code block
template<typename T>
h5::context< T >::~context ( )
inline

as side effect it flushes internal cache and closes related states: hdf5 memory and file space

template<typename T>
h5::context< T >::context ( hid_t  ds)
inline
Parameters
dsvalud dataset descriptor which must be held open until context destroyed
Template Parameters
T::= pod struct | integral type
hid_t ds = ... get datatset descriptor ...
{ // new code block
... repetative append operations ...
} // flush is called, when ctx destroyed
H5Dclose(ds); // descriptor remains valid inside code block
template<typename T>
h5::context< T >::~context ( )
inline

as side effect it flushes internal cache and closes related states: hdf5 memory and file space

Member Function Documentation

template<typename T>
void h5::context< T >::append ( const T &  ref)
inline

appends object to HDF5 file stream

Parameters
refconst reference to object being saved
Template Parameters
T::=pod type | integral type

to avoid exessive HDF5 library calls internal state is maintained in addition to chunk size data cache. Upon DTOR the cache is flushed therefore it is imperative to have a valid dataset descriptor at the time

hid_t ds = ... get datatset descriptor ...
{
for( auto ref:dataset )
h5::append(ctx, ref);
} // flush is called, when ctx destroyed
H5Dclose(ds); // descriptor remains valid inside code block
template<typename T>
void h5::context< T >::flush ( )
inline

saves internal cache to HDF5 file

to avoid exessive HDF5 library calls internal state is maintained in addition to chunk size data cache. Upon DTOR the cache is flushed therefore it is imperative to have a valid dataset descriptor at the time

hid_t ds = ... get datatset descriptor ...
{
for( auto ref:dataset )
h5::append(ctx, ref);
} // flush is called, when ctx destroyed
H5Dclose(ds); // descriptor remains valid inside code block
template<typename T>
void h5::context< T >::append ( const T &  ref)
inline

appends object to HDF5 file stream

Parameters
refconst reference to object being saved
Template Parameters
T::=pod type | integral type

to avoid exessive HDF5 library calls internal state is maintained in addition to chunk size data cache. Upon DTOR the cache is flushed therefore it is imperative to have a valid dataset descriptor at the time

hid_t ds = ... get datatset descriptor ...
{
for( auto ref:dataset )
h5::append(ctx, ref);
} // flush is called, when ctx destroyed
H5Dclose(ds); // descriptor remains valid inside code block
template<typename T>
void h5::context< T >::flush ( )
inline

saves internal cache to HDF5 file

to avoid exessive HDF5 library calls internal state is maintained in addition to chunk size data cache. Upon DTOR the cache is flushed therefore it is imperative to have a valid dataset descriptor at the time

hid_t ds = ... get datatset descriptor ...
{
for( auto ref:dataset )
h5::append(ctx, ref);
} // flush is called, when ctx destroyed
H5Dclose(ds); // descriptor remains valid inside code block