Hdf5FileResource Class Reference

This is a Resource class that opens and closes HDF5 files. More...

#include <Hdf5Resource.h>

Inheritance diagram for Hdf5FileResource:

Inheritance graph

List of all members.

Public Member Functions

 Hdf5FileResource (const std::string &filename, unsigned flags=H5F_ACC_RDONLY, hid_t access=H5P_DEFAULT)
 Hdf5FileResource (hid_t file)
 Hdf5FileResource ()
 operator hid_t * ()


Detailed Description

This is a Resource class that opens and closes HDF5 files.

This is a Resource class that opens and closes HDF5 files. It has a conversion operator to allow a Hdf5FileResource object to be used where ever a hid_t that represents an open HDF5 File Handle may be used.

Example of Usage:

  Hdf5FileResource pFile("c:/data/a.h5"); // open for read-only access
  Hdf5FileResource pFile2("c:/data/b.h5", H5F_ACC_CREAT | H5F_ACC_RDWR); // create and open for read/write
  Hdf5FileResource pFile3("c:/data/c.h5", H5F_ACC_RDWR); // open for read/write access

Definition at line 148 of file Hdf5Resource.h.


Constructor & Destructor Documentation

Hdf5FileResource::Hdf5FileResource ( const std::string &  filename,
unsigned  flags = H5F_ACC_RDONLY,
hid_t  access = H5P_DEFAULT 
)

Constructs a Resource object that wraps a hid_t HDF5 File Handle.

Opens the specified file using the specified access modes. The two arguments will ultimately be passed unmodified to H5Fopen.

Parameters:
filename The name of the file to open.
flags The access mode to open the file with. These match the modes used with H5Fopen.
access How to open the file. Most users will never need to provide this option. See the HDF5 documentation for details.

Definition at line 167 of file Hdf5Resource.h.

Hdf5FileResource::Hdf5FileResource ( hid_t  file  ) 

Constructs a Resource object that wraps a hid_t HDF5 File Handle.

This will take ownership of an existing hid_t file handle and will ensure that it is closed.

Parameters:
file The HDF5 file handle.

Definition at line 181 of file Hdf5Resource.h.

Hdf5FileResource::Hdf5FileResource (  ) 

Default constructor.

Definition at line 189 of file Hdf5Resource.h.


Member Function Documentation

Hdf5FileResource::operator hid_t * (  ) 

Returns a pointer to the underlying hid_t returned by H5Fopen.

Returns a pointer to the underlying hid_t. This operator, used in conjunction with the dereferencing operator, allows the Hdf5FileResource object to be used where ever a hid_t would normally be used.

Returns:
A pointer to the underlying hid_t returned by H5Fopen.

Definition at line 204 of file Hdf5Resource.h.


Software Development Kit - Opticks 4.9.0 Build 16218