casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Static Public Member Functions | Static Private Member Functions
casa::HDF5Record Class Reference

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

#include <HDF5Record.h>

List of all members.

Static Public Member Functions

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

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.
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.
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.
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.
static void readEmptyArray (hid_t attrId, const String &name, RecordInterface &rec)
 Read a field containing an empty array.
template<typename T >
static void readSca (hid_t attrId, const String &name, RecordInterface &rec)
 Read a field containing a scalar of fixed length.
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.
static void read (hid_t attrId, void *value, const HDF5DataType &dtype)
 Read fixed length values from an attribute (scalar and array).
static void doWriteRecord (const HDF5Object &groupHid, const RecordInterface &rec)
 Write a (nested) record.
static void writeScalar (hid_t parentHid, const String &name, const void *value, const HDF5DataType &dtype)
 Write a fixed length scalar value as attribute.
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.
static void writeScaString (hid_t parentHid, const String &name, const String &value)
 Write a scalar string as attribute.
static void writeArrString (hid_t parentHid, const String &name, const Array< String > &value)
 Write an array of strings as attribute.
static void writeEmptyArray (hid_t groupHid, const String &name, Int rank, DataType dtype)
 Write a field containing an empty array.
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.
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.

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 AIPS++ images, so it has to be possible to read and write them from/to HDF5.

Definition at line 76 of file HDF5Record.h.


Member Function Documentation

static Record casa::HDF5Record::doReadRecord ( hid_t  parentHid) [static]

Read back a (nested) record.

static void casa::HDF5Record::doWriteRecord ( const HDF5Object groupHid,
const RecordInterface rec 
) [static, private]

Write a (nested) record.

static void casa::HDF5Record::read ( hid_t  attrId,
void *  value,
const HDF5DataType dtype 
) [static, private]

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

Referenced by readArr(), and readSca().

template<typename T >
static void casa::HDF5Record::readArr ( hid_t  attrId,
const IPosition shape,
const String name,
RecordInterface rec 
) [inline, static, private]

Read a field containing an array of fixed length elements.

Definition at line 134 of file HDF5Record.h.

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

static void casa::HDF5Record::readArray ( hid_t  attrId,
hid_t  dtid,
const IPosition ,
const String name,
RecordInterface rec 
) [static, private]

Read an array value and add it to the record.

static void casa::HDF5Record::readArrString ( hid_t  attrId,
const IPosition ,
const String name,
RecordInterface rec 
) [static, private]

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

static void casa::HDF5Record::readEmptyArray ( hid_t  attrId,
const String name,
RecordInterface rec 
) [static, private]

Read a field containing an empty array.

static Record casa::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 casa::HDF5Record::readSca ( hid_t  attrId,
const String name,
RecordInterface rec 
) [inline, static, private]

Read a field containing a scalar of fixed length.

Definition at line 123 of file HDF5Record.h.

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

static void casa::HDF5Record::readScalar ( hid_t  attrId,
hid_t  dtid,
const String name,
RecordInterface rec 
) [static, private]

Read a scalar value and add it to the record.

static void casa::HDF5Record::readScaString ( hid_t  attrId,
Int  sz,
const String name,
RecordInterface rec 
) [static, private]

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

static void casa::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 casa::HDF5Record::writeArr ( hid_t  parentHid,
const String name,
const RecordInterface rec,
Int  i 
) [inline, static, private]

Write a field containing an array of fixed length elements.

Definition at line 191 of file HDF5Record.h.

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

static void casa::HDF5Record::writeArray ( hid_t  parentHid,
const String name,
const void *  value,
const IPosition shape,
const HDF5DataType dtype 
) [static, private]

Write an array of fixed length values as attribute.

Referenced by writeArr().

static void casa::HDF5Record::writeArrString ( hid_t  parentHid,
const String name,
const Array< String > &  value 
) [static, private]

Write an array of strings as attribute.

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

static void casa::HDF5Record::writeEmptyArray ( hid_t  groupHid,
const String name,
Int  rank,
DataType  dtype 
) [static, private]

Write a field containing an empty array.

static void casa::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 casa::HDF5Record::writeSca ( hid_t  parentHid,
const String name,
const RecordInterface rec,
Int  i 
) [inline, static, private]

Write a field containing a fixed length scalar value.

Definition at line 180 of file HDF5Record.h.

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

static void casa::HDF5Record::writeScalar ( hid_t  parentHid,
const String name,
const void *  value,
const HDF5DataType dtype 
) [static, private]

Write a fixed length scalar value as attribute.

Referenced by writeSca().

static void casa::HDF5Record::writeScaString ( hid_t  parentHid,
const String name,
const String value 
) [static, private]

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: