Marray
Classes | Enumerations | Functions | Variables
andres::hdf5 Namespace Reference

HDF5 import/export support. More...

Classes

class  HandleCheck< false >
class  HandleCheck< true >

Enumerations

enum  FileAccessMode { READ_ONLY, READ_WRITE }
enum  HDF5Version { HDF5_VERSION_DEFAULT, HDF5_VERSION_LATEST }

Functions

template<class T >
void save (const hid_t &groupHandle, const std::string &datasetName, const Marray< T > &in)
 Save an Marray as an HDF5 dataset.
template<class T , bool isConst>
void save (const hid_t &groupHandle, const std::string &datasetName, const View< T, isConst > &in)
 Save a View as an HDF5 dataset.
template<class T , class BaseIterator , class ShapeIterator >
void saveHyperslab (const hid_t &groupHandle, const std::string &datasetName, BaseIterator baseBegin, BaseIterator baseEnd, ShapeIterator shapeBegin, const Marray< T > &in)
 Save an Marray as a hyperslab into an HDF5 dataset.
template<class T , class ShapeIterator >
void create (const hid_t &groupHandle, const std::string &datasetName, ShapeIterator begin, ShapeIterator end)
 Create and close an HDF5 dataset to store Marray data.
template<class T >
void load (const hid_t &groupHandle, const std::string &datasetName, Marray< T > &out)
 Load an Marray from an HDF5 dataset.
template<class T >
void load (const std::string &filename, const std::string &datasetName, Marray< T > &out, HDF5Version hdf5version)
 Open an HDF5 file (read only), load an Marray from an HDF5 dataset, and close the file.
template<class T >
void loadShape (const hid_t &groupHandle, const std::string &datasetName, std::vector< T > &out)
 Load the shape of an HDF5 dataset.
template<class T , class BaseIterator , class ShapeIterator >
void loadHyperslab (const hid_t &groupHandle, const std::string &datasetName, BaseIterator baseBegin, BaseIterator baseEnd, ShapeIterator shapeBegin, Marray< T > &out)
 Load a hyperslab from an HDF5 dataset into an Marray.
template<class T >
hid_t uintTypeHelper ()
template<class T >
hid_t intTypeHelper ()
template<class T >
hid_t floatingTypeHelper ()
template<class T >
hid_t hdf5Type ()
template<>
hid_t hdf5Type< unsigned char > ()
template<>
hid_t hdf5Type< unsigned short > ()
template<>
hid_t hdf5Type< unsigned int > ()
template<>
hid_t hdf5Type< unsigned long > ()
template<>
hid_t hdf5Type< unsigned long long > ()
template<>
hid_t hdf5Type< signed char > ()
template<>
hid_t hdf5Type< char > ()
template<>
hid_t hdf5Type< short > ()
template<>
hid_t hdf5Type< int > ()
template<>
hid_t hdf5Type< long > ()
template<>
hid_t hdf5Type< long long > ()
template<>
hid_t hdf5Type< float > ()
template<>
hid_t hdf5Type< double > ()
hid_t createFile (const std::string &filename, HDF5Version hdf5version=HDF5_VERSION_DEFAULT)
 Create an HDF5 file.
hid_t openFile (const std::string &filename, FileAccessMode fileAccessMode=READ_ONLY, HDF5Version hdf5version=HDF5_VERSION_DEFAULT)
 Open an HDF5 file.
void closeFile (const hid_t &handle)
 Close an HDF5 file.
hid_t createGroup (const hid_t &parentHandle, const std::string &groupName)
 Create an HDF5 group.
hid_t openGroup (const hid_t &parentHandle, const std::string &groupName)
 Open an HDF5 group.
void closeGroup (const hid_t &handle)
 Close an HDF5 group.
template<class T >
void save (const hid_t parentHandle, const std::string datasetName, const std::vector< T > &data)
 Save an std::vector to an HDF5 dataset.
template<class T >
void load (const hid_t parentHandle, const std::string datasetName, std::vector< T > &data, HDF5Version hdf5Version=HDF5_VERSION_DEFAULT)
 Load an std::vector from an HDF5 dataset.
template<class T >
void load (const std::string &filename, const std::string &datasetName, std::vector< T > &out, HDF5Version hdf5version)
 Open an HDF5 file (read only), load an std::vector from an HDF5 dataset, and close the file.

Variables

const std::string errorMessageLastMajorOrder = "Consider copying to an Marray in FirstMajorOrder or a one-dimensional Marray"

Detailed Description

HDF5 import/export support.

Enumeration Type Documentation

Enumerator:
READ_ONLY 
READ_WRITE 

Definition at line 19 of file hdf5.hxx.

Enumerator:
HDF5_VERSION_DEFAULT 
HDF5_VERSION_LATEST 

Definition at line 20 of file hdf5.hxx.

Function Documentation

void andres::hdf5::closeFile ( const hid_t &  handle)
inline

Close an HDF5 file.

Parameters
handleHandle to the HDF5 file.
See Also
openFile(), createFile()

Definition at line 179 of file hdf5.hxx.

