casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
casa::HDF5DataSet Class Reference

A class representing an HDF5 data set. More...

#include <HDF5DataSet.h>

Inheritance diagram for casa::HDF5DataSet:
casa::HDF5Object

List of all members.

Public Member Functions

 HDF5DataSet (const HDF5Object &, const String &, const IPosition &shape, const IPosition &tileShape, const Bool *)
 Create an HDF5 data set in the given hid (file or group).
 HDF5DataSet (const HDF5Object &, const String &, const IPosition &shape, const IPosition &tileShape, const Int *)
 HDF5DataSet (const HDF5Object &, const String &, const IPosition &shape, const IPosition &tileShape, const Int64 *)
 HDF5DataSet (const HDF5Object &, const String &, const IPosition &shape, const IPosition &tileShape, const Float *)
 HDF5DataSet (const HDF5Object &, const String &, const IPosition &shape, const IPosition &tileShape, const Double *)
 HDF5DataSet (const HDF5Object &, const String &, const IPosition &shape, const IPosition &tileShape, const Complex *)
 HDF5DataSet (const HDF5Object &, const String &, const IPosition &shape, const IPosition &tileShape, const DComplex *)
 HDF5DataSet (const HDF5Object &, const String &, const Bool *)
 Open an existing HDF5 data set in the given hid (file or group).
 HDF5DataSet (const HDF5Object &, const String &, const Int *)
 HDF5DataSet (const HDF5Object &, const String &, const Int64 *)
 HDF5DataSet (const HDF5Object &, const String &, const Float *)
 HDF5DataSet (const HDF5Object &, const String &, const Double *)
 HDF5DataSet (const HDF5Object &, const String &, const Complex *)
 HDF5DataSet (const HDF5Object &, const String &, const DComplex *)
 ~HDF5DataSet ()
 The destructor closes the HDF5 dataset object.
virtual void close ()
 Close the hid if valid.
void setCacheSize (uInt nchunks)
 Set the cache size (in chunks) for the data set.
const IPositionshape () const
 Get the shape.
const IPositiontileShape () const
 Get the tile (chunk) shape.
void get (const Slicer &, void *buf)
 Get a section of data.
void put (const Slicer &, const void *buf)
 Put a section of data.

Static Public Member Functions

static DataType getDataType (hid_t, const String &name)
 Get the data type for the data set with the given name.
static Block< hsize_tfromShape (const IPosition &shape)
 Helper functions to convert shapes.
static IPosition toShape (const Block< hsize_t > &b)

Private Member Functions

 HDF5DataSet (const HDF5DataSet &that)
 
     

HDF5DataSetoperator= (const HDF5DataSet &that)
 Assignment cannot be used.
void create (const HDF5Object &, const String &, const IPosition &shape, const IPosition &tileShape)
 Create the data set.
void open (const HDF5Object &, const String &)
 Open the data set and check if the external data type matches.
void closeDataSet ()
 Close the dataset (but not other hids).

Private Attributes

HDF5HidDataSpace itsDSid
HDF5HidProperty itsPLid
HDF5HidProperty itsDaplid
IPosition itsShape
IPosition itsTileShape
HDF5DataType itsDataType
const HDF5ObjectitsParent

Detailed Description

A class representing an HDF5 data set.

Intended use:

Public interface

Review Status

Test programs:
tHDF5DataSet

Prerequisite

Synopsis

This class wraps the HDF5 functions to create and open a data set. It is meant to be used in class HDF5Array, but can be used in itself as well. Only a limited number of data types are supported. They are: boolean (stored as chars), 4-byte integer, and single and double precision real and complex.
The data set has a fixed shape, thus cannot be extended nor resized. It can be stored in a tiled (chunked) way by specifying the tile shape when creating it.
It is possible to read or write a section of the data set by using an appropriate Slicer object. Note that the Slicer object must be fully filled; it does not infer missing info from the array shape.

AIPS++ arrays are in Fortran order, while HDF5 uses C order. Therefore array axes are reversed, thus axes in shapes, slicers, etc.

Motivation

It was overkill to use the HDF5 C++ interface. Instead little wrappers have been written. HDF5DataSet can be embedded in a shared pointer making it possible to share an HDF5 data set amongst various HDF5Array objects and close (i.e. destruct) the HDF5 data set object when needed.

Definition at line 84 of file HDF5DataSet.h.


Constructor & Destructor Documentation

casa::HDF5DataSet::HDF5DataSet ( const HDF5Object ,
const String ,
const IPosition shape,
const IPosition tileShape,
const Bool  
)

