#include <ScalarMeasColumn.h>
Inheritance diagram for casa::ROScalarMeasColumn< M >:


Part of API
ROScalarMeasColumn and ScalarMeasColumn objects can be used to access Scalar Measure Columns in tables. The ROScalarMeasColumn provides read only access whereas the ScalarMeasColumn object can be used for writing and reading of Measures to and from a Table column.
Before a column can be accessed it must have previously been defined as a Measure column by use of the TableMeasDesc object.
The (RO)ScalarMeasColumn class is templated on Measure type. Typedefs exist in the various Measure classes (e.g. MEpoch ) to make declaration less long winded. Constructing scalar Measure column objects using these typedefs looks like this:
MEpoch::ScalarMeasColumn ec(table, "ColumnName); MDoppler::ROScalarMeasColumn dc(table, "DopplerCol");
The reading and writing of Measures columns is very similar to reading and writing of "ordinary" Table columns. get() and operator() exist for reading Measures and the put() member for adding Measures to a column. (put() is obviously not defined for ROScalarMeasColumn objects.) Each of these members accepts a row number as an argument. The get() function gets the measure with the reference and offset as it is stored in the column. Furthermore the convert() function is available to get the measure with the given reference, possible offset, and possible frame
When a Measure is put, the reference and possible offset are converted if the measure column is defined with a fixed reference and/or offset. If the column's reference and offset are variable, the reference and offset of the measure as put are written into the appropriate reference and offset columns.
// This creates a Scalar MEpoch column for read/write access. Column // "Time1" must exist in Table "tab" and must have previously been // defined as a MEpoch column using a TableMeasDesc. MEpoch::ScalarMeasColumn timeCol(tab, "Time1"); // print some details about the column if (timeCol.isRefVariable()) { cout << "The column has variable references." << endl; } else { cout << "The fixed MeasRef for the column is: " << timeCol.getMeasRef() << endl; } // Add tab.nrow() measures to the column. MEpoch tm(Quantity(MeasData::MJD2000, "d"), MEpoch::TAI); for (uInt i=0; i<tab.nrow(); i++) { timeCol.put(i, tm); } // We could read from the column using timeCol but instead a read // only column object is created. MEpoch::ROScalarMeasColumn timeColRead(tab, "Time1"); for (i=0; i<tab.nrow(); i++) { cout << timeColRead(i) << endl; }
The standard Aips++ Table system does not support Measures columns. This class overcomes this limitation.
Definition at line 147 of file ScalarMeasColumn.h.
Public Member Functions | |
| ROScalarMeasColumn () | |
| The default constructor creates a null object. | |
| ROScalarMeasColumn (const Table &tab, const String &columnName) | |
| Create the ScalarMeasColumn from the table and column Name. | |
| ROScalarMeasColumn (const ROScalarMeasColumn< M > &that) | |
| Copy constructor (copy semantics). | |
| virtual | ~ROScalarMeasColumn () |
| void | reference (const ROScalarMeasColumn< M > &that) |
| Change the reference to another column. | |
| void | attach (const Table &tab, const String &columnName) |
| Attach a column to the object. | |
| M | convert (uInt rownr, const M &meas) const |
| Get the Measure contained in the specified row and convert it to the reference and offset found in the given measure. | |
| const MeasRef< M > & | getMeasRef () const |
| Returns the column's fixed reference or the reference of the last read Measure if references are variable. | |
| void | get (uInt rownr, M &meas) const |
| Get the Measure contained in the specified row. | |
| M | operator() (uInt rownr) const |
| M | convert (uInt rownr, const MeasRef< M > &measRef) const |
| Get the Measure contained in the specified row and convert it to the given reference. | |
| M | convert (uInt rownr, uInt refCode) const |
Protected Member Functions | |
| MeasRef< M > | makeMeasRef (uInt rownr) const |
| Make a MeasRef for the given row. | |
Protected Attributes | |
| MeasRef< M > | itsMeasRef |
Private Member Functions | |
| ROScalarMeasColumn & | operator= (const ROScalarMeasColumn< M > &that) |
| Assignment makes no sense in a readonly class. | |
| void | cleanUp () |
Private Attributes | |
| ROArrayColumn< Double > * | itsArrDataCol |
| ROScalarColumn< Double > * | itsScaDataCol |
| ROScalarColumn< Int > * | itsRefIntCol |
| ROScalarColumn< String > * | itsRefStrCol |
| ROScalarMeasColumn< M > * | itsOffsetCol |
| casa::ROScalarMeasColumn< M >::ROScalarMeasColumn | ( | ) |
The default constructor creates a null object.
Useful for creating arrays of ROScalarMeasColumn objects. Attempting to use a null object will produce a segmentation fault so care needs to be taken to initialize the objects first by using attach(). An ROScalarMeasColumn object can be tested if it is null by using the isNull() member.
| casa::ROScalarMeasColumn< M >::ROScalarMeasColumn | ( | const Table & | tab, | |
| const String & | columnName | |||
| ) |
Create the ScalarMeasColumn from the table and column Name.
| casa::ROScalarMeasColumn< M >::ROScalarMeasColumn | ( | const ROScalarMeasColumn< M > & | that | ) |
Copy constructor (copy semantics).
| virtual casa::ROScalarMeasColumn< M >::~ROScalarMeasColumn | ( | ) | [virtual] |
| void casa::ROScalarMeasColumn< M >::reference | ( | const ROScalarMeasColumn< M > & | that | ) |
Change the reference to another column.
| void casa::ROScalarMeasColumn< M >::attach | ( | const Table & | tab, | |
| const String & | columnName | |||
| ) |
| void casa::ROScalarMeasColumn< M >::get | ( | uInt | rownr, | |
| M & | meas | |||
| ) | const |
| M casa::ROScalarMeasColumn< M >::operator() | ( | uInt | rownr | ) | const |
| M casa::ROScalarMeasColumn< M >::convert | ( | uInt | rownr, | |
| const M & | meas | |||
| ) | const [inline] |
Get the Measure contained in the specified row and convert it to the reference and offset found in the given measure.
Definition at line 181 of file ScalarMeasColumn.h.
Referenced by casa::ROScalarMeasColumn< casa::MFrequency >::convert().
| M casa::ROScalarMeasColumn< M >::convert | ( | uInt | rownr, | |
| const MeasRef< M > & | measRef | |||
| ) | const |
Get the Measure contained in the specified row and convert it to the given reference.
| M casa::ROScalarMeasColumn< M >::convert | ( | uInt | rownr, | |
| uInt | refCode | |||
| ) | const |
| const MeasRef<M>& casa::ROScalarMeasColumn< M >::getMeasRef | ( | ) | const [inline] |
Returns the column's fixed reference or the reference of the last read Measure if references are variable.
Definition at line 193 of file ScalarMeasColumn.h.
| MeasRef<M> casa::ROScalarMeasColumn< M >::makeMeasRef | ( | uInt | rownr | ) | const [protected] |
Make a MeasRef for the given row.
| ROScalarMeasColumn& casa::ROScalarMeasColumn< M >::operator= | ( | const ROScalarMeasColumn< M > & | that | ) | [private] |
Assignment makes no sense in a readonly class.
Declaring this operator private makes it unusable.
| void casa::ROScalarMeasColumn< M >::cleanUp | ( | ) | [private] |
MeasRef<M> casa::ROScalarMeasColumn< M >::itsMeasRef [protected] |
Definition at line 203 of file ScalarMeasColumn.h.
Referenced by casa::ROScalarMeasColumn< casa::MFrequency >::getMeasRef().
ROArrayColumn<Double>* casa::ROScalarMeasColumn< M >::itsArrDataCol [private] |
Definition at line 209 of file ScalarMeasColumn.h.
ROScalarColumn<Double>* casa::ROScalarMeasColumn< M >::itsScaDataCol [private] |
Definition at line 210 of file ScalarMeasColumn.h.
ROScalarColumn<Int>* casa::ROScalarMeasColumn< M >::itsRefIntCol [private] |
Definition at line 212 of file ScalarMeasColumn.h.
ROScalarColumn<String>* casa::ROScalarMeasColumn< M >::itsRefStrCol [private] |
Definition at line 213 of file ScalarMeasColumn.h.
ROScalarMeasColumn<M>* casa::ROScalarMeasColumn< M >::itsOffsetCol [private] |
Definition at line 216 of file ScalarMeasColumn.h.
1.5.1