HighFive 2.9.0
HighFive - Header-only C++ HDF5 interface
Loading...
Searching...
No Matches
H5Easy Namespace Reference

Read/dump DataSets or Attribute using a minimalistic syntax. To this end, the functions are templated, and accept: More...

Classes

class  Compression
 Signal to set compression level for written DataSets. More...
 
class  DumpOptions
 Define options for dumping data. More...
 

Enumerations

enum class  DumpMode { Create = 0 , Overwrite = 1 }
 Write mode for DataSets. More...
 
enum class  Flush { False = 0 , True = 1 }
 Signal to enable/disable automatic flushing after write operations. More...
 

Functions

size_t getSize (const File &file, const std::string &path)
 Get the size of an existing DataSet in an open HDF5 file.
 
std::vector< size_t > getShape (const File &file, const std::string &path)
 Get the shape of an existing DataSet in an readable file.
 
template<class T >
DataSet dump (File &file, const std::string &path, const T &data, DumpMode mode=DumpMode::Create)
 Write object (templated) to a (new) DataSet in an open HDF5 file.
 
template<class T >
DataSet dump (File &file, const std::string &path, const T &data, const DumpOptions &options)
 Write object (templated) to a (new) DataSet in an open HDF5 file.
 
template<class T >
DataSet dump (File &file, const std::string &path, const T &data, const std::vector< size_t > &idx)
 Write a scalar to a (new, extendible) DataSet in an open HDF5 file.
 
template<class T >
DataSet dump (File &file, const std::string &path, const T &data, const std::initializer_list< size_t > &idx)
 Write a scalar to a (new, extendable) DataSet in an open HDF5 file.
 
template<class T >
DataSet dump (File &file, const std::string &path, const T &data, const std::vector< size_t > &idx, const DumpOptions &options)
 Write a scalar to a (new, extendible) DataSet in an open HDF5 file.
 
template<class T >
DataSet dump (File &file, const std::string &path, const T &data, const std::initializer_list< size_t > &idx, const DumpOptions &options)
 Write a scalar to a (new, extendible) DataSet in an open HDF5 file.
 
template<class T >
load (const File &file, const std::string &path, const std::vector< size_t > &idx)
 Load entry {i, j, ...} from a DataSet in an open HDF5 file to a scalar.
 
template<class T >
load (const File &file, const std::string &path)
 Load a DataSet in an open HDF5 file to an object (templated).
 
template<class T >
Attribute dumpAttribute (File &file, const std::string &path, const std::string &key, const T &data, DumpMode mode=DumpMode::Create)
 Write object (templated) to a (new) Attribute in an open HDF5 file.
 
template<class T >
Attribute dumpAttribute (File &file, const std::string &path, const std::string &key, const T &data, const DumpOptions &options)
 Write object (templated) to a (new) Attribute in an open HDF5 file.
 
template<class T >
loadAttribute (const File &file, const std::string &path, const std::string &key)
 Load a Attribute in an open HDF5 file to an object (templated).
 

Detailed Description

Read/dump DataSets or Attribute using a minimalistic syntax. To this end, the functions are templated, and accept:

  • Any type accepted by HighFive
  • Eigen objects
  • xtensor objects
  • OpenCV objects

Enumeration Type Documentation

◆ DumpMode

enum class H5Easy::DumpMode
strong

Write mode for DataSets.

Enumerator
Create 

Dump only if DataSet does not exist, otherwise throw.

Overwrite 

Create or overwrite if DataSet of correct shape exists, otherwise throw.

◆ Flush

enum class H5Easy::Flush
strong

Signal to enable/disable automatic flushing after write operations.

Enumerator
False 

No automatic flushing.

True 

Automatic flushing.

Function Documentation

◆ dump() [1/6]

template<class T >
DataSet H5Easy::dump ( File & file,
const std::string & path,
const T & data,
const DumpOptions & options )
inline

Write object (templated) to a (new) DataSet in an open HDF5 file.

Parameters
fileopened file (has to be writeable)
pathpath of the DataSet
datathe data to write (any supported type)
optionsdump options
Returns
The newly created DataSet

◆ dump() [2/6]

template<class T >
DataSet H5Easy::dump ( File & file,
const std::string & path,
const T & data,
const std::initializer_list< size_t > & idx )
inline

Write a scalar to a (new, extendable) DataSet in an open HDF5 file.