Create an HDF5 data set in the given hid (file or group).

It gets the given name, shape (also tile shape), and data type.

casa::HDF5DataSet::HDF5DataSet ( const HDF5Object ,
const String ,
const IPosition shape,
const IPosition tileShape,
const Int  
)
casa::HDF5DataSet::HDF5DataSet ( const HDF5Object ,
const String ,
const IPosition shape,
const IPosition tileShape,
const Int64  
)
casa::HDF5DataSet::HDF5DataSet ( const HDF5Object ,
const String ,
const IPosition shape,
const IPosition tileShape,
const Float  
)
casa::HDF5DataSet::HDF5DataSet ( const HDF5Object ,
const String ,
const IPosition shape,
const IPosition tileShape,
const Double  
)
casa::HDF5DataSet::HDF5DataSet ( const HDF5Object ,
const String ,
const IPosition shape,
const IPosition tileShape,
const Complex *   
)
casa::HDF5DataSet::HDF5DataSet ( const HDF5Object ,
const String ,
const IPosition shape,
const IPosition tileShape,
const DComplex *   
)
casa::HDF5DataSet::HDF5DataSet ( const HDF5Object ,
const String ,
const Bool  
)

Open an existing HDF5 data set in the given hid (file or group).

It checks if the internal type matches the given type.

casa::HDF5DataSet::HDF5DataSet ( const HDF5Object ,
const String ,
const Int  
)
casa::HDF5DataSet::HDF5DataSet ( const HDF5Object ,
const String ,
const Int64  
)
casa::HDF5DataSet::HDF5DataSet ( const HDF5Object ,
const String ,
const Float  
)
casa::HDF5DataSet::HDF5DataSet ( const HDF5Object ,
const String ,
const Double  
)
casa::HDF5DataSet::HDF5DataSet ( const HDF5Object ,
const String ,
const Complex *   
)
casa::HDF5DataSet::HDF5DataSet ( const HDF5Object ,
const String ,
const DComplex *   
)

The destructor closes the HDF5 dataset object.

casa::HDF5DataSet::HDF5DataSet ( const HDF5DataSet that) [private]

     

Copy constructor cannot be used.


Member Function Documentation

virtual void casa::HDF5DataSet::close ( ) [virtual]

Close the hid if valid.

Implements casa::HDF5Object.

void casa::HDF5DataSet::closeDataSet ( ) [private]

Close the dataset (but not other hids).

void casa::HDF5DataSet::create ( const HDF5Object ,
const String ,
const IPosition shape,
const IPosition tileShape 
) [private]

Create the data set.

static Block<hsize_t> casa::HDF5DataSet::fromShape ( const IPosition shape) [static]

Helper functions to convert shapes.

It reverses the axes, because HDF5 uses C-order.

void casa::HDF5DataSet::get ( const Slicer ,
void *  buf 
)

Get a section of data.

The buffer must be large enough to hold the section.

static DataType casa::HDF5DataSet::getDataType ( hid_t  ,
const String name 
) [static]

Get the data type for the data set with the given name.

void casa::HDF5DataSet::open ( const HDF5Object ,
const String  
) [private]

Open the data set and check if the external data type matches.

HDF5DataSet& casa::HDF5DataSet::operator= ( const HDF5DataSet that) [private]

Assignment cannot be used.

void casa::HDF5DataSet::put ( const Slicer ,
const void *  buf 
)

Put a section of data.

Set the cache size (in chunks) for the data set.

It needs to close and reopen the DataSet to take effect.

const IPosition& casa::HDF5DataSet::shape ( ) const [inline]

Get the shape.

Definition at line 132 of file HDF5DataSet.h.

References itsShape.

const IPosition& casa::HDF5DataSet::tileShape ( ) const [inline]

Get the tile (chunk) shape.

Definition at line 136 of file HDF5DataSet.h.

References itsTileShape.

static IPosition casa::HDF5DataSet::toShape ( const Block< hsize_t > &  b) [static]

Member Data Documentation

Definition at line 171 of file HDF5DataSet.h.

Definition at line 174 of file HDF5DataSet.h.

Definition at line 169 of file HDF5DataSet.h.

Definition at line 175 of file HDF5DataSet.h.

Definition at line 170 of file HDF5DataSet.h.

Definition at line 172 of file HDF5DataSet.h.

Referenced by shape().

Definition at line 173 of file HDF5DataSet.h.

Referenced by tileShape().


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