SDTabRecCopier.h

Classes

SDTabRecCopier -- SDTabRecCopier copies a scalar field with units between an SDFITS table and an SDRecord (full description)

class SDTabRecCopier

Interface

Public Members
SDTabRecCopier()
SDTabRecCopier(const String &columnName, const Table &tab, const String &fieldName, Record &rec, const String &fieldUnit, Bool readOnly)
SDTabRecCopier(const SDTabRecCopier &other)
~SDTabRecCopier()
SDTabRecCopier &operator=(const SDTabRecCopier &other)
Bool init(const String &columnName, const Table &tab, const String &fieldName, Record &rec, const String &fieldUnits, Bool readOnly)
Bool copyToField(uInt rownr)
Bool copyFromField(uInt rownr)
Bool isAttached()
const String &columnName()
const String &fieldName()
Bool readOnly()
const String &tableUnits()
const String &fieldUnits()
const Double &getRecord()

Description

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

Synopsis

A few comments on rules before I flesh out this document. All SDFITS table columns have fixed type and units. The value is held in an SDRecord with fixed units, which may be different fromthose in the table. The copy operations return False and do not copy any values if there is a problem making the Unit conversion. The table column must be a scalar column.

Example

Motivation

Member Description

SDTabRecCopier()

empty, not attached to anything, copy operations always return False

SDTabRecCopier(const String &columnName, const Table &tab, const String &fieldName, Record &rec, const String &fieldUnit, Bool readOnly)

attach to the column name in a table and the field name in the record making the copier read-only (table to field) or writable (both directions) The named column must exist in tab. The named field must exist as TpDouble of rec. The fieldUnit are the desired unit of the SDRecord field. If the table has no UNITS keyword for this column, it is assumed to already be in the correct units.

SDTabRecCopier(const SDTabRecCopier &other)

construct from another

~SDTabRecCopier()

SDTabRecCopier &operator=(const SDTabRecCopier &other)

assignment operator

Bool init(const String &columnName, const Table &tab, const String &fieldName, Record &rec, const String &fieldUnits, Bool readOnly)

re-initialize everything. Useful if the default constructor was used or if the contents of the record or table change. Returns False if the named column does not exist, if the named field does not exist or if the named field is not a TpRecord.

Bool copyToField(uInt rownr)

Copy the table value at rownr to the field this is attached to. Returns False when there is a problem converting the units. There is no checking on the validity of the row number or if this object is attached.

Bool copyFromField(uInt rownr)

Copy the value from the field this is attached to and store the result in the table at rownr in the units found in the table. Returns False if the value can not be converted to the units found in the table. Also returns False if this copier is read-only. There is no checking on the validity of the row number or if this object is attached.

Bool isAttached()

is this attached

const String &columnName()

The column name

const String &fieldName()

The field name

Bool readOnly()

is it read-only?

const String &tableUnits()

The units of the table column

const String &fieldUnits()

The units of the field

const Double &getRecord()

return the value of the field