casa
5.7.0-16
|
A class representing an HDF5 data type. More...
#include <HDF5DataType.h>
Public Member Functions | |
HDF5DataType () | |
The default constructor makes an invalid object. More... | |
HDF5DataType (const Bool *) | |
Create an HDF5 datatype object for the given fixed length type. More... | |
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. More... | |
HDF5DataType (Int, Int) | |
Create an HDF5 datatype object for an empty array. More... | |
HDF5DataType (const std::vector< String > &names, const std::vector< HDF5DataType > &types) | |
Define a compound data type consisting of the given fields and types. More... | |
HDF5DataType (const HDF5DataType &, const IPosition &shape) | |
Create an array of the given data type. More... | |
HDF5DataType (const HDF5DataType &that) | |
The copy constructor makes a deep copy. More... | |
~HDF5DataType () | |
The destructor closes the HDF5 data type object. More... | |
HDF5DataType & | operator= (const HDF5DataType &that) |
Assignment makes a deep copy. More... | |
hid_t | getHidMem () const |
Get the HID for the data type in memory. More... | |
hid_t | getHidFile () const |
Get the HID for the data type in the file. More... | |
uInt | size () const |
Get the size in bytes of the data type (in memory). More... | |
Static Public Member Functions | |
static DataType | getDataType (hid_t) |
Get the Casacore data type for the given HDF5 data type. More... | |
static Bool | isComplex (hid_t dtid) |
Test if the data type is Complex or DComplex. More... | |
static Bool | isEmptyArray (hid_t dtid) |
Test if the data type is an empty array. More... | |
static IPosition | getShape (hid_t dtid) |
Get the shape of an array data type. More... | |
static Block< hsize_t > | fromShape (const IPosition &shape) |
Helper functions to convert shapes. More... | |
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. More... | |
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 86 of file HDF5DataType.h.
|
inline |
The default constructor makes an invalid object.
It is needed to make a vector of objects.
Definition at line 91 of file HDF5DataType.h.
|
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.
|
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.
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.
casacore::HDF5DataType::HDF5DataType | ( | const HDF5DataType & | that | ) |
The copy constructor makes a deep copy.
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.
Helper functions to convert shapes.
It reverses the axes, because HDF5 uses C-order.
|
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 153 of file HDF5DataType.h.
References itsHidFile.
|
inline |
Get the HID for the data type in memory.
Definition at line 149 of file HDF5DataType.h.
References itsHidMem.
Get the shape of an array data type.
It returns an empty IPosition for non-arrays.
Test if the data type is Complex or DComplex.
Test if the data type is an empty array.
HDF5DataType& casacore::HDF5DataType::operator= | ( | const HDF5DataType & | that | ) |
Assignment makes a deep copy.
|
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 158 of file HDF5DataType.h.
References itsSize.
|
private |
Definition at line 187 of file HDF5DataType.h.
Referenced by getHidFile().
|
private |
Definition at line 186 of file HDF5DataType.h.
Referenced by getHidMem().
|
private |
Definition at line 188 of file HDF5DataType.h.
Referenced by size().