casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Static Public Member Functions | Static Private Member Functions | List of all members
casacore::HDF5Record Class Reference

A class to write/read a record into HDF5. More...

#include <HDF5Record.h>

Static Public Member Functions

static Record readRecord (const HDF5Object &parentHid, const String &groupName)
 Read a record from the attributes of the given group. More...
 
static void writeRecord (const HDF5Object &parentHid, const String &recordName, const RecordInterface &rec)
 Write the record as attributes of a group of the given parent. More...
 
static void remove (const HDF5Object &parentHid, const String &recordName)
 Remove the record (i.e. More...
 
static Record doReadRecord (hid_t parentHid)
 Read the (possibly nested) record values from the given group hid. More...
 
static void doWriteRecord (const HDF5Object &groupHid, const RecordInterface &rec)
 Write the (possibly nested) record values into the given group hid. More...
 

Static Private Member Functions

static void readScalar (hid_t attrId, hid_t dtid, const String &name, RecordInterface &rec)
 Read a scalar value and add it to the record. More...
 
static void readArray (hid_t attrId, hid_t dtid, const IPosition &, const String &name, RecordInterface &rec)
 Read an array value and add it to the record. More...
 
static void readScaString (hid_t attrId, Int sz, const String &name, RecordInterface &rec)
 Read a scalar string from an attribute and add it to the record. More...
 
static void readArrString (hid_t attrId, const IPosition &, const String &name, RecordInterface &rec)
 Read a array of strings from an atrribute and add it to the record. More...
 
static void readEmptyArray (hid_t attrId, const String &name, RecordInterface &rec)
 Read a field containing an empty array. More...
 
template<typename T >
static void readSca (hid_t attrId, const String &name, RecordInterface &rec)
 Read a field containing a scalar of fixed length. More...
 
template<typename T >
static void readArr (hid_t attrId, const IPosition &shape, const String &name, RecordInterface &rec)
 Read a field containing an array of fixed length elements. More...
 
static void read (hid_t attrId, void *value, const HDF5DataType &dtype)
 Read fixed length values from an attribute (scalar and array). More...
 
static void writeScalar (hid_t parentHid, const String &name, const void *value, const HDF5DataType &dtype)
 Write a fixed length scalar value as attribute. More...
 
static void writeArray (hid_t parentHid, const String &name, const void *value, const IPosition &shape, const HDF5DataType &dtype)
 Write an array of fixed length values as attribute. More...
 
static void writeScaString (hid_t parentHid, const String &name, const String &value)
 Write a scalar string as attribute. More...
 
static void writeArrString (hid_t parentHid, const String &name, const Array< String > &value)
 Write an array of strings as attribute. More...
 
static void writeEmptyArray (hid_t groupHid, const String &name, Int rank, DataType dtype)
 Write a field containing an empty array. More...
 
template<typename T >
static void writeSca (hid_t parentHid, const String &name, const RecordInterface &rec, Int i)
 Write a field containing a fixed length scalar value. More...
 
template<typename T >
static void writeArr (hid_t parentHid, const String &name, const RecordInterface &rec, Int i)
 Write a field containing an array of fixed length elements. More...
 

Detailed Description

A class to write/read a record into HDF5.

Intended use:

Public interface

Review Status

Test programs:
tHDF5Record

Prerequisite

Synopsis

This class has a static function to write a Record (or TableRecord) into an HDF5 file by storing it as attributes for the given group. Another static function can read back the Record. It can handle all types of fields in a record.
A few remarks:

Motivation

Record is a very important class in Casacore images, so it has to be possible to read and write them from/to HDF5.

Definition at line 77 of file HDF5Record.h.

Member Function Documentation

static Record casacore::HDF5Record::doReadRecord ( hid_t  parentHid)
static

Read the (possibly nested) record values from the given group hid.

static void casacore::HDF5Record::doWriteRecord ( const HDF5Object groupHid,
const RecordInterface rec 
)
static

Write the (possibly nested) record values into the given group hid.

static void casacore::HDF5Record::read ( hid_t  attrId,
void *  value,
const HDF5DataType dtype 
)
staticprivate

Read fixed length values from an attribute (scalar and array).

Referenced by readArr(), and readSca().

template<typename T >
static void casacore::HDF5Record::readArr ( hid_t  attrId,
const IPosition shape,
const String name,
RecordInterface rec 
)
inlinestaticprivate

Read a field containing an array of fixed length elements.

Definition at line 139 of file HDF5Record.h.

References casacore::Array< T, Alloc >::data(), casacore::RecordInterface::define(), read(), and casacore::value().

static void casacore::HDF5Record::readArray ( hid_t  attrId,
hid_t  dtid,
const IPosition ,
const String name,
RecordInterface rec 
)
staticprivate

Read an array value and add it to the record.

static void casacore::HDF5Record::readArrString ( hid_t  attrId,
const IPosition ,
const String name,
RecordInterface rec 
)
staticprivate

Read a array of strings from an atrribute and add it to the record.

static void casacore::HDF5Record::readEmptyArray ( hid_t  attrId,
const String name,
RecordInterface rec 
)
staticprivate

Read a field containing an empty array.

static Record casacore::HDF5Record::readRecord ( const HDF5Object parentHid,
const String groupName 
)
static

Read a record from the attributes of the given group.

Nested records are read back correctly. An empty record is returned if the group does not exist.

template<typename T >
static void casacore::HDF5Record::readSca ( hid_t  attrId,
const String name,
RecordInterface rec 
)
inlinestaticprivate

Read a field containing a scalar of fixed length.

Definition at line 128 of file HDF5Record.h.

References casacore::RecordInterface::define(), read(), and casacore::value().

static void casacore::HDF5Record::readScalar ( hid_t  attrId,
hid_t  dtid,
const String name,
RecordInterface rec 
)
staticprivate

Read a scalar value and add it to the record.

static void casacore::HDF5Record::readScaString ( hid_t  attrId,
Int  sz,
const String name,
RecordInterface rec 
)
staticprivate

Read a scalar string from an attribute and add it to the record.

static void casacore::HDF5Record::remove ( const HDF5Object parentHid,
const String recordName 
)
static

Remove the record (i.e.

group) from the given parent. Nothing is done if the record does not exist.

template<typename T >
static void casacore::HDF5Record::writeArr ( hid_t  parentHid,
const String name,
const RecordInterface rec,
Int  i 
)
inlinestaticprivate

Write a field containing an array of fixed length elements.

Definition at line 192 of file HDF5Record.h.

References casacore::Array< T, Alloc >::data(), casacore::RecordInterface::get(), casacore::ArrayBase::shape(), casacore::value(), and writeArray().

static void casacore::HDF5Record::writeArray ( hid_t  parentHid,
const String name,
const void *  value,
const IPosition shape,
const HDF5DataType dtype 
)
staticprivate

Write an array of fixed length values as attribute.

Referenced by writeArr().

static void casacore::HDF5Record::writeArrString ( hid_t  parentHid,
const String name,
const Array< String > &  value 
)
staticprivate

Write an array of strings as attribute.

HDF5 cannot handle empty strings, so for empty strings a special value is written.

static void casacore::HDF5Record::writeEmptyArray ( hid_t  groupHid,
const String name,
Int  rank,
DataType  dtype 
)
staticprivate

Write a field containing an empty array.

static void casacore::HDF5Record::writeRecord ( const HDF5Object parentHid,
const String recordName,
const RecordInterface rec 
)
static

Write the record as attributes of a group of the given parent.

Nested records are written as nested groups. The group is deleted first if it already exists.

template<typename T >
static void casacore::HDF5Record::writeSca ( hid_t  parentHid,
const String name,
const RecordInterface rec,
Int  i 
)
inlinestaticprivate

Write a field containing a fixed length scalar value.

Definition at line 181 of file HDF5Record.h.

References casacore::RecordInterface::get(), casacore::value(), and writeScalar().

static void casacore::HDF5Record::writeScalar ( hid_t  parentHid,
const String name,
const void *  value,
const HDF5DataType dtype 
)
staticprivate

Write a fixed length scalar value as attribute.

Referenced by writeSca().

static void casacore::HDF5Record::writeScaString ( hid_t  parentHid,
const String name,
const String value 
)
staticprivate

Write a scalar string as attribute.

HDF5 cannot handle empty strings, so for empty strings a special value is written.


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