Statismo  0.10.1
 All Classes Namespaces Functions Typedefs
Public Member Functions | Static Public Member Functions | List of all members
statismo::HDF5Utils Class Reference

Utility methods to read and store common types to a HDF5 File. More...

#include <HDF5Utils.h>

Public Member Functions

template<>
void readMatrixOfType (const H5::CommonFG &fg, const char *name, GenericEigenType< unsigned int >::MatrixType &matrix)
 
template<>
void readMatrixOfType (const H5::CommonFG &fg, const char *name, GenericEigenType< float >::MatrixType &matrix)
 
template<>
void readMatrixOfType (const H5::CommonFG &fg, const char *name, GenericEigenType< double >::MatrixType &matrix)
 
template<>
H5::DataSet writeMatrixOfType (const H5::CommonFG &fg, const char *name, const GenericEigenType< unsigned int >::MatrixType &matrix)
 
template<>
H5::DataSet writeMatrixOfType (const H5::CommonFG &fg, const char *name, const GenericEigenType< float >::MatrixType &matrix)
 
template<>
H5::DataSet writeMatrixOfType (const H5::CommonFG &fg, const char *name, const GenericEigenType< double >::MatrixType &matrix)
 
template<>
void readVectorOfType (const H5::CommonFG &fg, const char *name, GenericEigenType< double >::VectorType &vector)
 
template<>
void readVectorOfType (const H5::CommonFG &fg, const char *name, GenericEigenType< float >::VectorType &vector)
 
template<>
void readVectorOfType (const H5::CommonFG &fg, const char *name, GenericEigenType< int >::VectorType &vector)
 
template<>
H5::DataSet writeVectorOfType (const H5::CommonFG &fg, const char *name, const GenericEigenType< double >::VectorType &vector)
 
template<>
H5::DataSet writeVectorOfType (const H5::CommonFG &fg, const char *name, const GenericEigenType< float >::VectorType &vector)
 
template<>
H5::DataSet writeVectorOfType (const H5::CommonFG &fg, const char *name, const GenericEigenType< int >::VectorType &vector)
 
template<>
void readArray (const H5::CommonFG &fg, const char *name, std::vector< int > &array)
 
template<>
H5::DataSet writeArray (const H5::CommonFG &fg, const char *name, std::vector< int > const &array)
 

Static Public Member Functions

static H5::H5File openOrCreateFile (const std::string filename)
 
static H5::Group openPath (H5::H5File &fg, const std::string &path, bool createPath=false)
 
static void readMatrix (const H5::CommonFG &fg, const char *name, MatrixType &matrix)
 
static void readMatrix (const H5::CommonFG &fg, const char *name, unsigned nCols, MatrixType &matrix)
 
template<class T >
static void readMatrixOfType (const H5::CommonFG &fg, const char *name, typename GenericEigenType< T >::MatrixType &matrix)
 
static H5::DataSet writeMatrix (const H5::CommonFG &fg, const char *name, const MatrixType &matrix)
 
template<class T >
static H5::DataSet writeMatrixOfType (const H5::CommonFG &fg, const char *name, const typename GenericEigenType< T >::MatrixType &matrix)
 
static void readVector (const H5::CommonFG &fg, const char *name, unsigned nElements, VectorType &vector)
 
static void readVector (const H5::CommonFG &fg, const char *name, VectorType &vector)
 
template<class T >
static void readVectorOfType (const H5::CommonFG &fg, const char *name, typename GenericEigenType< T >::VectorType &vector)
 
static H5::DataSet writeVector (const H5::CommonFG &fg, const char *name, const VectorType &vector)
 
template<class T >
static H5::DataSet writeVectorOfType (const H5::CommonFG &fg, const char *name, const typename GenericEigenType< T >::VectorType &vector)
 
static void dumpFileToHDF5 (const char *filename, const H5::CommonFG &fg, const char *name)
 
static void getFileFromHDF5 (const H5::CommonFG &fg, const char *name, const char *filename)
 
static H5::DataSet writeString (const H5::CommonFG &fg, const char *name, const std::string &s)
 
static std::string readString (const H5::CommonFG &fg, const char *name)
 
