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

More...

`#include <HDF5DataType.h>`

## Public Member Functions

| HDF5DataType ()
| The default constructor makes an invalid object.
| HDF5DataType (const Bool *)
| Create an HDF5 datatype object for the given fixed length type.
| HDF5DataType (const uChar *)
| HDF5DataType (const Short *)
| HDF5DataType (const uShort *)
| HDF5DataType (const Int *)
| HDF5DataType (const uInt *)
| HDF5DataType (const Int64 *)
| HDF5DataType (const Float *)
| HDF5DataType (const Double *)
| HDF5DataType (const Complex *)
| HDF5DataType (const DComplex *)
| HDF5DataType (const String *)
| HDF5DataType (const String &value)
| Create an HDF5 datatype object for a scalar string.
| HDF5DataType (Int, Int)
| Create an HDF5 datatype object for an empty array.
| HDF5DataType (const std::vector< String > &names, const std::vector< HDF5DataType > &types)
| Define a compound data type consisting of the given fields and types.
| HDF5DataType (const HDF5DataType &, const IPosition &shape)
| Create an array of the given data type.
| HDF5DataType (const HDF5DataType &that)
| The copy constructor makes a deep copy.
| ~HDF5DataType ()
| The destructor closes the HDF5 data type object.
HDF5DataType & | operator= (const HDF5DataType &that)
| Assignment makes a deep copy.
hid_t | getHidMem () const
| Get the HID for the data type in memory.
hid_t | getHidFile () const
| Get the HID for the data type in the file.
uInt | size () const
| Get the size in bytes of the data type (in memory).

## Static Public Member Functions

static DataType | getDataType (hid_t)
| Get the Casacore data type for the given HDF5 data type.
static Bool | isComplex (hid_t dtid)
| Test if the data type is Complex or DComplex.
static Bool | isEmptyArray (hid_t dtid)
| Test if the data type is an empty array.
static IPosition | getShape (hid_t dtid)
| Get the shape of an array data type.
static Block< hsize_t > | fromShape (const IPosition &shape)
| Helper functions to convert shapes.
static IPosition | toShape (const Block< hsize_t > &b)

## Private Member Functions

void | addToCompound (const char *name, uInt offset, const HDF5DataType &dtype)
| Add a field to a compound data type.

## Private Attributes

HDF5HidDataType | itsHidMem
HDF5HidDataType | itsHidFile
uInt | itsSize

## Detailed Description

A class representing an HDF5 data type.

### Intended use:

Internal

### Review Status

Test programs:
  tHDF5DataType

### Prerequisite

- HDF5 system

### Synopsis

This class wraps the HDF5 functions to create a data type for the data in memory and for the file. The HDF5 file data type order is set to LittleEndian.
The basic constructors define a scalar of a basic data type or data type Complex and DComplex. Strings are also supported. However, it is also possible to define a fixed shaped array for any HDF5DataType. Furthermore, it is possible to define a compound data type consisting of named fields of any HDF5DataType with a fixed size. Arrays and/or compounds can be nested at will.
Variable length strings are supported, but cannot be used in compounds.
Older HDF5 versions did not support empty arrays. Therefore they are represented as a compound with 3 fields. Also they did not support boolean values; they are represented as a signed char. HDF5 does not support complex values either. They are represented as a compound with fields 're' and 'im'.

### Motivation

The HDF5 C++ interface only supports the HDF5 C functionality and resembles that to much. For instance, it does not use STL containers. It does not support non-basic data types, in particular Complex.

Definition at line 84 of file HDF5DataType.h.

## Constructor & Destructor Documentation

## HDF5DataType() [1/18]

casacore::HDF5DataType::HDF5DataType | ( |  | ) |

inline

The default constructor makes an invalid object.

It is needed to make a vector of objects.

Definition at line 89 of file HDF5DataType.h.

References itsSize.

Referenced by addToCompound(), HDF5DataType(), HDF5DataType(), and operator=().

## HDF5DataType() [2/18]

casacore::HDF5DataType::HDF5DataType | ( | const Bool * |  | ) |

explicit

Create an HDF5 datatype object for the given fixed length type.

It uses the corresponding native HDF5 data type. Only for Bool it uses a uchar, because the HDF5 bool type is a uint. For the complex types it makes a compound HDF5 data type. The String type is meant for an array of strings.

## HDF5DataType() [3/18]

casacore::HDF5DataType::HDF5DataType | ( | const uChar * |  | ) |

explicit

## HDF5DataType() [4/18]

casacore::HDF5DataType::HDF5DataType | ( | const Short * |  | ) |

explicit

## HDF5DataType() [5/18]

casacore::HDF5DataType::HDF5DataType | ( | const uShort * |  | ) |

explicit

## HDF5DataType() [6/18]

casacore::HDF5DataType::HDF5DataType | ( | const Int * |  | ) |

explicit

## HDF5DataType() [7/18]

casacore::HDF5DataType::HDF5DataType | ( | const uInt * |  | ) |

