libgenua
Basic Geometry, Numerical Algorithms and Interfaces
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
Public Member Functions | Static Public Member Functions | List of all members
Hdf5Group Class Reference

Detailed Description

Group in HDF5 file.

Since the HDF5 file format is hierarchical, it can store objects in a tree-like structure. A Hdf5Group is a node in that tree (and a file itself is a node as well). Nodes in a tree are referenced using the name which is passed on construction (to createGroup()), which means that no node can have more than one child of the same name. In order to map other hierarchical data that may not have the same restriction, use Hdf5Location::uniqueName() to generate node names and store the real name in a property.

See Also
Hdf5File

#include <hdf5file.h>

Inheritance diagram for Hdf5Group:
[legend]
Collaboration diagram for Hdf5Group:
[legend]

Public Member Functions

 Hdf5Group (hid_t id=-1)
 create group from id or an invalid stub
 
 Hdf5Group (Hdf5Group &&a)
 move construction, won't call destructor
 
Hdf5Groupoperator= (Hdf5Group &&a)
 move assignment
 
virtual ~Hdf5Group ()
 closes group
 
virtual void close ()
 close this group
 
Hdf5Dataset createDataset (const std::string &name, TypeCode dataType, int rank, const hsize_t *dimensions, int gzip=0)
 create a dataset attached to this group
 
Hdf5Dataset createDataset (const std::string &name, TypeCode dataType, size_t nrows, size_t ncols=1, int gzip=0)
 create a new 1D or 2D dataset attached to this group
 
Hdf5Dataset createExtensibleDataset (const std::string &name, TypeCode dataType, size_t nrows, size_t ncols=1, int gzip=0)
 create a new extensible 1D or 2D dataset attached to this group
 
template<typename ScalarType >
bool writeDataset (const std::string &name, const ScalarType *p, size_t nrows, size_t ncols=1)
 write dataset directly in one pass, then close it
 
Hdf5Dataset openDataset (const std::string &name)
 open an already existing dataset
 
Hdf5Group openGroup (const std::string &name)
 open an existing group
 
Hdf5Group createGroup (const std::string &name)
 create a group
 
Hdf5GroupArray childGroups ()
 return child groups, if any
 
- Public Member Functions inherited from Hdf5Location
 Hdf5Location (hid_t id=-1)
 create a location from id
 
 Hdf5Location (Hdf5Location &&a)
 move construction, won't call destructor
 
Hdf5Locationoperator= (Hdf5Location &&a)
 move assignment
 
hid_t id () const
 access location id
 
bool valid ()
 whether this location has been assigned
 
bool attach (const std::string &obj, const std::string &key, const std::string &val)
 attach a string attribute to object
 
bool attach (const std::string &key, const std::string &val)
 attach a string attribute to this object itself
 
bool attach (const std::string &obj, const std::string &key, const int &val)
 attach a integer attribute to object
 
bool attach (const std::string &key, const int &val)
 attach a integer attribute to this object
 
std::string attribute (const std::string &obj, const std::string &key)
 return string attribute obj.key, or empty if not found
 
template<typename ValueType >
bool attribute (const std::string &obj, const std::string &key, ValueType &val)
 retrieve attribute 'key'; returns false if not present
 

Static Public Member Functions

static Hdf5Dataset createDataset (hid_t locid, const std::string &name, TypeCode dataType, int rank, const hsize_t *dimensions, const hsize_t *maxDimensions, int gzip=0)
 create a new ND dataset attached to location id (may be group or file)
 
static Hdf5Dataset createDataset (hid_t locid, const std::string &name, TypeCode dataType, int rank, const hsize_t *dimensions, int gzip=0)
 create a new ND dataset attached to location id (may be group or file)
 
- Static Public Member Functions inherited from Hdf5Location
static std::string uniqueName ()
 return a simple unique object name
 
static size_t uniqueId ()
 return a simple unique object id
 
static void printErrorStack ()
 print current error stack to stderr
 

Additional Inherited Members

- Protected Member Functions inherited from Hdf5Location
bool getAttribute (const std::string &obj, const std::string &key, TypeCode memDataType, void *buffer)
 low-level interface for attribute query
 
- Protected Attributes inherited from Hdf5Location
hid_t m_id = -1
 identifier
 
- Static Protected Attributes inherited from Hdf5Location
static std::atomic< size_t > s_idcounter
 used to generate identifiers
 

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