Loading...
Searching...
No Matches
casacore::HDF5DataSet Class Reference
casa package (libcasa_casa) » HDF5_module

More...

`#include <HDF5DataSet.h>`

## 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 uChar *)
| HDF5DataSet (const HDF5Object &, const String &, const IPosition &shape, const IPosition &tileShape, const Short *)
| 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 IPosition &shape, const IPosition &tileShape, const HDF5DataType &)
| 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 uChar *)
| HDF5DataSet (const HDF5Object &, const String &, const Short *)
| 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 (const HDF5Object &, const String &, const HDF5DataType &)
virtual | ~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 IPosition & | shape () const
| Get the shape.
const IPosition & | tileShape () const
| Get the tile (chunk) shape.
void | get (const Slicer &, ArrayBase &buf, Bool resize=False)
| Get a section of data into the array.
void | get (const Slicer &, void *buf)
| Get a section of data.
void | put (const Slicer &, const ArrayBase &buf)
| Put a section of data.
void | put (const Slicer &, const void *buf)
| Put a section of data.
void | extend (const IPosition &shape)
| Extend the dataset if an axis in the new shape is larger.
Public Member Functions inherited from casacore::HDF5Object
| HDF5Object ()
| Default constructor sets to invalid hid.
virtual | ~HDF5Object ()
| The destructor in a derived class should close the hid appropriately.
| HDF5Object (const HDF5Object &)=delete
| Copy constructor cannot be used because a HID cannot be copied.
HDF5Object & | operator= (const HDF5Object &)=delete
| Assignment cannot be used because a HID cannot be copied.
bool | isValid () const
| Is it a valid hid?
hid_t | getHid () const
| Get the hid.
| operator hid_t () const
| Convert automatically to hid_t.
void | setName (const String &name)
| Get or set the name.
const String & | getName () const

## 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 Public Member Functions inherited from casacore::HDF5Object
static Bool | hasHDF5Support ()
| Check if there is HDF5 support compiled in.
static void | throwNoHDF5 ()
| If no HDF5, throw an exception that HDF5 is not supported.

## Protected Member Functions

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).
Protected Member Functions inherited from casacore::HDF5Object
void | setHid (hid_t hid)
| Set the hid.
void | clearHid ()
| Clear the hid (set to invalid).

## Private Member Functions

| HDF5DataSet (const HDF5DataSet &that)
| Copy constructor cannot be used.
HDF5DataSet & | operator= (const HDF5DataSet &that)
| Assignment cannot be used.

## Private Attributes

HDF5HidDataSpace | itsDSid
HDF5HidProperty | itsPLid
HDF5HidProperty | itsDaplid
IPosition | itsShape
IPosition | itsTileShape
HDF5DataType | itsDataType
const HDF5Object * | itsParent

## Detailed Description

A class representing an HDF5 data set.

### Intended use:

Public interface

### Review Status

Test programs:
  tHDF5DataSet

### Prerequisite

- HDF5 system

### Synopsis

This class wraps the HDF5 functions to create and open a data set. It is meant to be used in class HDF5Lattice, but can be used in itself as well. A dataset of any HDF5DataType (including compound types) can be created. For a limited number of data types special constructors exist which create the appropriate HDF5DataType themselves.
A data set can be created extendible by defining the appropriate axis with length 0, whereafter the extend function can be used to extend the data set. The data can be stored in a tiled (chunked) way by specifying the tile shape when creating it.
When opening an existing data set, it is checked if the given data type matches the data set's data type. For a compound data type, it only checks if its size matches; it does not check if the fields match.
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.

Note that Casacore 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 HDF5Lattice objects and close (i.e. destruct) the HDF5 data set object when needed.

Definition at line 90 of file HDF5DataSet.h.

## Constructor & Destructor Documentation

## HDF5DataSet() [1/21]

casacore::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.

References casacore::HDF5Object::HDF5Object(), shape(), and tileShape().

Referenced by HDF5DataSet(), and operator=().

## HDF5DataSet() [2/21]

casacore::HDF5DataSet::HDF5DataSet | ( | const HDF5Object & | ,
|  | const String & | ,
|  | const IPosition & | shape,
|  | const IPosition & | tileShape,
|  | const uChar * | )

References casacore::HDF5Object::HDF5Object(), shape(), and tileShape().

## HDF5DataSet() [3/21]

casacore::HDF5DataSet::HDF5DataSet | ( | const HDF5Object & | ,
|  | const String & | ,
|  | const IPosition & | shape,
|  | const IPosition & | tileShape,
|  | const Short * | )

References casacore::HDF5Object::HDF5Object(), shape(), and tileShape().

## HDF5DataSet() [4/21]