Parameters
fileopen File (has to be writeable)
pathpath of the DataSet
datathe data to write (any supported type)
idxthe indices to which to write
Returns
The newly created DataSet

◆ dump() [3/6]

template<class T >
DataSet H5Easy::dump ( File & file,
const std::string & path,
const T & data,
const std::initializer_list< size_t > & idx,
const DumpOptions & options )
inline

Write a scalar to a (new, extendible) DataSet in an open HDF5 file.

Parameters
fileopened file (has to be writeable)
pathpath of the DataSet
datathe data to write (any supported type)
idxthe indices to which to write
optionsdump options
Returns
The newly created DataSet

◆ dump() [4/6]

template<class T >
DataSet H5Easy::dump ( File & file,
const std::string & path,
const T & data,
const std::vector< size_t > & idx )
inline

Write a scalar to a (new, extendible) DataSet in an open HDF5 file.

Parameters
fileopened file (has to be writeable)
pathpath of the DataSet
datathe data to write (any supported type)
idxthe indices to which to write
Returns
The newly created DataSet

◆ dump() [5/6]

template<class T >
DataSet H5Easy::dump ( File & file,
const std::string & path,
const T & data,
const std::vector< size_t > & idx,
const DumpOptions & options )
inline

Write a scalar to a (new, extendible) DataSet in an open HDF5 file.

Parameters
fileopened file (has to be writeable)
pathpath of the DataSet
datathe data to write (any supported type)
idxthe indices to which to write
optionsdump options
Returns
The newly created DataSet

◆ dump() [6/6]

template<class T >
DataSet H5Easy::dump ( File & file,
const std::string & path,
const T & data,
DumpMode mode = DumpMode::Create )
inline

Write object (templated) to a (new) DataSet in an open HDF5 file.

Parameters
fileopened file (has to be writeable)
pathpath of the DataSet
datathe data to write (any supported type)
modewrite mode
Returns
The newly created DataSet

◆ dumpAttribute() [1/2]

template<class T >
Attribute H5Easy::dumpAttribute ( File & file,
const std::string & path,
const std::string & key,
const T & data,
const DumpOptions & options )
inline

Write object (templated) to a (new) Attribute in an open HDF5 file.

Parameters
fileopened file (has to be writeable)
pathpath of the DataSet
keyname of the attribute
datathe data to write (any supported type)
optionsdump options
Returns
The newly created DataSet

◆ dumpAttribute() [2/2]

template<class T >
Attribute H5Easy::dumpAttribute ( File & file,
const std::string & path,
const std::string & key,
const T & data,
DumpMode mode = DumpMode::Create )
inline

Write object (templated) to a (new) Attribute in an open HDF5 file.

Parameters
fileopened file (has to be writeable)
pathpath of the DataSet
keyname of the attribute
datathe data to write (any supported type)
modewrite mode
Returns
The newly created DataSet

◆ getShape()

std::vector< size_t > H5Easy::getShape ( const File & file,
const std::string & path )
inline

Get the shape of an existing DataSet in an readable file.

Parameters
fileopened file (has to be readable)
pathPath of the DataSet
Returns
the shape of the DataSet

◆ getSize()

size_t H5Easy::getSize ( const File & file,
const std::string & path )
inline

Get the size of an existing DataSet in an open HDF5 file.

Parameters
fileopened file (has to be readable)
pathpath of the DataSet
Returns
Size of the DataSet

◆ load() [1/2]

template<class T >
T H5Easy::load ( const File & file,
const std::string & path )
inline

Load a DataSet in an open HDF5 file to an object (templated).

Parameters
fileopened file (has to be writeable)
pathpath of the DataSet
Returns
The read data

◆ load() [2/2]

template<class T >
T H5Easy::load ( const File & file,
const std::string & path,
const std::vector< size_t > & idx )
inline

Load entry {i, j, ...} from a DataSet in an open HDF5 file to a scalar.

Parameters
fileopened file (has to be writeable)
idxthe indices to load
pathpath of the DataSet
Returns
The read data

◆ loadAttribute()

template<class T >
T H5Easy::loadAttribute ( const File & file,
const std::string & path,
const std::string & key )
inline

Load a Attribute in an open HDF5 file to an object (templated).

Parameters
fileopened file (has to be writeable)
pathpath of the DataSet
keyname of the attribute
Returns
The read data