h5::open | h5::close | h5::create | h5::mute

Detailed Description

The open | close, create operations listed here are to create a place holder, an hdf5 file, for your datasets. In POSIX sense this is an entire image of a file system and the dataset is a file within. These datasets can be manipulated with Create|Read|Write|Append operation. File IO operations are straight maps from already existing HDF5 calls, hence they are freely interchangeable.

Function Documentation

hid_t h5::create ( const std::string &  path)
inline

create an HDF5 file with default properties, in most cases this is all you need to have a container for datasets.

Parameters
paththe location where the file is created
Returns
an open hid_t HDF5 file descriptor
See also
open close gzip H5Fcreate H5Fopen H5Fclose H5Dopen H5Dclose
hid_t fd = h5::create("example.h5"); // create file and save descriptor
... // do some work
h5::close(fd); // close file descriptor
hid_t h5::open ( const std::string &  path,
unsigned  flags 
)
inline

open an existing HDF5 file.

Parameters
paththe location of the file
flags(H5F_ACC_RDWR[|H5F_ACC_SWMR_WRITE])| H5F_ACC_RDONLY
See also
open close create H5Fcreate H5Fopen H5Fclose H5Dopen H5Dclose
hid_t fd = h5::open("example.h5", H5F_ACC_RDWR); // open an hdf5 file
... // do some work
h5::close(fd); // close file descriptor
Examples:
arma.cpp, blaze.cpp, blitz.cpp, dlib.cpp, eigen3.cpp, itpp.cpp, raw.cpp, and ublas.cpp.
hid_t h5::open ( hid_t  fd,
const std::string &  path 
)
inline

open an existing HDF5 file

Parameters
fdvalid HDF5 file descriptor
paththe location of the dataset within HDF5 file
See also
open close create gzip H5Fcreate H5Fopen H5Fclose H5Dopen H5Dclose
hid_t fd = h5::open("example.h5", H5F_ACC_RDWR); // open an hdf5 file in read-write mode
hid_t ds = h5::open(fd,"dataset.txt") // obtain ds descriptor
... // do some work
H5Dclose(ds); // close ds descriptor
H5Fclose(fd); // close file descriptor
void h5::close ( hid_t  fd)
inline

closes opened file descriptor

Parameters
fdvalid and opened file descriptor to an HDF5 file
See also
open close create H5Fcreate H5Fopen H5Fclose H5Dopen H5Dclose
hid_t fd = h5::open("example.h5", H5F_ACC_RDWR); // open an hdf5 file in read-write mode
... // do some work
h5::close(fd); // close file descriptor
Examples:
arma-partial.cpp, arma-perf.cpp, arma.cpp, blaze.cpp, blitz.cpp, dlib.cpp, eigen3.cpp, itpp.cpp, raw.cpp, stl-perf.cpp, stl.cpp, struct-perf.cpp, struct.cpp, and ublas.cpp.
void h5::mute ( )
inline

removes default error handler preventing diagnostic error messages printed

See also
H5Eset_auto2 H5Error open close H5Fcreate H5Fopen H5Fclose
hid_t fd;
if( fd = h5::open("example.h5") < 0 ) // try to open files
fd = h5::create("example.h5"); // and create on failure
... // do some work
h5::close(fd); // close file descriptor