|
casacore
|
#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 |
A class representing an HDF5 data type.
Internal
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'.
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.
|
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=().
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
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.
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.
| 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.
| 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().
| casacore::HDF5DataType::HDF5DataType | ( | const HDF5DataType & | that | ) |
The copy constructor makes a deep copy.
References HDF5DataType().
| casacore::HDF5DataType::~HDF5DataType | ( | ) |
The destructor closes the HDF5 data type object.
|
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().
Helper functions to convert shapes.
It reverses the axes, because HDF5 uses C-order.
References casacore::shape().
|
static |
Get the Casacore data type for the given HDF5 data type.
TpRecord is returned for a compound data type.
|
inline |
Get the HID for the data type in the file.
Definition at line 151 of file HDF5DataType.h.
References itsHidFile.
|
inline |
Get the HID for the data type in memory.
Definition at line 147 of file HDF5DataType.h.
References itsHidMem.
|
static |
Get the shape of an array data type.
It returns an empty IPosition for non-arrays.
|
static |
Test if the data type is Complex or DComplex.
|
static |
Test if the data type is an empty array.
| HDF5DataType & casacore::HDF5DataType::operator= | ( | const HDF5DataType & | that | ) |
Assignment makes a deep copy.
References HDF5DataType().
|
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.
|
private |
Definition at line 185 of file HDF5DataType.h.
Referenced by getHidFile().
|
private |
Definition at line 184 of file HDF5DataType.h.
Referenced by getHidMem().
|
private |
Definition at line 186 of file HDF5DataType.h.
Referenced by HDF5DataType(), and size().