static void writeStringAttribute (const H5::H5Object &group, const char *name, const std::string &s)
 
static void writeIntAttribute (const H5::H5Object &fg, const char *name, int value)
 
static std::string readStringAttribute (const H5::H5Object &group, const char *name)
 
static int readIntAttribute (const H5::H5Object &group, const char *name)
 
static int readInt (const H5::CommonFG &fg, const char *name)
 
static H5::DataSet writeInt (const H5::CommonFG &fg, const char *name, int value)
 
static float readFloat (const H5::CommonFG &fg, const char *name)
 
static H5::DataSet writeFloat (const H5::CommonFG &fg, const char *name, float value)
 
template<typename T >
static void readArray (const H5::CommonFG &fg, const char *name, std::vector< T > &array)
 
template<typename T >
static H5::DataSet writeArray (const H5::CommonFG &fg, const char *name, std::vector< T > const &array)
 
static bool existsObjectWithName (const H5::CommonFG &fg, const std::string &name)
 

Detailed Description

Utility methods to read and store common types to a HDF5 File.

Member Function Documentation

void statismo::HDF5Utils::dumpFileToHDF5 ( const char *  filename,
const H5::CommonFG &  fg,
const char *  name 
)
inlinestatic

Reads a file (in binary mode) and saves it as a byte array in the hdf5 file.

Parameters
filenameThe filename of the file to be stored
fgThe hdf5 group
nameThe name of the entry
bool statismo::HDF5Utils::existsObjectWithName ( const H5::CommonFG &  fg,
const std::string &  name 
)
inlinestatic

Check whether an object (direct child) of fg with the given name exists

void statismo::HDF5Utils::getFileFromHDF5 ( const H5::CommonFG &  fg,
const char *  name,
const char *  filename 
)
inlinestatic

Reads an entry from an HDF5 byte array and writes it to a file

Parameters
fgThe hdf5 group
namethe name of the entry
filenameThe filename where the data from the HDF5 file is stored.
H5::H5File statismo::HDF5Utils::openOrCreateFile ( const std::string  filename)
inlinestatic

Opens the hdf5 file with the given name, or creates it if the file does not exist

H5::Group statismo::HDF5Utils::openPath ( H5::H5File &  fg,
const std::string &  path,
bool  createPath = false 
)
inlinestatic

Opens the hdf5 group or creates it if it doesn't exist.

Parameters
afile object
pathAn absolute path that defines a group
createPathif true, creates the path if it does not exist
Returns
the group object representing the path in the hdf5 file
template<typename T >
void statismo::HDF5Utils::readArray ( const H5::CommonFG &  fg,
const char *  name,
std::vector< T > &  array 
)
inlinestatic

Reads an array from the hdf5 group

Parameters
fgThe hdf5 group
nameThe name
arrayThe array (type std::vector<T>) to be read, contents will be lost
float statismo::HDF5Utils::readFloat ( const H5::CommonFG &  fg,
const char *  name 
)
inlinestatic

Reads an dobule from the hdf5 file

Parameters
fgThe hdf5 group
nameThe name
Returns
the read number
int statismo::HDF5Utils::readInt ( const H5::CommonFG &  fg,
const char *  name 
)
inlinestatic

Reads an integer from the hdf5 file

Parameters
fgThe hdf5 group
nameThe name
Returns
the integeter
int statismo::HDF5Utils::readIntAttribute ( const H5::H5Object &  group,
const char *  name 
)
inlinestatic

Reads a int attribute from the given group

Parameters
groupthe hdf5 group
namethe name of the entry in the group
Returns
the value
void statismo::HDF5Utils::readMatrix ( const H5::CommonFG &  fg,
const char *  name,
MatrixType &  matrix 
)
inlinestatic

Read a Matrix from a HDF5 File

Parameters
fgThe group
namethe name of the entry
theoutput matrix
void statismo::HDF5Utils::readMatrix ( const H5::CommonFG &  fg,
const char *  name,
unsigned  nCols,
MatrixType &  matrix 
)
inlinestatic

Read a submatrix from the file, with the given number of Columns