casacore::HDF5DataSet::HDF5DataSet | ( | const HDF5Object & | ,
|  | const String & | ,
|  | const IPosition & | shape,
|  | const IPosition & | tileShape,
|  | const Int * | )

References casacore::HDF5Object::HDF5Object(), shape(), and tileShape().

## HDF5DataSet() [5/21]

casacore::HDF5DataSet::HDF5DataSet | ( | const HDF5Object & | ,
|  | const String & | ,
|  | const IPosition & | shape,
|  | const IPosition & | tileShape,
|  | const Int64 * | )

References casacore::HDF5Object::HDF5Object(), shape(), and tileShape().

## HDF5DataSet() [6/21]

casacore::HDF5DataSet::HDF5DataSet | ( | const HDF5Object & | ,
|  | const String & | ,
|  | const IPosition & | shape,
|  | const IPosition & | tileShape,
|  | const Float * | )

References casacore::HDF5Object::HDF5Object(), shape(), and tileShape().

## HDF5DataSet() [7/21]

casacore::HDF5DataSet::HDF5DataSet | ( | const HDF5Object & | ,
|  | const String & | ,
|  | const IPosition & | shape,
|  | const IPosition & | tileShape,
|  | const Double * | )

References casacore::HDF5Object::HDF5Object(), shape(), and tileShape().

## HDF5DataSet() [8/21]

casacore::HDF5DataSet::HDF5DataSet | ( | const HDF5Object & | ,
|  | const String & | ,
|  | const IPosition & | shape,
|  | const IPosition & | tileShape,
|  | const Complex * | )

References casacore::HDF5Object::HDF5Object(), shape(), and tileShape().

## HDF5DataSet() [9/21]

casacore::HDF5DataSet::HDF5DataSet | ( | const HDF5Object & | ,
|  | const String & | ,
|  | const IPosition & | shape,
|  | const IPosition & | tileShape,
|  | const DComplex * | )

References casacore::HDF5Object::HDF5Object(), shape(), and tileShape().

## HDF5DataSet() [10/21]

casacore::HDF5DataSet::HDF5DataSet | ( | const HDF5Object & | ,
|  | const String & | ,
|  | const IPosition & | shape,
|  | const IPosition & | tileShape,
|  | const HDF5DataType & | )

References casacore::HDF5Object::HDF5Object(), shape(), and tileShape().

## HDF5DataSet() [11/21]

casacore::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.

References casacore::HDF5Object::HDF5Object().

## HDF5DataSet() [12/21]

casacore::HDF5DataSet::HDF5DataSet | ( | const HDF5Object & | ,
|  | const String & | ,
|  | const uChar * | )

References casacore::HDF5Object::HDF5Object().

## HDF5DataSet() [13/21]

casacore::HDF5DataSet::HDF5DataSet | ( | const HDF5Object & | ,
|  | const String & | ,
|  | const Short * | )

References casacore::HDF5Object::HDF5Object().

## HDF5DataSet() [14/21]

casacore::HDF5DataSet::HDF5DataSet | ( | const HDF5Object & | ,
|  | const String & | ,
|  | const Int * | )

References casacore::HDF5Object::HDF5Object().

## HDF5DataSet() [15/21]

casacore::HDF5DataSet::HDF5DataSet | ( | const HDF5Object & | ,
|  | const String & | ,
|  | const Int64 * | )

References casacore::HDF5Object::HDF5Object().

## HDF5DataSet() [16/21]

casacore::HDF5DataSet::HDF5DataSet | ( | const HDF5Object & | ,
|  | const String & | ,
|  | const Float * | )

References casacore::HDF5Object::HDF5Object().

## HDF5DataSet() [17/21]

casacore::HDF5DataSet::HDF5DataSet | ( | const HDF5Object & | ,
|  | const String & | ,
|  | const Double * | )

References casacore::HDF5Object::HDF5Object().

## HDF5DataSet() [18/21]

casacore::HDF5DataSet::HDF5DataSet | ( | const HDF5Object & | ,
|  | const String & | ,
|  | const Complex * | )

References casacore::HDF5Object::HDF5Object().

## HDF5DataSet() [19/21]

casacore::HDF5DataSet::HDF5DataSet | ( | const HDF5Object & | ,
|  | const String & | ,
|  | const DComplex * | )

References casacore::HDF5Object::HDF5Object().

## HDF5DataSet() [20/21]

casacore::HDF5DataSet::HDF5DataSet | ( | const HDF5Object & | ,
|  | const String & | ,
|  | const HDF5DataType & | )

References casacore::HDF5Object::HDF5Object().

## ~HDF5DataSet()

virtual casacore::HDF5DataSet::~HDF5DataSet | ( |  | ) |

virtual

The destructor closes the HDF5 dataset object.