void andres::hdf5::closeGroup ( const hid_t &  handle)
inline

Close an HDF5 group.

Parameters
handleHDF5 handle on group to close.
See Also
openGroup(), createGroup()

Definition at line 233 of file hdf5.hxx.

template<class T , class ShapeIterator >
void andres::hdf5::create ( const hid_t &  groupHandle,
const std::string &  datasetName,
ShapeIterator  begin,
ShapeIterator  end 
)

Create and close an HDF5 dataset to store Marray data.

Parameters
groupHandleHandle of the parent HDF5 file or group.
datasetNameName of the HDF5 dataset.
beginIterator to the beginning of a sequence that determines the shape of the dataset.
endIterator to the end of a sequence that determines the shape of the dataset.
See Also
save(), saveHyperslab()

Definition at line 53 of file marray-hdf5.hxx.

hid_t andres::hdf5::createFile ( const std::string &  filename,
HDF5Version  hdf5version = HDF5_VERSION_DEFAULT 
)
inline

Create an HDF5 file.

Parameters
filenameName of the file.
hdf5versionHDF5 version tag.
Returns
HDF5 handle
See Also
openFile(), closeFile()

Definition at line 120 of file hdf5.hxx.

hid_t andres::hdf5::createGroup ( const hid_t &  parentHandle,
const std::string &  groupName 
)
inline

Create an HDF5 group.

Parameters
parentHandleHDF5 handle on the parent group or file.
groupNameName of the group.
Returns
HDF5 handle on the created group
See Also
openGroup(), closeGroup()

Definition at line 194 of file hdf5.hxx.

template<class T >
hid_t andres::hdf5::floatingTypeHelper ( )
inline

Definition at line 70 of file hdf5.hxx.

template<class T >
hid_t andres::hdf5::hdf5Type ( )
inline
template<>
hid_t andres::hdf5::hdf5Type< char > ( )
inline

Definition at line 95 of file hdf5.hxx.

template<>
hid_t andres::hdf5::hdf5Type< double > ( )
inline

Definition at line 107 of file hdf5.hxx.

template<>
hid_t andres::hdf5::hdf5Type< float > ( )
inline

Definition at line 105 of file hdf5.hxx.

template<>
hid_t andres::hdf5::hdf5Type< int > ( )
inline

Definition at line 99 of file hdf5.hxx.

template<>
hid_t andres::hdf5::hdf5Type< long > ( )
inline

Definition at line 101 of file hdf5.hxx.

template<>
hid_t andres::hdf5::hdf5Type< long long > ( )
inline

Definition at line 103 of file hdf5.hxx.

template<>
hid_t andres::hdf5::hdf5Type< short > ( )
inline

Definition at line 97 of file hdf5.hxx.

template<>
hid_t andres::hdf5::hdf5Type< signed char > ( )
inline

Definition at line 93 of file hdf5.hxx.

template<>
hid_t andres::hdf5::hdf5Type< unsigned char > ( )
inline

Definition at line 83 of file hdf5.hxx.

template<>
hid_t andres::hdf5::hdf5Type< unsigned int > ( )
inline

Definition at line 87 of file hdf5.hxx.

template<>
hid_t andres::hdf5::hdf5Type< unsigned long > ( )
inline

Definition at line 89 of file hdf5.hxx.

template<>
hid_t andres::hdf5::hdf5Type< unsigned long long > ( )
inline

Definition at line 91 of file hdf5.hxx.

template<>
hid_t andres::hdf5::hdf5Type< unsigned short > ( )
inline

Definition at line 85 of file hdf5.hxx.

template<class T >
hid_t andres::hdf5::intTypeHelper ( )
inline

Definition at line 54 of file hdf5.hxx.

template<class T >
void andres::hdf5::load ( const hid_t &  groupHandle,
const std::string &  datasetName,
Marray< T > &  out 
)

Load an Marray from an HDF5 dataset.

Parameters
groupHandleHandle of the parent HDF5 file or group.
datasetNameName of the HDF5 dataset.
outMarray.

This function sets the out.coordinateOrder() to FirstMajorOrder!

See Also
loadHyperslab()

Definition at line 201 of file marray-hdf5.hxx.

template<class T >
void andres::hdf5::load ( const std::string &  filename,
const std::string &  datasetName,
Marray< T > &  out,
HDF5Version  hdf5version 
)
inline

Open an HDF5 file (read only), load an Marray from an HDF5 dataset, and close the file.

Parameters
filenameName of the file.
datasetNameName of the HDF5 dataset.
outMarray.
hdf5versionHDF5 version tag.

This function sets the out.coordinateOrder() to FirstMajorOrder!

See Also
load(), loadHyperslab()

TODO: write a unit test for this function

Definition at line 179 of file marray-hdf5.hxx.

template<class T >
void andres::hdf5::load ( const hid_t  parentHandle,
const std::string  datasetName,
std::vector< T > &  data,
HDF5Version  hdf5Version = HDF5_VERSION_DEFAULT 
)
inline

