h5::read<T>( ds | path [,offset] [,stride] [,count] [,dxpl] );

Detailed Description

Templated full or partial IO READ operations that help you to have access to [dataset]s by either returning supported linear algebra and STL containers or updating the content of already existing objects by passing reference or pointer to them. The provided implementations rely on compile time constexpr evaluations, SFINEA pattern matching as well as static_assert compile time error handling where ever was permitted. Optional runtime error mechanism added with HDF5 error stack unwinding otherwise. Starting from the most convenient implementation, where you only have to point at a dataset and the right size object is returned, you find calls which operate on pre-allocated objects. In case the objects are unsupported there is efficient implementation for raw pointers. When objects are passed then the number of elements are computed from the size of the object, therefore specifying h5::count is compile time error. On the other hand when working with classes and raw pointers, h5::count is the only way to tell how much data you're to retrieve, hence it is required. The first group of function arguments are mandatory whereas the optional arguments may be specified in any order, or omitted entirely.

Function Documentation

template<class T , class... args_t>
std::enable_if<!std::is_same<T,char*>::value, h5::herr_t>::type h5::read ( const h5::ds_t &  ds,
T *  ptr,
args_t &&...  args 
)

Updates the content of passed ptr pointer, which must have enough memory space to receive data. Optional arguments args:= h5::offset | h5::stride | h5::count | h5::block may be specified for partial IO, to describe the retrieved hyperslab from hdf5 file space. Default case is to select and retrieve all elements from dataset. h5::dxpl_t provides control to datatransfer.

h5::fd_t fd = h5::open("myfile.h5", H5F_ACC_RDWR);
h5::ds_t ds = h5::open(fd,"path/to/dataset");
std::vector<float> myvec(10*10);
auto err = h5::read( fd, "path/to/dataset", myvec.data(), h5::count{10,10}, h5::offset{5,0} );
Parameters
file_paththe location where the hdf5 container is created within the OS file system.
dataset_paththe location of the dataset/document within HDF5 container
ptrpointer to a sufficient size allocated memory where data is loaded
offsetthe coordinates withing HDF5 dataset with rank of the file space, for instance a cube {0,0,0}
stridedocs/links/h5cpp.txt par_stride update
countdocs/links/h5cpp.txt par_count update
blockdocs/links/h5cpp.txt par_block update
dcpldata trnsfer property list identifier
Template Parameters
T[unsigned]( int8_t | int16_t | int32_t | int64_t) | (float | double)
Returns
h5::herr_t error descriptor
template<class T , class... args_t>
h5::herr_t h5::read ( const h5::fd_t &  fd,
const std::string dataset_path,
T *  ptr,
args_t &&...  args 
)

Updates the content of passed ptr pointer, which must have enough memory space to receive data. Optional arguments args:= h5::offset | h5::stride | h5::count | h5::block may be specified for partial IO, to describe the retrieved hyperslab from hdf5 file space. Default case is to select and retrieve all elements from dataset. h5::dxpl_t provides control to datatransfer.

h5::fd_t fd = h5::open("myfile.h5", H5F_ACC_RDWR);
h5::ds_t ds = h5::open(fd,"path/to/dataset");
std::vector<float> myvec(10*10);
auto err = h5::read( fd, "path/to/dataset", myvec.data(), h5::count{10,10}, h5::offset{5,0} );
Parameters
file_paththe location where the hdf5 container is created within the OS file system.
dataset_paththe location of the dataset/document within HDF5 container
ptrpointer to a sufficient size allocated memory where data is loaded
offsetthe coordinates withing HDF5 dataset with rank of the file space, for instance a cube {0,0,0}
stridedocs/links/h5cpp.txt par_stride update
countdocs/links/h5cpp.txt par_count update
blockdocs/links/h5cpp.txt par_block update
dcpldata trnsfer property list identifier
Template Parameters
T[unsigned]( int8_t | int16_t | int32_t | int64_t) | (float | double)
Returns
h5::herr_t error descriptor
template<class T , class... args_t>
h5::herr_t h5::read ( const std::string file_path,
const std::string dataset_path,
T *  ptr,
args_t &&...  args 
)

