Loading...
Searching...
No Matches
casacore::TableMeasOffsetDesc Class Reference
measures package (libcasa_measures) » TableMeasures_module

More...

`#include <TableMeasOffsetDesc.h>`

## Public Member Functions

| TableMeasOffsetDesc (const Measure &offset)
| Constructor which defines a constant (non-variable) offset.
| TableMeasOffsetDesc (const TableMeasDescBase &offsetColumn, Bool asArray=False)
| Constructor for defining a variable offset.
| TableMeasOffsetDesc (const TableMeasOffsetDesc &that)
| Copy constructor (copy semantics).
| ~TableMeasOffsetDesc ()
TableMeasOffsetDesc & | operator= (const TableMeasOffsetDesc &that)
| Assignment operator (copy semantics).
const Measure & | getOffset () const
| Get the (non-variable) measure offset for this column.
Bool | isVariable () const
| Returns True if the offset varies per row.
Bool | isArray () const
| Returns True if the offset varies per array element.
const String & | columnName () const
| Gets the name of the column which stores the variable offset.
void | resetOffset (const Measure &offset)
| Reset the offset.
void | write (TableDesc &, TableRecord &measInfo, const String &prefix)
| Write the information into the record.
void | write (Table &, TableRecord &measInfo, const String &prefix)

## Static Public Member Functions

static TableMeasOffsetDesc * | reconstruct (const TableRecord &measInfo, const String &prefix, const Table &tab)
| Reconstructs the TableMeasOffsetDesc from the measInfo TableRecord.

## Private Member Functions

| TableMeasOffsetDesc (const TableRecord &measInfo, const String &prefix, const Table &)
| Constructor which uses the measInfo TableRecord.
void | writeKeys (TableRecord &measInfo, const String &prefix)
| Write the actual keywords.

## Private Attributes

TableMeasDescBase * | itsTMDesc
MeasureHolder | itsMeasure
String | itsVarColName
Bool | itsVarPerArr

## Detailed Description

Definition of a Measure Offset in a Table.

### Intended use:

Public interface

### Review Status

Reviewed By:
  Bob Garwood
Date Reviewed:
  1999/12/23
Test programs:
  tTableMeasures

### Prerequisite

- Measures
- Tables
- TableMeasDesc

### Synopsis

This class assists in the definition of the offset component of a TableMeasDesc in the TableMeasures system. Four possibilities exist for specifying the handling of measure offsets in a Measure column. These are:

- an offset is not used
- all measures in the column have the same offset
- a unique (and probably different) offset is stored for each row
- a unique offset is stored in each array element per (Array)column row

Note that this last option is only relevant when using ArrayMeasColumns.

Examples of each of these follow.

### Example

1. Specifying a single fixed offset. Note that a Measure offset is itself a measure

   // create an MEpoch to use as the offset in an MEpoch column
   MEpoch offset(MVEpoch(MVTime(1996, 5, 17, (8+18./60.)/24.)), MEpoch::UTC);
   TableMeasOffsetDesc offsetDesc(offset);
   casacore::MEpoch
   Definition MEpoch.h:101
   casacore::MEpoch::UTC
   @ UTC
   Definition MEpoch.h:125
   casacore::MVEpoch
   Definition MVEpoch.h:87
   casacore::MVTime
   Definition MVTime.h:268
   casacore::TableMeasOffsetDesc::TableMeasOffsetDesc
   TableMeasOffsetDesc(const Measure &offset)
   Constructor which defines a constant (non-variable) offset.
   casacore::offset
   int offset(int, int) const
   compute a linear offset from array indicies

2. Storing an offset per row needs an offset column. Measure offsets are Measures so a Measure column is needed:

   // Need a column for the offsets. This is to be a Measure column,
   // so the rules for creating a Measure column apply.
   ArrayColumnDesc<Double> cdOffset("OffsetCol", "Variable Offset col");
   ..\.
   // add the column to the table
   td.addColumn(cdOffset);
   ..\.
   // Create the Measure column to be used as the measure offset column
   TableMeasValueDesc valDesc(td, "OffsetCol");
   TableMeasDesc<MEpoch> offset(valDesc);
   // Create the offset descriptor
   TableMeasOffsetDesc offsetDesc(offset);
   casacore::ArrayColumnDesc
   Templated class for description of table array columns.
   Definition ArrColDesc.h:235
   casacore::TableMeasDesc
   Definition TableMeasDesc.h:258
   casacore::TableMeasValueDesc
   Definition TableMeasValueDesc.h:106

3. Storing an offset per array element per row requires one change in the constructor used in the previous example:
   ..\.
   // set up column and TableMeasDesc as before
   ..\.
   // Setting the asArray parameter to True in the constructor specifies
   // per element offset storage
   TableMeasOffsetDesc offsetDesc(offset, True);
   casacore::True
   const Bool True
   Definition aipstype.h:41

For an example of the use of the TableMeasOffsetDesc class in the context of a full TableMeasDesc declaration see class TableMeasDesc.

### Motivation

Creating the required keyword for the definition of a Measure in a Table is somewhat complicated. This class assists in that process.