Load an std::vector from an HDF5 dataset.

Definition at line 270 of file hdf5.hxx.

template<class T >
void andres::hdf5::load ( const std::string &  filename,
const std::string &  datasetName,
std::vector< T > &  out,
HDF5Version  hdf5version 
)
inline

Open an HDF5 file (read only), load an std::vector from an HDF5 dataset, and close the file.

Parameters
filenameName of the file.
datasetNameName of the HDF5 dataset.
outstd::vector.
hdf5versionHDF5 version tag.
See Also
load()

Definition at line 322 of file hdf5.hxx.

template<class T , class BaseIterator , class ShapeIterator >
void andres::hdf5::loadHyperslab ( const hid_t &  groupHandle,
const std::string &  datasetName,
BaseIterator  baseBegin,
BaseIterator  baseEnd,
ShapeIterator  shapeBegin,
Marray< T > &  out 
)

Load a hyperslab from an HDF5 dataset into an Marray.

Parameters
groupHandleHandle of the parent HDF5 file or group.
datasetNameName of the HDF5 dataset.
baseBeginIterator to the beginning of the sequence that determines the first coordinate of the hyperslab.
baseEndIterator to the end of the sequence that determines the first coordinate of the hyperslab.
shapeBeginIterator to the beginning of the sequence that determines the shape of the hyperslab.
outMarray.

This function sets the out.coordinateOrder() to FirstMajorOrder!

See Also
saveHyperslab(), create()

Definition at line 317 of file marray-hdf5.hxx.

template<class T >
void andres::hdf5::loadShape ( const hid_t &  groupHandle,
const std::string &  datasetName,
std::vector< T > &  out 
)

Load the shape of an HDF5 dataset.

Parameters
groupHandleHandle of the parent HDF5 file or group.
datasetNameName of the HDF5 dataset.
outShape.
See Also
load()

Definition at line 266 of file marray-hdf5.hxx.

hid_t andres::hdf5::openFile ( const std::string &  filename,
FileAccessMode  fileAccessMode = READ_ONLY,
HDF5Version  hdf5version = HDF5_VERSION_DEFAULT 
)
inline

Open an HDF5 file.

Parameters
filenameName of the file.
fileAccessModeFile access mode.
hdf5versionHDF5 version tag.
Returns
HDF5 handle
See Also
closeFile(), createFile()

Definition at line 149 of file hdf5.hxx.

hid_t andres::hdf5::openGroup ( const hid_t &  parentHandle,
const std::string &  groupName 
)
inline

Open an HDF5 group.

Parameters
parentHandleHDF5 handle on the parent group or file.
groupNameName of the group.
Returns
HDF5 handle on the opened group.
See Also
createGroup(), closeGroup()

Definition at line 215 of file hdf5.hxx.

template<class T >
void andres::hdf5::save ( const hid_t &  groupHandle,
const std::string &  datasetName,
const Marray< T > &  in 
)

Save an Marray as an HDF5 dataset.

Parameters
groupHandleHandle of the parent HDF5 file or group.
datasetNameName of the HDF5 dataset.
inMarray.
See Also
saveHyperslab()

Definition at line 101 of file marray-hdf5.hxx.

template<class T , bool isConst>
void andres::hdf5::save ( const hid_t &  groupHandle,
const std::string &  datasetName,
const View< T, isConst > &  in 
)
inline

Save a View as an HDF5 dataset.

Parameters
groupHandleHandle of the parent HDF5 file or group.
datasetNameName of the HDF5 dataset.
inView.
See Also
saveHyperslab()

Definition at line 156 of file marray-hdf5.hxx.

template<class T >
void andres::hdf5::save ( const hid_t  parentHandle,
const std::string  datasetName,
const std::vector< T > &  data 
)
inline

Save an std::vector to an HDF5 dataset.

Definition at line 243 of file hdf5.hxx.

template<class T , class BaseIterator , class ShapeIterator >
void andres::hdf5::saveHyperslab ( const hid_t &  groupHandle,
const std::string &  datasetName,
BaseIterator  baseBegin,
BaseIterator  baseEnd,
ShapeIterator  shapeBegin,
const Marray< T > &  in 
)

Save an Marray as a hyperslab into an HDF5 dataset.

Parameters
groupHandleHandle of the parent HDF5 file or group.
datasetNameName of the HDF5 dataset.
baseBeginIterator to the beginning of the sequence that determines the first coordinate of the hyperslab.
baseEndIterator to the end of the sequence that determines the first coordinate of the hyperslab.
shapeBeginIterator to the beginning of the sequence that determines the shape of the hyperslab.
inMarray.
See Also
loadHyperslab(), create()

Definition at line 404 of file marray-hdf5.hxx.

template<class T >
hid_t andres::hdf5::uintTypeHelper ( )
inline

Definition at line 38 of file hdf5.hxx.

Variable Documentation

const std::string andres::hdf5::errorMessageLastMajorOrder = "Consider copying to an Marray in FirstMajorOrder or a one-dimensional Marray"

Definition at line 13 of file marray-hdf5.hxx.