MGIS
Loading...
Searching...
No Matches
HDF5Support.hxx File Reference
#include <span>
#include <string>
#include <vector>
#include <H5Cpp.h>
#include "MGIS/Config.hxx"
#include "MGIS/Context.hxx"
#include "MGIS/Utilities/HDF5Forward.hxx"

Namespaces

namespace  mgis
 the namespace mgis encloses all the MGIS project.
 

Functions

template<typename T >
H5::PredType mgis::utilities::hdf5::getNativeType () noexcept
 
template<>
MGIS_EXPORT H5::PredType mgis::utilities::hdf5::getNativeType< float > () noexcept
 
template<>
MGIS_EXPORT H5::PredType mgis::utilities::hdf5::getNativeType< double > () noexcept
 
template<>
MGIS_EXPORT H5::PredType mgis::utilities::hdf5::getNativeType< long double > () noexcept
 
MGIS_EXPORT bool mgis::utilities::hdf5::exists (const H5::Group &, const std::string &) noexcept
 check if an object with the given path exists in the given group
 
MGIS_EXPORT bool mgis::utilities::hdf5::subGroupExists (const H5::Group &, const std::string &) noexcept
 check if a group with the given path exists in the given given
 
MGIS_EXPORT std::optional< H5::Group > mgis::utilities::hdf5::createGroup (Context &, const H5::Group &, const std::string &) noexcept
 create a new group
 
MGIS_EXPORT std::optional< H5::Group > mgis::utilities::hdf5::openGroup (Context &, const H5::Group &, const std::string &) noexcept
 open a new group
 
MGIS_EXPORT std::optional< H5::DataSet > mgis::utilities::hdf5::openDataSet (Context &ctx, const H5::Group &, const std::string &) noexcept
 open a data set
 
MGIS_EXPORT bool mgis::utilities::hdf5::removeDataSet (Context &, const H5::Group &, const std::string &) noexcept
 remove a data set
 
MGIS_EXPORT std::optional< std::vector< std::string > > mgis::utilities::hdf5::getSubGroupNames (Context &, const H5::Group &, const bool) noexcept
 
MGIS_EXPORT bool mgis::utilities::hdf5::getSubGroupNames (Context &, std::vector< std::string > &, const H5::Group &, const bool) noexcept
 
MGIS_EXPORT std::optional< std::vector< std::string > > mgis::utilities::hdf5::getDataSetNames (Context &, const H5::Group &) noexcept
 
MGIS_EXPORT std::optional< bool > mgis::utilities::hdf5::contains (Context &, const H5::Group &, const std::string &) noexcept
 
MGIS_EXPORT bool mgis::utilities::hdf5::unlinkIfExists (Context &, const H5::Group &, const std::string &) noexcept
 delete an existing group or dataset if it exists
 
MGIS_EXPORT bool mgis::utilities::hdf5::write (Context &, H5::Group &, const std::string &, const real &, const bool) noexcept
 
MGIS_EXPORT bool mgis::utilities::hdf5::read (Context &, real &, const H5::Group &, const std::string &) noexcept
 
MGIS_EXPORT bool mgis::utilities::hdf5::write (Context &, H5::Group &, const std::string &, std::span< const real >, const bool) noexcept
 
MGIS_EXPORT bool mgis::utilities::hdf5::read (Context &, std::vector< real > &, const H5::Group &, const std::string &) noexcept
 
MGIS_EXPORT bool mgis::utilities::hdf5::read (Context &, std::span< real >, const H5::Group &, const std::string &) noexcept
 
MGIS_EXPORT InvalidResult mgis::utilities::hdf5::registerH5ExceptionInErrorBacktrace (ErrorBacktrace &) noexcept
 a custom Lippincott-like function that extract error messages from a standard exception or an exception generated by the HD5 library
 
MGIS_EXPORT InvalidResult mgis::utilities::hdf5::registerH5ExceptionInErrorBacktraceWithoutSourceLocation (ErrorBacktrace &) noexcept
 a custom Lippincott-like function that extract error messages from a standard exception or an exception generated by the HD5 library
 

Detailed Description

Author
Thomas Helfer
Date
29/01/2026

Function Documentation

◆ contains()

MGIS_EXPORT std::optional< bool > mgis::utilities::hdf5::contains ( Context ,
const H5::Group &  ,
const std::string &   
)
noexcept
Returns
true if the given group contains an object with the given name
Parameters
[in,out]ctxexecution context
[in]ggroup
[in]nname

◆ createGroup()

MGIS_EXPORT std::optional< H5::Group > mgis::utilities::hdf5::createGroup ( Context ,
const H5::Group &  ,
const std::string &   
)
noexcept

create a new group

Parameters
[in,out]ctxexecution context
[in]gparent group
[in]ngroup name

◆ exists()

MGIS_EXPORT bool mgis::utilities::hdf5::exists ( const H5::Group &  ,
const std::string &   
)
noexcept

check if an object with the given path exists in the given group

