h5gt 0.2.0
C++ wrapper for HDF5 library (based on HighFive project)
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
h5gt::CompoundType Class Reference

Create a compound HDF5 datatype. More...

#include <H5DataType.hpp>

Inheritance diagram for h5gt::CompoundType:
h5gt::DataType h5gt::Object

Classes

struct  member_def
 Use for defining a sub-type of compound type If your dtype contains 'std::string' then you need to explicitely set 't_offset' in bytest like 'HOFFSET(STRUCT_NAME, MEMBER_NAME)'. More...
 

Public Member Functions

 CompoundType (const CompoundType &other)=default
 
 CompoundType (const std::vector< member_def > &t_members, size_t size=0)
 Initializes a compound type from a vector of member definitions.
 
 CompoundType (std::vector< member_def > &&t_members, size_t size=0)
 
 CompoundType (const std::initializer_list< member_def > &t_members, size_t size=0)
 
void commit (const Object &object, const std::string &name) const
 Commit datatype into the given Object.
 
const std::vector< member_def > & getMembers () const noexcept
 Get read access to the CompoundType members.
 
DataTypeClass getMemberClass (const unsigned &member_no) const
 
int getMemberIndex (const std::string &field_name) const
 
std::string getMemberName (const unsigned &field_idx) const
 
size_t getMemberOffset (const unsigned &memb_no) const
 
hid_t getMemberType (const unsigned &field_idx) const
 return predefined type specified by hdf5 macro like: H5T_C_S1, H5T_NATIVE_INT, H5T_IEEE_F32BE etc.
 
int getNMembers () const
 
- Public Member Functions inherited from h5gt::DataType
virtual bool isTypeEqual (const DataType &other) const
 isTypeEqual Unlike == operator this only checks if the data types are equal and do not check if they belong It is virtual as checking compound type is something different
 
DataTypeClass getClass () const
 Return the fundamental type.
 
size_t getSize () const
 Returns the length (in bytes) of this type elements.
 
std::string string () const
 Returns a friendly description of the type (e.g. Float32)
 
bool isVariableStr () const
 Returns whether the type is a variable-length string.
 
bool isFixedLenStr () const
 Returns whether the type is a fixed-length string.
 
bool empty () const noexcept
 Check the DataType was default constructed. Such value might represent auto-detection of the datatype from a buffer.
 
bool isReference () const
 Returns whether the type is a Reference.
 
bool operator== (const DataType &other) const
 operator == Check if objects reside in the same file and equal to each other
 
bool operator!= (const DataType &other) const
 
- Public Member Functions inherited from h5gt::Object
void flush (bool globalScope=true)
 flush
 
bool isValid () const noexcept
 isValid
 
hid_t getId (const bool &increaseRefCount=false) const noexcept
 getId
 
std::string getFileName () const
 
std::string getPath () const
 return the path to the current group, dataset, datatype or attribute's holder
 
int getIdRefCount () const noexcept
 
ObjectInfo getObjectInfo () const
 Retrieve several infos about the current object (address, dates, etc)
 
ObjectType getObjectType () const
 Gets the fundamental type of the object (dataset, group, etc)
 

Static Public Member Functions

static CompoundType FromId (const hid_t &id, const bool &increaseRefCount=false)
 
- Static Public Member Functions inherited from h5gt::DataType
static DataType FromId (const hid_t &id, const bool &increaseRefCount=false)
 

Protected Member Functions

 CompoundType (const DataType &obj)
 
- Protected Member Functions inherited from h5gt::DataType
 DataType (const Object &obj)
 
 Object ()
 
 Object (const Object &other)
 
 Object (Object &&other) noexcept
 
 Object (const hid_t &)
 
 Object (const hid_t &, const ObjectType &, const bool &)
 
- Protected Member Functions inherited from h5gt::Object
 Object (const Object &other)
 
 Object (Object &&other) noexcept
 
 Object (const hid_t &)
 
 Object (const hid_t &, const ObjectType &, const bool &)
 
LinkInfo _getLinkInfo (const std::string &objPath) const
 getLinkInfo retrieve link info from an object with 'objPath'. This object must reside in the same container as current one.
 
std::string _unpackSoftLink (const std::string &objName) const
 
std::string _unpackExternalLink (const std::string &objName, std::string &fileName_out) const
 
void _unlink (const std::string &obj_name) const
 
Objectoperator= (const Object &other)
 
bool operator== (const Object &other) const
 When coparing objects h5gt::File must be open.
 

Additional Inherited Members

- Protected Attributes inherited from h5gt::Object
hid_t _hid
 

Detailed Description

Create a compound HDF5 datatype.

Constructor & Destructor Documentation

◆ CompoundType() [1/3]

h5gt::CompoundType::CompoundType ( const std::vector< member_def > & t_members,
size_t size = 0 )
inline

Initializes a compound type from a vector of member definitions.

Parameters
t_members
size'sizeof(STRUCT_NAME)' (must be set if you data contains 'std::string')

◆ CompoundType() [2/3]

h5gt::CompoundType::CompoundType ( std::vector< member_def > && t_members,
size_t size = 0 )
inline
Parameters
size'sizeof(STRUCT_NAME)' (must be set if you data contains 'std::string')

◆ CompoundType() [3/3]

h5gt::CompoundType::CompoundType ( const std::initializer_list< member_def > & t_members,
size_t size = 0 )
inline
Parameters
size'sizeof(STRUCT_NAME)' (must be set if you data contains 'std::string')

Member Function Documentation

◆ commit()

void h5gt::CompoundType::commit ( const Object & object,
const std::string & name ) const
inline

Commit datatype into the given Object.

Parameters
objectLocation to commit object into
nameName to give the datatype

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