Parameters
fgThe group
namethe name of the entry
nColsthe number of columns to be read
theoutput matrix
template<class T >
void statismo::HDF5Utils::readMatrixOfType ( const H5::CommonFG &  fg,
const char *  name,
typename GenericEigenType< T >::MatrixType &  matrix 
)
inlinestatic

Read a Matrix of a given type from a HDF5 File

Parameters
fgThe group
namethe name of the entry
theoutput matrix
std::string statismo::HDF5Utils::readString ( const H5::CommonFG &  fg,
const char *  name 
)
inlinestatic

Reads a string from the given group

Parameters
groupthe hdf5 group
namethe name of the entry in the group
Returns
the string
std::string statismo::HDF5Utils::readStringAttribute ( const H5::H5Object &  group,
const char *  name 
)
inlinestatic

Reads a string attribute from the given group

Parameters
groupthe hdf5 group
namethe name of the entry in the group
Returns
the value
void statismo::HDF5Utils::readVector ( const H5::CommonFG &  fg,
const char *  name,
unsigned  nElements,
VectorType &  vector 
)
inlinestatic

Read a Vector from a HDF5 File with the given number of elements

Parameters
fgThe group
namethe name of the entry
numElementsThe number of elements to be read from the file
theoutput vector
void statismo::HDF5Utils::readVector ( const H5::CommonFG &  fg,
const char *  name,
VectorType &  vector 
)
inlinestatic

Read a Vector from a HDF5 File

Parameters
fgThe group
namethe name of the entry
numElementsThe number of elements to be read from the file
theoutput vector
template<typename T >
H5::DataSet statismo::HDF5Utils::writeArray ( const H5::CommonFG &  fg,
const char *  name,
std::vector< T > const &  array 
)
inlinestatic

Writes an array to the hdf5 group

Parameters
fgThe hdf5 group
nameThe name
arrayThe array (type std::vector<T>) to be written
H5::DataSet statismo::HDF5Utils::writeFloat ( const H5::CommonFG &  fg,
const char *  name,
float  value 
)
inlinestatic

Writes an double to the hdf5 file

Parameters
fgThe hdf5 group
nameThe name
valueThe value to be written
H5::DataSet statismo::HDF5Utils::writeInt ( const H5::CommonFG &  fg,
const char *  name,
int  value 
)
inlinestatic

Writes an integer to the hdf5 file

Parameters
fgThe hdf5 group
nameThe name
valueThe value to be written
void statismo::HDF5Utils::writeIntAttribute ( const H5::H5Object &  fg,
const char *  name,
int  value 
)
inlinestatic

Writes an int attribute for the given group

Parameters
fgThe hdf5 group
nameThe name of the entry in the group
valuethe int value to be written
H5::DataSet statismo::HDF5Utils::writeMatrix ( const H5::CommonFG &  fg,
const char *  name,
const MatrixType &  matrix 
)
inlinestatic

Write a Matrix to the HDF5 File

Parameters
fgThe group
namethe name of the entry
thematrix to be written
template<class T >
H5::DataSet statismo::HDF5Utils::writeMatrixOfType ( const H5::CommonFG &  fg,
const char *  name,
const typename GenericEigenType< T >::MatrixType &  matrix 
)
inlinestatic

Write a Matrix of the given type to the HDF5 File

Parameters
fgThe group
namethe name of the entry
thematrix to be written
H5::DataSet statismo::HDF5Utils::writeString ( const H5::CommonFG &  fg,
const char *  name,
const std::string &  s 
)
inlinestatic

Writes a string to the hdf5 file

Parameters
fgThe hdf5 group
nameThe name of the entry in the group
sThe string to be written
void statismo::HDF5Utils::writeStringAttribute ( const H5::H5Object &  group,
const char *  name,
const std::string &  s 
)
inlinestatic

Writes a string attribute for the given group

Parameters
fgThe hdf5 group
nameThe name of the entry in the group
sThe string to be written
H5::DataSet statismo::HDF5Utils::writeVector ( const H5::CommonFG &  fg,
const char *  name,
const VectorType &  vector 
)
inlinestatic

Write a vector to the HDF5 File

Parameters
fgThe hdf5 group
namethe name of the entry
thevector to be written

The documentation for this class was generated from the following files: