#include <ArrayMeasColumn.h>
Inheritance diagram for casa::ROArrayMeasColumn< M >:


Part of API
ROArrayMeasColumn and ArrayMeasColumn objects can be used to access array Measure columns in tables. The ROArrayMeasColumn provides read only access whereas the ArrayMeasColumn object can be used for reading and writing of Measures array columns.
Before a column can be accessed it must have previously been defined as a Measure column by use of the TableMeasDesc object.
The (RO)ArrayMeasColumn class is templated on Measure type and MeasValue type but typedefs exist for making declaration less long winded. The Measure classes (like MEpoch) have typedefs ROArrayColumn and ArrayColumn to assist in creating (RO)ArrayMeasColumn objects.
Constructing array Measure column objects using these typedefs looks like this:
// Read/write MEpoch array column MEpoch::ArrayColumn ec(table, "ColumnName); // Readonly MDoppler array column MDoppler::ROArrayColumn 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.
Care needs to be taken when adding Measures to a column. The user needs to be aware that Measures are not checked for consistency, with respect to a Measure's reference, between the Measures being added to a column and the column's predefined Measure reference. This is only an issue if the Measure column was defined to have a fixed reference. For such columns the reference component of Measures added to a column is silently ignored, that is, there is no warning nor is there any sort of conversion to the column's reference should the reference of the added Measure be different from the column's reference. The members isRefVariable() and getMeasRef() can be used to discover a Measure column's Measure reference characteristics.
// create an MEpoch array column object MEpochArrCol arrayCol; // should be null. Can test this and attach a real MEpoch column // The column Time1Arr should exist in the table and would have been // defined by using a TableMeasDesc if (arrayCol.isNull()) { arrayCol.attach(tab, "Time1Arr"); } // This would throw an Exception if the object is still null.\..\.but // hopefully won't arrayCol.throwIfNull(); // create a vector of MEpochs MEpoch last(Quantity(13.45, "h"), MEpoch::Ref(MEpoch::TAI)); Vector<MEpoch> ev(10); for (uInt i=0; i<10; i++) { last.set(Quantity(13.45 + i, "h")); ev(i) = last; } // before adding something check the isDefined() member if (!arrayCol.isDefined(0)) { cout << "PASS - nothing in the measure array column row yet\n"; } else { cout << "FAIL - there shouldn't be a valid value in the row!\n"; } // add the MEpoch vector to the array Measure column at row 0 arrayCol.put(0, ev); // now read the array from the row. Could use same object to do this // but here we'll create a ROMEpochArrCol to do this ROMEpochArrCol roArrCol(tab, "Time1Arr"); // need a vector to put the MEpochs into Vector<MEpoch> ew; // setting the resize parameter to True automatically sets ew to the // same shape as the array contained in the row arrayCol.get(0, ew, True);
The standard Aips++ Table system does not support array Measure columns. This class overcomes this limitation.
Definition at line 176 of file ArrayMeasColumn.h.
Public Member Functions | |
| ROArrayMeasColumn () | |
| The default constructor creates a null object. | |
| ROArrayMeasColumn (const Table &tab, const String &columnName) | |
| Create the ROArrayMeasColumn from the table and column Name. | |
| ROArrayMeasColumn (const ROArrayMeasColumn< M > &that) | |
| Copy constructor (copy semantics). | |
| virtual | ~ROArrayMeasColumn () |
| void | reference (const ROArrayMeasColumn< M > &that) |
| Change the reference to another column. | |
| void | attach (const Table &tab, const String &columnName) |
| Attach a column to the object. | |
| Array< M > | convert (uInt rownr, const M &meas) const |
| Get the Measure array contained in the specified row and convert it to the reference and offset found in the given measure. | |
| void | get (uInt rownr, Array< M > &meas, Bool resize=False) const |
| Get the Measure array in the specified row. | |
| Array< M > | operator() (uInt rownr) const |
| Array< M > | convert (uInt rownr, const MeasRef< M > &measRef) const |
| Get the Measure array contained in the specified row and convert it to the given reference. | |
| Array< M > | convert (uInt rownr, uInt refCode) const |
| const MeasRef< M > & | getMeasRef () const |
| Get the column's reference. | |
Protected Attributes | |
| MeasRef< M > | itsMeasRef |
Private Member Functions | |
| ROArrayMeasColumn & | operator= (const ROArrayMeasColumn< M > &that) |
| Assignment makes no sense in a read only class. | |
| void | cleanUp () |
| Deletes allocated memory etc. | |
| Array< M > | doConvert (uInt rownr, typename M::Convert &conv) const |
| Get the data and convert using conversion engine. | |
Private Attributes | |
| ROArrayColumn< Double > * | itsDataCol |
| ROScalarColumn< Int > * | itsRefIntCol |
| ROArrayColumn< Int > * | itsArrRefIntCol |
| ROScalarColumn< String > * | itsRefStrCol |
| ROArrayColumn< String > * | itsArrRefStrCol |
| ROScalarMeasColumn< M > * | itsOffsetCol |
| ROArrayMeasColumn< M > * | itsArrOffsetCol |
| casa::ROArrayMeasColumn< M >::ROArrayMeasColumn | ( | ) |
The default constructor creates a null object.
Useful for creating arrays of ROArrayMeasColumn objects. Attempting to use a null object will produce a segmentation fault so care needs to be taken to initialise the objects by using the attach() member before any attempt is made to use the object. A ROArrayMeasColumn object can be tested if it is null by using the isNull() member.
| casa::ROArrayMeasColumn< M >::ROArrayMeasColumn | ( | const Table & | tab, | |
| const String & | columnName | |||
| ) |
Create the ROArrayMeasColumn from the table and column Name.
| casa::ROArrayMeasColumn< M >::ROArrayMeasColumn | ( | const ROArrayMeasColumn< M > & | that | ) |
Copy constructor (copy semantics).
| virtual casa::ROArrayMeasColumn< M >::~ROArrayMeasColumn | ( | ) | [virtual] |
| void casa::ROArrayMeasColumn< M >::reference | ( | const ROArrayMeasColumn< M > & | that | ) |
Change the reference to another column.
| void casa::ROArrayMeasColumn< M >::attach | ( | const Table & | tab, | |
| const String & | columnName | |||
| ) |
| void casa::ROArrayMeasColumn< M >::get | ( | uInt | rownr, | |
| Array< M > & | meas, | |||
| Bool | resize = False | |||
| ) | const |
| Array<M> casa::ROArrayMeasColumn< M >::operator() | ( | uInt | rownr | ) | const |
| Array<M> casa::ROArrayMeasColumn< M >::convert | ( | uInt | rownr, | |
| const M & | meas | |||
| ) | const [inline] |
Get the Measure array contained in the specified row and convert it to the reference and offset found in the given measure.
Definition at line 210 of file ArrayMeasColumn.h.
Referenced by casa::ROArrayMeasColumn< casa::MFrequency >::convert().
| Array<M> casa::ROArrayMeasColumn< M >::convert | ( | uInt | rownr, | |
| const MeasRef< M > & | measRef | |||
| ) | const |
Get the Measure array contained in the specified row and convert it to the given reference.
| Array<M> casa::ROArrayMeasColumn< M >::convert | ( | uInt | rownr, | |
| uInt | refCode | |||
| ) | const |
| const MeasRef<M>& casa::ROArrayMeasColumn< M >::getMeasRef | ( | ) | const [inline] |
| ROArrayMeasColumn& casa::ROArrayMeasColumn< M >::operator= | ( | const ROArrayMeasColumn< M > & | that | ) | [private] |
Assignment makes no sense in a read only class.
Declaring this operator private makes it unusable.
| void casa::ROArrayMeasColumn< M >::cleanUp | ( | ) | [private] |
Deletes allocated memory etc.
Called by ~tor and any member which needs to reallocate data.
| Array<M> casa::ROArrayMeasColumn< M >::doConvert | ( | uInt | rownr, | |
| typename M::Convert & | conv | |||
| ) | const [private] |
Get the data and convert using conversion engine.
MeasRef<M> casa::ROArrayMeasColumn< M >::itsMeasRef [protected] |
Definition at line 228 of file ArrayMeasColumn.h.
Referenced by casa::ROArrayMeasColumn< casa::MFrequency >::getMeasRef().
ROArrayColumn<Double>* casa::ROArrayMeasColumn< M >::itsDataCol [private] |
Definition at line 232 of file ArrayMeasColumn.h.
ROScalarColumn<Int>* casa::ROArrayMeasColumn< M >::itsRefIntCol [private] |
Definition at line 234 of file ArrayMeasColumn.h.
ROArrayColumn<Int>* casa::ROArrayMeasColumn< M >::itsArrRefIntCol [private] |
Definition at line 235 of file ArrayMeasColumn.h.
ROScalarColumn<String>* casa::ROArrayMeasColumn< M >::itsRefStrCol [private] |
Definition at line 237 of file ArrayMeasColumn.h.
ROArrayColumn<String>* casa::ROArrayMeasColumn< M >::itsArrRefStrCol [private] |
Definition at line 238 of file ArrayMeasColumn.h.
ROScalarMeasColumn<M>* casa::ROArrayMeasColumn< M >::itsOffsetCol [private] |
Definition at line 241 of file ArrayMeasColumn.h.
ROArrayMeasColumn<M>* casa::ROArrayMeasColumn< M >::itsArrOffsetCol [private] |
Definition at line 242 of file ArrayMeasColumn.h.
1.5.1