API
MagAOX::utils::H5Handle< T > Class Template Reference

A somewhat smart HDF5 handle. More...

#include <H5Utils.hpp>

Collaboration diagram for MagAOX::utils::H5Handle< T >:
Collaboration graph

Public Member Functions

 H5Handle ()
 
 H5Handle (const H5Handle &)=delete
 
H5Handleoperator= (const H5Handle &)=delete
 
hid_t & operator= (const hid_t &hand)
 Assignment from a basic hdf5 handle. More...
 
 operator hid_t ()
 Conversion operator. More...
 
herr_t close ()
 Close the handle. More...
 
 ~H5Handle ()
 Destructor. Calls the close function. More...
 

Protected Attributes

hid_t _hand {0}
 The underlying handle. More...
 

Detailed Description

template<class T>
class MagAOX::utils::H5Handle< T >

A somewhat smart HDF5 handle.

Makes sure that the associated hdf5 library resources are closed when out of scope. Does not do reference counting, so copy and assignment are deleted. Assignment operator from hid_t is the only way to set the handle, and the hid_t conversion operator allows this to be passed directly to hdf5 library functions.

Note
You must never call the raw hdf5 close function (e.g. H5Fclose) on one of these handles.
Template Parameters
Tis one of the handle types.

Definition at line 69 of file H5Utils.hpp.

Constructor & Destructor Documentation

◆ H5Handle() [1/2]

template<class T >
MagAOX::utils::H5Handle< T >::H5Handle ( )
inline

Definition at line 76 of file H5Utils.hpp.

◆ H5Handle() [2/2]

template<class T >
MagAOX::utils::H5Handle< T >::H5Handle ( const H5Handle< T > &  )
delete

◆ ~H5Handle()

template<class T >
MagAOX::utils::H5Handle< T >::~H5Handle ( )
inline

Destructor. Calls the close function.

Definition at line 119 of file H5Utils.hpp.

Member Function Documentation

◆ close()

template<class T >
herr_t MagAOX::utils::H5Handle< T >::close ( )
inline

Close the handle.

Calls the close function of the handle type T

Returns
the herr_t code from the hdf5 close function

Definition at line 107 of file H5Utils.hpp.

Referenced by MagAOX::utils::H5Handle< T >::~H5Handle(), and MagAOX::utils::H5Handle< T >::operator=().

◆ operator hid_t()

template<class T >
MagAOX::utils::H5Handle< T >::operator hid_t ( )
inline

Conversion operator.

Definition at line 99 of file H5Utils.hpp.

◆ operator=() [1/2]

template<class T >
H5Handle& MagAOX::utils::H5Handle< T >::operator= ( const H5Handle< T > &  )
delete

◆ operator=() [2/2]

template<class T >
hid_t& MagAOX::utils::H5Handle< T >::operator= ( const hid_t &  hand)
inline

Assignment from a basic hdf5 handle.

Note that if the handle has already been assigned, then it is closed first.

Returns
a reference to the handle
Parameters
[in]handthe basic handle

Definition at line 89 of file H5Utils.hpp.

Member Data Documentation

◆ _hand

template<class T >
hid_t MagAOX::utils::H5Handle< T >::_hand {0}
protected

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