Parameters
[in]ggroup
[in]ppath

◆ getDataSetNames()

MGIS_EXPORT std::optional< std::vector< std::string > > mgis::utilities::hdf5::getDataSetNames ( Context ,
const H5::Group &   
)
noexcept
Returns
all the dataset names in a give group
Parameters
[in,out]ctxexecution context
[in]ggroup

◆ getSubGroupNames() [1/2]

MGIS_EXPORT std::optional< std::vector< std::string > > mgis::utilities::hdf5::getSubGroupNames ( Context ,
const H5::Group &  ,
const bool   
)
noexcept
Parameters
[in]ggroup
[in]bboolean allowing other objects than groups to be inside the given group

◆ getSubGroupNames() [2/2]

MGIS_EXPORT bool mgis::utilities::hdf5::getSubGroupNames ( Context ,
std::vector< std::string > &  ,
const H5::Group &  ,
const bool   
)
noexcept
Parameters
[in,out]ctxexecution context
[out]nnames
[in]ggroup
[in]bboolean allowing other objects than groups to be inside the given group

◆ openDataSet()

MGIS_EXPORT std::optional< H5::DataSet > mgis::utilities::hdf5::openDataSet ( Context ctx,
const H5::Group &  ,
const std::string &   
)
noexcept

open a data set

Parameters
[in,out]ctxexecution context
[in]gparent group
[in]ndata set name

◆ openGroup()

MGIS_EXPORT std::optional< H5::Group > mgis::utilities::hdf5::openGroup ( Context ,
const H5::Group &  ,
const std::string &   
)
noexcept

open a new group

Parameters
[in,out]ctxexecution context
[in]gparent group
[in]ngroup name

◆ read() [1/3]

MGIS_EXPORT bool mgis::utilities::hdf5::read ( Context ,
real ,
const H5::Group &  ,
const std::string &   
)
noexcept
Parameters
[in,out]ctxexecution context
[out]o: object to be written
g: HDF5 group
n: name of the dataset

◆ read() [2/3]

MGIS_EXPORT bool mgis::utilities::hdf5::read ( Context ,
std::span< real ,
const H5::Group &  ,
const std::string &   
)
noexcept
Parameters
[in,out]ctxexecution context
[out]o: object to be read
g: HDF5 group
n: name of the dataset

◆ read() [3/3]

MGIS_EXPORT bool mgis::utilities::hdf5::read ( Context ,
std::vector< real > &  ,
const H5::Group &  ,
const std::string &   
)
noexcept
Parameters
[in,out]ctxexecution context
[out]o: object to be read
g: HDF5 group
n: name of the dataset

◆ registerH5ExceptionInErrorBacktrace()

MGIS_EXPORT InvalidResult mgis::utilities::hdf5::registerH5ExceptionInErrorBacktrace ( ErrorBacktrace )
noexcept

a custom Lippincott-like function that extract error messages from a standard exception or an exception generated by the HD5 library

Parameters
[out]eerror back trace handler
[in]ldescription of the call site

◆ registerH5ExceptionInErrorBacktraceWithoutSourceLocation()

MGIS_EXPORT InvalidResult mgis::utilities::hdf5::registerH5ExceptionInErrorBacktraceWithoutSourceLocation ( ErrorBacktrace )
noexcept

a custom Lippincott-like function that extract error messages from a standard exception or an exception generated by the HD5 library

Parameters
[out]eerror back trace handler

◆ removeDataSet()

MGIS_EXPORT bool mgis::utilities::hdf5::removeDataSet ( Context ,
const H5::Group &  ,
const std::string &   
)
noexcept

remove a data set

Parameters
[in,out]ctxexecution context
[in]gparent group
[in]ndata set name

◆ subGroupExists()

MGIS_EXPORT bool mgis::utilities::hdf5::subGroupExists ( const H5::Group &  ,
const std::string &   
)
noexcept

check if a group with the given path exists in the given given

Parameters
[in]ggroup
[in]ppath

◆ unlinkIfExists()

MGIS_EXPORT bool mgis::utilities::hdf5::unlinkIfExists ( Context ,
const H5::Group &  ,
const std::string &   
)
noexcept

delete an existing group or dataset if it exists

Parameters
[in,out]ctxexecution context
[in]gparent group
[in]ngroup or dataset name

◆ write() [1/2]

MGIS_EXPORT bool mgis::utilities::hdf5::write ( Context ,
H5::Group &  ,
const std::string &  ,
const real ,
const bool   
)
noexcept
Parameters
[in,out]ctxexecution context
g: HDF5 group
n: name of the dataset
o: object to be written
[in]ballow overwrite

◆ write() [2/2]

MGIS_EXPORT bool mgis::utilities::hdf5::write ( Context ,
H5::Group &  ,
const std::string &  ,
std::span< const real ,
const bool   
)
noexcept
Parameters
[in,out]ctxexecution context
g: HDF5 group
n: name of the dataset
o: object to be written
[in]ballow overwrite