Updates the content of passed ptr pointer, which must have enough memory space to receive data. Optional arguments args:= h5::offset | h5::stride | h5::count | h5::block may be specified for partial IO, to describe the retrieved hyperslab from hdf5 file space. Default case is to select and retrieve all elements from dataset.

h5::fd_t fd = h5::open("myfile.h5", H5F_ACC_RDWR);
h5::ds_t ds = h5::open(fd,"path/to/dataset");
std::vector<float> myvec(10*10);
auto err = h5::read( fd, "path/to/dataset", myvec.data(), h5::count{10,10}, h5::offset{5,0} );
Parameters
file_paththe location where the hdf5 container is created within the OS file system.
dataset_paththe location of the dataset/document within HDF5 container
ptrpointer to a sufficient size allocated memory where data is loaded
offsetthe coordinates withing HDF5 dataset with rank of the file space, for instance a cube {0,0,0}
stridedocs/links/h5cpp.txt par_stride update
countdocs/links/h5cpp.txt par_count update
blockdocs/links/h5cpp.txt par_block update
Template Parameters
T[unsigned]( int8_t | int16_t | int32_t | int64_t) | (float | double)
Returns
h5::herr_t error descriptor
template<class T , class... args_t>
h5::herr_t h5::read ( const h5::ds_t &  ds,
T &  ref,
args_t &&...  args 
)

Updates the content of passed ref reference, which must have enough memory space to receive data. Optional arguments args:= h5::offset | h5::stride | h5::count | h5::block may be specified for partial IO, to describe the retrieved hyperslab from hdf5 file space. Default case is to select and retrieve all elements from dataset.

h5::fd_t fd = h5::open("myfile.h5", H5F_ACC_RDWR);
h5::ds_t ds = h5::open(fd,"path/to/dataset");
std::vector<float> myvec(10*10);
auto err = h5::read( fd, "path/to/dataset", myvec, h5::offset{5,0} );
Parameters
dsvalid h5::ds_t dataset descriptor
ref[armadillo],[eigen],[blitz],[blaze],[dlib],[ublas] std::vector<T> object references
offsetthe coordinates withing HDF5 dataset with rank of the file space, for instance a cube {0,0,0}
stridedocs/links/h5cpp.txt par_stride update
blockdocs/links/h5cpp.txt par_block update
Template Parameters
T[unsigned]( int8_t | int16_t | int32_t | int64_t) | (float | double)
Returns
h5::herr_t error descriptor
template<class T , class... args_t>
h5::herr_t h5::read ( const h5::fd_t &  fd,
const std::string dataset_path,
T &  ref,
args_t &&...  args 
)

Updates the content of passed ref reference, which must have enough memory space to receive data. Optional arguments args:= h5::offset | h5::stride | h5::count | h5::block may be specified for partial IO, to describe the retrieved hyperslab from hdf5 file space. Default case is to select and retrieve all elements from dataset.

std::vector<float> myvec(10*10);
h5::fd_t fd = h5::open("myfile.h5", H5F_ACC_RDWR);
auto err = h5::read( fd, "path/to/dataset", myvec, h5::offset{5,0} );
Parameters
fdvalid h5::fd_t file descriptor
dataset_paththe location of the dataset/document within HDF5 container
ref[armadillo],[eigen],[blitz],[blaze],[dlib],[ublas] std::vector<T> object references
offsetthe coordinates withing HDF5 dataset with rank of the file space, for instance a cube {0,0,0}
stridedocs/links/h5cpp.txt par_stride update
blockdocs/links/h5cpp.txt par_block update
Template Parameters
T[unsigned]( int8_t | int16_t | int32_t | int64_t) | (float | double)
Returns
h5::herr_t error descriptor
template<class T , class... args_t>
h5::herr_t h5::read ( const std::string file_path,
const std::string dataset_path,
T &  ref,
args_t &&...  args 
)

Updates the content of passed ref reference, which must have enough memory space to receive data. Optional arguments args:= h5::offset | h5::stride | h5::count | h5::block may be specified for partial IO, to describe the retrieved hyperslab from hdf5 file space. Default case is to select and retrieve all elements from dataset.