explicit

## HDF5DataType() [8/18]

casacore::HDF5DataType::HDF5DataType | ( | const Int64 * |  | ) |

explicit

## HDF5DataType() [9/18]

casacore::HDF5DataType::HDF5DataType | ( | const Float * |  | ) |

explicit

## HDF5DataType() [10/18]

casacore::HDF5DataType::HDF5DataType | ( | const Double * |  | ) |

explicit

## HDF5DataType() [11/18]

casacore::HDF5DataType::HDF5DataType | ( | const Complex * |  | ) |

explicit

## HDF5DataType() [12/18]

casacore::HDF5DataType::HDF5DataType | ( | const DComplex * |  | ) |

explicit

## HDF5DataType() [13/18]

casacore::HDF5DataType::HDF5DataType | ( | const String * |  | ) |

explicit

## HDF5DataType() [14/18]

casacore::HDF5DataType::HDF5DataType | ( | const String & | value | ) |

explicit

Create an HDF5 datatype object for a scalar string.

The length of the string is part of the type.

References casacore::NewDelAllocator< T >::value.

## HDF5DataType() [15/18]

casacore::HDF5DataType::HDF5DataType | ( | Int | ,
|  | Int | )

Create an HDF5 datatype object for an empty array.

Both arguments are dummy (needed to distinguish the constructor). An empty array as represented as a compound data type with integer field names emptyarray, rank and casatype.

## HDF5DataType() [16/18]

casacore::HDF5DataType::HDF5DataType | ( | const std::vector< String > & | names,
|  | const std::vector< HDF5DataType > & | types )

Define a compound data type consisting of the given fields and types.

An exception is thrown if the vectors are empty or have mismatching sizes.

## HDF5DataType() [17/18]

casacore::HDF5DataType::HDF5DataType | ( | const HDF5DataType & | ,
|  | const IPosition & | shape )

Create an array of the given data type.

An exception is thrown if the shape is empty.

References HDF5DataType(), and casacore::shape().

## HDF5DataType() [18/18]

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

The copy constructor makes a deep copy.

References HDF5DataType().

## ~HDF5DataType()

casacore::HDF5DataType::~HDF5DataType | ( |  | ) |

The destructor closes the HDF5 data type object.

## Member Function Documentation

## addToCompound()

void casacore::HDF5DataType::addToCompound | ( | const char * | name,
|  | uInt | offset,
|  | const HDF5DataType & | dtype )

private

Add a field to a compound data type.

It does it for the memory and file data type.

References HDF5DataType(), casacore::name(), and casacore::offset().

## fromShape()

Block< hsize_t > casacore::HDF5DataType::fromShape | ( | const IPosition & | shape | ) |

static

Helper functions to convert shapes.

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

References casacore::shape().

## getDataType()

DataType casacore::HDF5DataType::getDataType | ( | hid_t |  | ) |

static

Get the Casacore data type for the given HDF5 data type.

TpRecord is returned for a compound data type.

## getHidFile()

hid_t casacore::HDF5DataType::getHidFile | ( |  | ) | const

inline

Get the HID for the data type in the file.

Definition at line 151 of file HDF5DataType.h.

References itsHidFile.

## getHidMem()

hid_t casacore::HDF5DataType::getHidMem | ( |  | ) | const

inline

Get the HID for the data type in memory.

Definition at line 147 of file HDF5DataType.h.

References itsHidMem.

## getShape()

IPosition casacore::HDF5DataType::getShape | ( | hid_t | dtid | ) |

static

Get the shape of an array data type.

It returns an empty IPosition for non-arrays.

## isComplex()

Bool casacore::HDF5DataType::isComplex | ( | hid_t | dtid | ) |

static

Test if the data type is Complex or DComplex.

## isEmptyArray()

Bool casacore::HDF5DataType::isEmptyArray | ( | hid_t | dtid | ) |

static

Test if the data type is an empty array.

## operator=()

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

Assignment makes a deep copy.

References HDF5DataType().

## size()

uInt casacore::HDF5DataType::size | ( |  | ) | const

inline

Get the size in bytes of the data type (in memory).

Note that the size of a string is variable, thus 0.

Definition at line 156 of file HDF5DataType.h.

References itsSize.

## toShape()

IPosition casacore::HDF5DataType::toShape | ( | const Block< hsize_t > & | b | ) |

static

## Member Data Documentation

## itsHidFile

HDF5HidDataType casacore::HDF5DataType::itsHidFile

private

Definition at line 185 of file HDF5DataType.h.

Referenced by getHidFile().

## itsHidMem

HDF5HidDataType casacore::HDF5DataType::itsHidMem

private

Definition at line 184 of file HDF5DataType.h.

Referenced by getHidMem().

## itsSize

uInt casacore::HDF5DataType::itsSize

private

Definition at line 186 of file HDF5DataType.h.

Referenced by HDF5DataType(), and size().

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

- casa/HDF5/HDF5DataType.h