DUECA/DUSIME
Loading...
Searching...
No Matches
Functions
HDF5Templates.hxx File Reference

Template functions and classes to extract HDF5-relevant information about different data types. More...

Include dependency graph for HDF5Templates.hxx:

Functions

template<typename T >
const H5::DataType * dueca::get_hdf5_type (const T &t)
 Return the HDF5 datatype.
 
template<typename T >
const H5::DataType * dueca::get_hdf5_type (T &t)
 Return the HDF5 datatype.
 
template<>
const H5::DataType * dueca::get_hdf5_type (const double &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (const float &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (const int32_t &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (const uint32_t &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (const int64_t &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (const uint64_t &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (const int16_t &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (const uint16_t &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (const unsigned char &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (const char &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (const bool &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (const std::string &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (const dueca::smartstring &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (double &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (float &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (int32_t &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (uint32_t &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (int64_t &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (uint64_t &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (int16_t &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (uint16_t &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (unsigned char &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (char &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (bool &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (std::string &t)
 Specialization for known type.
 
template<>
const H5::DataType * dueca::get_hdf5_type (dueca::smartstring &t)
 Specialization for known type.
 
template<typename T >
const H5::DataType * dueca::get_hdf5_type ()
 Variant without arguments, but with typename as template parameter.
 
template<>
const H5::DataType * dueca::get_hdf5_type< double > ()
 Variant without arguments, but with typename as template parameter.
 
template<>
const H5::DataType * dueca::get_hdf5_type< float > ()
 Variant without arguments, but with typename as template parameter.
 
template<>
const H5::DataType * dueca::get_hdf5_type< int32_t > ()
 Variant without arguments, but with typename as template parameter.
 
template<>
const H5::DataType * dueca::get_hdf5_type< uint32_t > ()
 Variant without arguments, but with typename as template parameter.
 
template<>
const H5::DataType * dueca::get_hdf5_type< int64_t > ()
 Variant without arguments, but with typename as template parameter.
 
template<>
const H5::DataType * dueca::get_hdf5_type< uint64_t > ()
 Variant without arguments, but with typename as template parameter.
 
template<>
const H5::DataType * dueca::get_hdf5_type< int16_t > ()
 Variant without arguments, but with typename as template parameter.
 
template<>
const H5::DataType * dueca::get_hdf5_type< uint16_t > ()
 Variant without arguments, but with typename as template parameter.
 
template<>
const H5::DataType * dueca::get_hdf5_type< unsigned char > ()
 Variant without arguments, but with typename as template parameter.
 
template<>
const H5::DataType * dueca::get_hdf5_type< char > ()
 Variant without arguments, but with typename as template parameter.
 
template<>
const H5::DataType * dueca::get_hdf5_type< bool > ()
 Variant without arguments, but with typename as template parameter.
 
template<>
const H5::DataType * dueca::get_hdf5_type< std::string > ()
 Variant without arguments, but with typename as template parameter.
 
template<>
const H5::DataType * dueca::get_hdf5_type< float > ()
 Variant without arguments, but with typename as template parameter.
 
template<>
const H5::DataType * dueca::get_hdf5_type< dueca::Dstring< 8 > > ()
 Variant without arguments, but with typename as template parameter.
 
template<>
const H5::DataType * dueca::get_hdf5_type< dueca::Dstring< 16 > > ()
 Variant without arguments, but with typename as template parameter.
 
template<>
const H5::DataType * dueca::get_hdf5_type< dueca::Dstring< 32 > > ()
 Variant without arguments, but with typename as template parameter.
 
template<>
const H5::DataType * dueca::get_hdf5_type< dueca::Dstring< 40 > > ()
 Variant without arguments, but with typename as template parameter.
 
template<>
const H5::DataType * dueca::get_hdf5_type< dueca::Dstring< 64 > > ()
 Variant without arguments, but with typename as template parameter.
 
template<>
const H5::DataType * dueca::get_hdf5_type< dueca::Dstring< 128 > > ()
 Variant without arguments, but with typename as template parameter.
 
template<>
const H5::DataType * dueca::get_hdf5_type< dueca::Dstring< 256 > > ()
 Variant without arguments, but with typename as template parameter.
 
template<>
const H5::DataType * dueca::get_hdf5_type< dueca::Dstring< 236 > > ()
 Variant without arguments, but with typename as template parameter.
 
template<>
const H5::DataType * dueca::get_hdf5_type< dueca::smartstring > ()
 Variant without arguments, but with typename as template parameter.
 
template<unsigned N>
const H5::DataType * dueca::get_hdf5_type (const Dstring< N > &t)
 Last template, for a fixed-length string.
 
template<unsigned N>
const H5::DataType * dueca::get_hdf5_type (Dstring< N > &t)
 Last template, for a fixed-length string.
 
template<size_t N, typename T >
const H5::DataType * dueca::get_hdf5_type (const dueca::fixvector< N, T > &t)
 HDF5 type for common container.
 
template<size_t N, typename T >
const H5::DataType * dueca::get_hdf5_type (dueca::fixvector< N, T > &t)
 HDF5 type for common container.
 
template<size_t N, typename T , int DEFLT, unsigned BASE>
const H5::DataType * dueca::get_hdf5_type (const dueca::fixvector_withdefault< N, T, DEFLT, BASE > &t)
 HDF5 type for common container.
 
template<size_t N, typename T , int DEFLT, unsigned BASE>
const H5::DataType * dueca::get_hdf5_type (dueca::fixvector_withdefault< N, T, DEFLT, BASE > &t)
 HDF5 type for common container.
 
template<typename T >
const H5::DataType * dueca::get_hdf5_type (const dueca::varvector< T > &t)
 HDF5 type for common container.
 
template<typename T >
const H5::DataType * dueca::get_hdf5_type (dueca::varvector< T > &t)
 HDF5 type for common container.
 
template<size_t N, typename T >
const H5::DataType * dueca::get_hdf5_type (const dueca::limvector< N, T > &t)
 HDF5 type for common container.
 
template<size_t N, typename T >
const H5::DataType * dueca::get_hdf5_type (dueca::limvector< N, T > &t)
 HDF5 type for common container.
 
template<class T >
const H5::DataType * dueca::get_hdf5_elt_type (const T &)
 elt_type and elt_length variants are used in non-nested packing; DCO members are packed as arrays.
 
template<class T >
const H5::DataType * dueca::get_hdf5_elt_type (T &o)
 generic element type
 
template<size_t N, class D >
const H5::DataType * dueca::get_hdf5_elt_type (const dueca::fixvector< N, D > &d)
 for fixed-length vector, becomes 2d dataset
 
template<size_t N, class D >
const H5::DataType * dueca::get_hdf5_elt_type (dueca::fixvector< N, D > &d)
 for fixed-length vector, becomes 2d dataset
 
template<size_t N, class D , int DEFLT, unsigned BASE>
const H5::DataType * dueca::get_hdf5_elt_type (const dueca::fixvector_withdefault< N, D, DEFLT, BASE > &d)
 for fixed-length vector, becomes 2d dataset
 
template<size_t N, class D , int DEFLT, unsigned BASE>
const H5::DataType * dueca::get_hdf5_elt_type (dueca::fixvector_withdefault< N, D, DEFLT, BASE > &d)
 for fixed-length vector, becomes 2d dataset
 
template<typename K , typename T >
const H5::DataType * dueca::get_hdf5_type (const std::map< K, T > &d)
 Ignore std::map if trying to write it nested.
 
template<typename K , typename T >
const H5::DataType * dueca::get_hdf5_type (std::map< K, T > &d)
 Ignore std::map if trying to write it nested.
 
const H5::DataType * dueca::get_hdf5_elt_type (const std::string &d)
 An element, it must be writeable.
 
const H5::DataType * dueca::get_hdf5_elt_type (std::string &d)
 An element, it must be writeable.
 
const H5::DataType * dueca::get_hdf5_elt_type (const smartstring &d)
 as element, it must be writeable
 
const H5::DataType * dueca::get_hdf5_elt_type (smartstring &d)
 as element, it must be writeable
 
template<typename K , typename T >
const H5::DataType * dueca::get_hdf5_elt_type (const std::map< K, T > &d)
 std::map works as member, written as extensible array with key,val pairs.
 
template<typename K , typename T >
const H5::DataType * dueca::get_hdf5_elt_type (std::map< K, T > &d)
 std::map works as member, written as extensible array with key,val pairs.
 
template<size_t N, class D >
const hsize_t dueca::get_hdf5_elt_length (const dueca::fixvector< N, D > &d)
 Return the length of a fixed-size vector.
 
template<size_t N, class D , int DEFLT, unsigned BASE>
const hsize_t dueca::get_hdf5_elt_length (const dueca::fixvector_withdefault< N, D, DEFLT, BASE > &d)
 Return the length of a fixed-size vector.
 
template<class T >
const hsize_t dueca::get_hdf5_elt_length (const T &)
 Return the length of any other element.
 
template<typename Alloc , template< typename, typename > class V>
const H5::DataType * dueca::get_hdf5_elt_type (const V< std::string, Alloc > &t)
 stl-type iterable with std::string
 
template<typename Alloc , template< typename, typename > class V>
const H5::DataType * dueca::get_hdf5_elt_type (V< std::string, Alloc > &t)
 stl-type iterable with std::string
 
template<typename Alloc , typename D , template< typename, typename > class V>
const H5::DataType * dueca::get_hdf5_elt_type (const V< D, Alloc > &t)
 stl-type iterable with other stuff
 
template<typename Alloc , typename D , template< typename, typename > class V>
const H5::DataType * dueca::get_hdf5_elt_type (V< D, Alloc > &t)
 stl-type iterable with other stuff
 

Detailed Description

Template functions and classes to extract HDF5-relevant information about different data types.

Function Documentation

◆ get_hdf5_type() [1/5]

template<typename T >
const H5::DataType * dueca::get_hdf5_type ( const T & t)

Return the HDF5 datatype.

Generic datatype as very last, works for DCO objects.

  • known standard types (see below) are given by template specialization versions
  • DCO types are given by the generic case, assumption of a member function getHdf5DataType; this member is only possible if the DCO type is limited to members that do not use dynamic memory, with the exception of varvector. In that case the DCO type can be nested (possibly in containers) in other DCO types.
  • Enumerated types generated with DCO code generation
  • all these types must be directly accessible through the memory in a stuct-like compound. This means it will fail for containers like std::vector, std::map, std::list, will fail for string. DUECA's varvector, limvector, fixvector have been made to comply, and dueca's fixed-length strings are seen as c-style strings, and therefore also compatible.
  • can fail to compile for a DCO type, in that case do not take the option hdf5nest but hfd5

◆ get_hdf5_type() [2/5]

template<typename T >
const H5::DataType * dueca::get_hdf5_type ( T & t)

Return the HDF5 datatype.

Generic datatype as very last, works for DCO objects.

◆ get_hdf5_type() [3/5]

template<>
const H5::DataType * dueca::get_hdf5_type ( const dueca::smartstring & t)

Specialization for known type.

when directly lifted from struct, std::string does not work

◆ get_hdf5_type() [4/5]

template<>
const H5::DataType * dueca::get_hdf5_type ( dueca::smartstring & t)

Specialization for known type.

when directly lifted from struct, std::string does not work

◆ get_hdf5_type() [5/5]

template<typename T >
const H5::DataType * dueca::get_hdf5_type ( )

Variant without arguments, but with typename as template parameter.

HDF5 type for properly defined wrappable DCO objects.

◆ get_hdf5_elt_type() [1/3]

template<class T >
const H5::DataType * dueca::get_hdf5_elt_type ( const T & o)

elt_type and elt_length variants are used in non-nested packing; DCO members are packed as arrays.

generic element type

This gives more possibilities, and std::list, std::vector can also be stored.

If get_hdf5_elt_type returns 0, the object can not be stored as such, and is ignored when writing members of a DCO object

Caveat: There are many options and combinations possible, and before relying on storing variable-length lists with variable-length objects, please check the resulting logging and the computation times needed.

◆ get_hdf5_elt_type() [2/3]

template<typename K , typename T >
const H5::DataType * dueca::get_hdf5_elt_type ( const std::map< K, T > & d)

std::map works as member, written as extensible array with key,val pairs.

These must be convertible in one go

◆ get_hdf5_elt_type() [3/3]

template<typename K , typename T >
const H5::DataType * dueca::get_hdf5_elt_type ( std::map< K, T > & d)

std::map works as member, written as extensible array with key,val pairs.

These must be convertible in one go