std::vector<float> myvec(10*10);
auto err = h5::read( "path/to/file.h5", "path/to/dataset", myvec, h5::offset{5,0} );
Parameters
file_paththe location where the hdf5 container is created within the OS file system.
dataset_paththe location of the dataset/document within HDF5 container
ref[armadillo],[eigen],[blitz],[blaze],[dlib],[ublas] std::vector<T> object references
offsetthe coordinates withing HDF5 dataset with rank of the file space, for instance a cube {0,0,0}
stridedocs/links/h5cpp.txt par_stride update
blockdocs/links/h5cpp.txt par_block update
Template Parameters
T[unsigned]( int8_t | int16_t | int32_t | int64_t) | (float | double)
Returns
h5::herr_t error descriptor
template<class T , class... args_t>
T h5::read ( const h5::ds_t &  ds,
args_t &&...  args 
)

Direct read from an opened dataset descriptor that returns the entire data space wrapped into the object specified. Optional arguments args:= h5::offset | h5::stride | h5::count | h5::block may be specified for partial IO, to describe the retrieved hyperslab from hdf5 file space. Default case is to select and retrieve all elements from dataset.

h5::fd_t fd = h5::open("myfile.h5", H5F_ACC_RDWR);
auto vec = h5::read<std::vector<float>>( fd, "path/to/dataset", h5::count{10,10}, h5::offset{5,0} );
Parameters
dsvalid h5::ds_t dataset descriptor
offsetthe coordinates withing HDF5 dataset with rank of the file space, for instance a cube {0,0,0}
stridedocs/links/h5cpp.txt par_stride update
countdocs/links/h5cpp.txt par_count update
blockdocs/links/h5cpp.txt par_block update
Template Parameters
T[unsigned]( int8_t | int16_t | int32_t | int64_t) | (float | double)
Returns
a valid instantiated object of T element type
template<class T , class... args_t>
T h5::read ( hid_t  fd,
const std::string dataset_path,
args_t &&...  args 
)

Direct read from an opened file descriptor and dataset path that returns the entire data space wrapped into the object specified. Optional arguments args:= h5::offset | h5::stride | h5::count | h5::block may be specified in any order for partial IO, to describe the retrieved hyperslab from hdf5 file space. Default case is to select and retrieve all elements from dataset.

h5::fd_t fd = h5::open("myfile.h5", H5F_ACC_RDWR);
auto vec = h5::read<std::vector<float>>( fd, "path/to/dataset", h5::count{10,10}, h5::offset{5,0} );
Parameters
fdvalid h5::fd_t file descriptor
dataset_paththe location of the dataset/document within HDF5 container
offsetthe coordinates withing HDF5 dataset with rank of the file space, for instance a cube {0,0,0}
stridedocs/links/h5cpp.txt par_stride update
countdocs/links/h5cpp.txt par_count update
blockdocs/links/h5cpp.txt par_block update
Template Parameters
T[unsigned]( int8_t | int16_t | int32_t | int64_t) | (float | double)
Returns
a valid instantiated object of T element type
template<class T , class... args_t>
T h5::read ( const std::string file_path,
const std::string dataset_path,
args_t &&...  args 
)

Direct read from file and dataset path that returns the entire data space wrapped into the object specified. Optional arguments args:= h5::offset | h5:stride | h5::count | h5::block may be specified for partial IO, to describe the retrieved hyperslab from hdf5 file space. Default case is to select and retrieve all elements from dataset.

auto vec = h5::read<std::vector<float>>( "myfile.h5","path/to/dataset", h5::count{10,10}, h5::offset{5,0} );
Parameters
file_paththe location where the hdf5 container is created within the OS file system.
dataset_paththe location of the dataset/document within HDF5 container
offsetthe coordinates withing HDF5 dataset with rank of the file space, for instance a cube {0,0,0}
stridedocs/links/h5cpp.txt par_stride update
countdocs/links/h5cpp.txt par_count update
blockdocs/links/h5cpp.txt par_block update
Template Parameters
T[unsigned]( int8_t | int16_t | int32_t | int64_t) | (float | double)
Returns
a valid instantiated object of T element type