## HDF5DataSet() [21/21]

casacore::HDF5DataSet::HDF5DataSet | ( | const HDF5DataSet & | that | ) |

private

Copy constructor cannot be used.

References HDF5DataSet().

## Member Function Documentation

## close()

virtual void casacore::HDF5DataSet::close | ( |  | ) |

virtual

Close the hid if valid.

Implements casacore::HDF5Object.

## closeDataSet()

void casacore::HDF5DataSet::closeDataSet | ( |  | ) |

protected

Close the dataset (but not other hids).

## create()

void casacore::HDF5DataSet::create | ( | const HDF5Object & | ,
|  | const String & | ,
|  | const IPosition & | shape,
|  | const IPosition & | tileShape )

protected

Create the data set.

References casacore::HDF5Object::HDF5Object(), shape(), and tileShape().

## extend()

void casacore::HDF5DataSet::extend | ( | const IPosition & | shape | ) |

Extend the dataset if an axis in the new shape is larger.

References shape().

## get() [1/2]

void casacore::HDF5DataSet::get | ( | const Slicer & | ,
|  | ArrayBase & | buf,
|  | Bool | resize = False )

Get a section of data into the array.

The array is resized if its shape does not match the slicer's shape. This is only possible if the array is empty or if resize=True. It is not checked if the data type of array and HDF5DataSet match.

References casacore::False.

## get() [2/2]

void casacore::HDF5DataSet::get | ( | const Slicer & | ,
|  | void * | buf )

Get a section of data.

The buffer must be large enough to hold the section.

## getDataType()

DataType casacore::HDF5DataSet::getDataType | ( | hid_t | ,
|  | const String & | name )

static

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

References casacore::name().

## open()

void casacore::HDF5DataSet::open | ( | const HDF5Object & | ,
|  | const String & | )

protected

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

References casacore::HDF5Object::HDF5Object().

## operator=()

HDF5DataSet & casacore::HDF5DataSet::operator= | ( | const HDF5DataSet & | that | ) |

private

Assignment cannot be used.

References HDF5DataSet().

## put() [1/2]

void casacore::HDF5DataSet::put | ( | const Slicer & | ,
|  | const ArrayBase & | buf )

Put a section of data.

The shape of the array and slicer must match. It is not checked if the data type of array and HDF5DataSet match.

## put() [2/2]

void casacore::HDF5DataSet::put | ( | const Slicer & | ,
|  | const void * | buf )

Put a section of data.

The buffer must be large enough to hold the section.

## setCacheSize()

void casacore::HDF5DataSet::setCacheSize | ( | uInt | nchunks | ) |

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

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

## shape()

const IPosition & casacore::HDF5DataSet::shape | ( |  | ) | const

inline

Get the shape.

Definition at line 147 of file HDF5DataSet.h.

References itsShape.

Referenced by create(), extend(), HDF5DataSet(), HDF5DataSet(), HDF5DataSet(), HDF5DataSet(), HDF5DataSet(), HDF5DataSet(), HDF5DataSet(), HDF5DataSet(), HDF5DataSet(), and HDF5DataSet().

## tileShape()

const IPosition & casacore::HDF5DataSet::tileShape | ( |  | ) | const

inline

Get the tile (chunk) shape.

Definition at line 151 of file HDF5DataSet.h.

References itsTileShape.

Referenced by create(), HDF5DataSet(), HDF5DataSet(), HDF5DataSet(), HDF5DataSet(), HDF5DataSet(), HDF5DataSet(), HDF5DataSet(), HDF5DataSet(), HDF5DataSet(), and HDF5DataSet().

## Member Data Documentation

## itsDaplid

HDF5HidProperty casacore::HDF5DataSet::itsDaplid

private

Definition at line 195 of file HDF5DataSet.h.

## itsDataType

HDF5DataType casacore::HDF5DataSet::itsDataType

private

Definition at line 198 of file HDF5DataSet.h.

## itsDSid

HDF5HidDataSpace casacore::HDF5DataSet::itsDSid

private

Definition at line 193 of file HDF5DataSet.h.

## itsParent

const HDF5Object* casacore::HDF5DataSet::itsParent

private

Definition at line 199 of file HDF5DataSet.h.

## itsPLid

HDF5HidProperty casacore::HDF5DataSet::itsPLid

private

Definition at line 194 of file HDF5DataSet.h.

## itsShape

IPosition casacore::HDF5DataSet::itsShape

private

Definition at line 196 of file HDF5DataSet.h.

Referenced by shape().

## itsTileShape

IPosition casacore::HDF5DataSet::itsTileShape

private

Definition at line 197 of file HDF5DataSet.h.

Referenced by tileShape().

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

- casa/HDF5/HDF5DataSet.h