### Thrown Exceptions

- AipsError during reconstruction of non-variable offset if a component of the offset measure is missing in the column keywords or is corrupt in some way.
- AipsError if getOffset() called on a variable offset object.
- AipsError during a reconstruct if the column doesn't have a Unit.

Definition at line 143 of file TableMeasOffsetDesc.h.

## Constructor & Destructor Documentation

## TableMeasOffsetDesc() [1/4]

casacore::TableMeasOffsetDesc::TableMeasOffsetDesc | ( | const Measure & | offset | ) |

Constructor which defines a constant (non-variable) offset.

All measures in the columns will have the same offset.

References casacore::offset().

Referenced by operator=(), reconstruct(), and TableMeasOffsetDesc().

## TableMeasOffsetDesc() [2/4]

casacore::TableMeasOffsetDesc::TableMeasOffsetDesc | ( | const TableMeasDescBase & | offsetColumn,
|  | Bool | asArray = False )

Constructor for defining a variable offset.

If asArray is True then the offset is stored per array element. The default is for the offset to be stored (and hence variable) per row.

References casacore::False.

## TableMeasOffsetDesc() [3/4]

casacore::TableMeasOffsetDesc::TableMeasOffsetDesc | ( | const TableMeasOffsetDesc & | that | ) |

Copy constructor (copy semantics).

References TableMeasOffsetDesc().

## ~TableMeasOffsetDesc()

casacore::TableMeasOffsetDesc::~TableMeasOffsetDesc | ( |  | ) |

## TableMeasOffsetDesc() [4/4]

casacore::TableMeasOffsetDesc::TableMeasOffsetDesc | ( | const TableRecord & | measInfo,
|  | const String & | prefix,
|  | const Table & | )

private

Constructor which uses the measInfo TableRecord.

## Member Function Documentation

## columnName()

const String & casacore::TableMeasOffsetDesc::columnName | ( |  | ) | const

inline

Gets the name of the column which stores the variable offset.

"" is returned if the offset is not variable.

Definition at line 183 of file TableMeasOffsetDesc.h.

References itsVarColName.

## getOffset()

const Measure & casacore::TableMeasOffsetDesc::getOffset | ( |  | ) | const

Get the (non-variable) measure offset for this column.

If it doesn't exist (thus if the offset is variable), an exception is thrown.

## isArray()

Bool casacore::TableMeasOffsetDesc::isArray | ( |  | ) | const

inline

Returns True if the offset varies per array element.

Definition at line 178 of file TableMeasOffsetDesc.h.

References isVariable(), and itsVarPerArr.

## isVariable()

Bool casacore::TableMeasOffsetDesc::isVariable | ( |  | ) | const

inline

Returns True if the offset varies per row.

Definition at line 174 of file TableMeasOffsetDesc.h.

References itsTMDesc.

Referenced by isArray().

## operator=()

TableMeasOffsetDesc & casacore::TableMeasOffsetDesc::operator= | ( | const TableMeasOffsetDesc & | that | ) |

Assignment operator (copy semantics).

References TableMeasOffsetDesc().

## reconstruct()

TableMeasOffsetDesc * casacore::TableMeasOffsetDesc::reconstruct | ( | const TableRecord & | measInfo,
|  | const String & | prefix,
|  | const Table & | tab )

static

Reconstructs the TableMeasOffsetDesc from the measInfo TableRecord.

References TableMeasOffsetDesc().

## resetOffset()

void casacore::TableMeasOffsetDesc::resetOffset | ( | const Measure & | offset | ) |

Reset the offset.

It overwrites the value used when defining the TableMeasDesc. It is only possible if it was defined as fixed for the entire column.

References casacore::offset().

## write() [1/2]

void casacore::TableMeasOffsetDesc::write | ( | Table & | ,
|  | TableRecord & | measInfo,
|  | const String & | prefix )

## write() [2/2]

void casacore::TableMeasOffsetDesc::write | ( | TableDesc & | ,
|  | TableRecord & | measInfo,
|  | const String & | prefix )

Write the information into the record.

## writeKeys()

void casacore::TableMeasOffsetDesc::writeKeys | ( | TableRecord & | measInfo,
|  | const String & | prefix )

private

Write the actual keywords.

## Member Data Documentation

## itsMeasure

MeasureHolder casacore::TableMeasOffsetDesc::itsMeasure

private

Definition at line 199 of file TableMeasOffsetDesc.h.

## itsTMDesc

TableMeasDescBase* casacore::TableMeasOffsetDesc::itsTMDesc

private

Definition at line 198 of file TableMeasOffsetDesc.h.

Referenced by isVariable().

## itsVarColName

String casacore::TableMeasOffsetDesc::itsVarColName

private

Definition at line 200 of file TableMeasOffsetDesc.h.

Referenced by columnName().

## itsVarPerArr

Bool casacore::TableMeasOffsetDesc::itsVarPerArr

private

Definition at line 201 of file TableMeasOffsetDesc.h.

Referenced by isArray().

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

- measures/TableMeasures/TableMeasOffsetDesc.h