TableMeasRefDesc.h
Classes
- TableMeasRefDesc -- Definition of a Measure Reference in a Table. (full description)
Interface
- Public Members
- explicit TableMeasRefDesc (uInt refCode = 0)
- TableMeasRefDesc (uInt refCode, const TableMeasOffsetDesc&)
- TableMeasRefDesc (const TableDesc&, const String& column)
- TableMeasRefDesc (const TableDesc&, const String& column, const TableMeasOffsetDesc&)
- TableMeasRefDesc (const TableRecord& measInfo, const Table&, const TableMeasDescBase&)
- TableMeasRefDesc (const TableMeasRefDesc& that)
- ~TableMeasRefDesc()
- TableMeasRefDesc& operator= (const TableMeasRefDesc& that)
- uInt getRefCode() const
- Bool isRefCodeVariable() const
- const String& columnName() const
- Bool hasOffset() const
- Bool isOffsetVariable() const
- Bool isOffsetArray() const
- const Measure& getOffset() const
- const String& offsetColumnName() const
- void resetRefCode (uInt refCode)
- void resetOffset (const Measure& offset)
- void write (TableDesc&, TableRecord& measInfo, const TableMeasDescBase&)
- void write (Table&, TableRecord& measInfo, const TableMeasDescBase&)
- Private Members
- void writeKeys (TableRecord& measInfo, const TableMeasDescBase& measDesc)
- void checkColumn (const TableDesc& td) const
Review Status
- Reviewed By:
- Bob Garwood
- Date Reviewed:
- 1999/12/23
- Programs:
- Tests:
Prerequisite
Synopsis
TableMeasRefDesc is a class for setting up the MeasRef
component of a TableMeasDesc in the TableMeasures system. With the aid
of a
TableMeasRefDesc the following possibilities for defining a Measure
column's reference exist:
- a fixed, non-variable, reference code, where all Measures in a
column are to have the same reference code.
- a unique (and probably different) reference code stored in each row.
- a unique reference code stored in each array element per
(Array)column row.
For each of the above options an offset component can be specified
along with a reference code. When a Measure offset is required a
TableMeasOffsetDesc is
supplied as an argument to the TableMeasRefDesc constructor.
With references containing an offset component either component can be set
to be variable or fixed independently of the other.
It is not necessary to specify a Reference when defining a
Measure column. In such cases the Measures retrieved from the column
will have the default reference for the type of Measure stored in the
column.
A fixed reference code is trivially stored as part of the column
keywords in the Measure column but a variable reference code requires
its own column. A Scalar or Array column can be used dependent on your
needs but its type must always be either Int or String. Note that it is
legal to specify a Scalar
reference column for use with an ArrayMeasColumn. In such cases a single
reference code will be stored per array (row) of Measures. However,
attempting to associate an Array column for references with a
ScalarMeasColumn will generate an exception.
When storing Measures into a Measure column with a fixed reference code
the reference code component of the Measures stored is
ignored.
Example
- Simplest kind of TableMeasRefDesc (apart from not specifying one at
all) is a fixed reference code. All Measures subsequently
retrieved from the column will have the reference MEpoch::LAST.
// measure reference column
TableMeasRefDesc reference(MEpoch::LAST);
- A variable reference code requires its own Int column.
// An int column for the variable references.
ScalarColumnDesc<Int> cdRefCol("refCol", "Measure reference column");
td.addColumn(cdRefCol);
...
// create the Measure reference descriptor
TableMeasRefDesc varRef(td, "refCol");
- A fix Measure reference code with a fixed Offset
// Create the Offset descriptor
MEpoch offset(MVEpoch(MVTime(1996, 5, 17, (8+18./60.)/24.))
TableMeasOffsetDesc offsetDesc(offset);
// create the Measure reference descriptor
TableMeasRefDesc varRef(MEpoch::LAST, offsetDesc);
For an example of the use of a TableMeasRefDesc 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 if the specified column doesn't exist or its type is
not Int or String.
Member Description
Define a fixed MeasRef by supplying its reference code
Optionally a Measure offset can be specified.
The reference code and offset should not need a reference frame.
Define a variable reference by supplying the name of the column
in which the reference is to be stored. Either an Int or
String column can be specified. This determines how
references are stored. Int columns are likely to be
faster but storing
references as Strings may be useful if there is a need to
browse tables manually. Optionally supply a Measure offset.
The reference code and offset should not need a reference frame.
Reconstruct the object from the MEASINFO record.
Not useful for the public.
Copy constructor (copy semantics)
TableMeasRefDesc& operator= (const TableMeasRefDesc& that)
Assignment operator (copy semantics).
Return the reference code.
Is the reference variable?
Return the name of its variable reference code column.
Returns True if the reference has an offset.
Returns True if the offset is variable.
Returns True is the offset is variable and it is an ArrayMeasColumn.
Return the fixed Measure offset.
It does not test if the offset is defined; hasOffset() should be used
for that purpose.
Return the name of the Measure offset column.
An empty string is returned if no variable offset is used.
Reset the refCode or offset.
It overwrites the value used when defining the TableMeasDesc.
It is only possible if it was defined as fixed for the entire column.
Make the Measure value descriptor persistent. Normally would not be
called by the user directly.
Write the actual keywords.
Throw an exception if the column doesn't exist or is of the
wrong type.