casa
$Rev:20696$
|
Provides read-only access to Array Quantum columns in Tables. More...
#include <ArrayQuantColumn.h>
Public Member Functions | |
ROArrayQuantColumn () | |
The default constructor creates a null object. | |
ROArrayQuantColumn (const Table &tab, const String &columnName) | |
Create the ROArrayQuantColumn from the supplied table and column name. | |
ROArrayQuantColumn (const Table &tab, const String &columnName, const Unit &) | |
Create the ROArrayQuantColumn from the supplied table and column name. | |
ROArrayQuantColumn (const Table &tab, const String &columnName, const Vector< Unit > &) | |
ROArrayQuantColumn (const ROArrayQuantColumn< T > &that) | |
Copy constructor (copy semantics). | |
~ROArrayQuantColumn () | |
void | reference (const ROArrayQuantColumn< T > &that) |
Make this object reference the column in "that". | |
Array< Quantum< T > > | operator() (uInt rownr) const |
Return the quantum array stored in the specified row. | |
Array< Quantum< T > > | operator() (uInt rownr, const Unit &) const |
Return the quantum array stored in the specified row, converted to the given unit. | |
Array< Quantum< T > > | operator() (uInt rownr, const Vector< Unit > &) const |
Return the quantum array stored in the specified row, converted to the given units. | |
Array< Quantum< T > > | operator() (uInt rownr, const Quantum< T > &other) const |
Return the quantum array stored in the specified row, converted to the unit in other. | |
Bool | isUnitVariable () const |
Test whether the Quantum column has variable units. | |
Vector< String > | getUnits () const |
Returns the column's units as a vector of strings. | |
Bool | isNull () const |
Test if the object is null. | |
void | throwIfNull () const |
Throw an exception if the object is null. | |
void | attach (const Table &tab, const String &columnName) |
Attach a column to the object. | |
void | attach (const Table &tab, const String &columnName, const Unit &) |
void | attach (const Table &tab, const String &columnName, const Vector< Unit > &) |
void | get (uInt rownr, Array< Quantum< T > > &q, Bool resize=False) const |
Get the quantum array in the specified row. | |
void | get (uInt rownr, Array< Quantum< T > > &q, const Unit &, Bool resize=False) const |
Get the quantum array in the specified row. | |
void | get (uInt rownr, Array< Quantum< T > > &q, const Vector< Unit > &, Bool resize=False) const |
Get the quantum array in the specified row. | |
void | get (uInt rownr, Array< Quantum< T > > &q, const Quantum< T > &other, Bool resize=False) const |
Get the quantum array in the specified row. | |
Protected Member Functions | |
const ArrayColumn< String > * | arrUnitsCol () const |
Get access to itsUnitsCol. | |
const ScalarColumn< String > * | scaUnitsCol () const |
Protected Attributes | |
Vector< Unit > | itsUnit |
Private Member Functions | |
void | init (const Table &tab, const String &columnName) |
Initialize the ROArrayQuantColumn from the specified table and column. | |
void | cleanUp () |
Deletes allocated memory etc. | |
void | getData (uInt rownr, Array< Quantum< T > > &q, Bool resize) const |
Get the data without possible conversion. | |
ROArrayQuantColumn & | operator= (const ROArrayQuantColumn< T > &that) |
Assignment makes no sense in a read only class. | |
Bool | operator== (const ROArrayQuantColumn< T > &that) |
Comparison is not defined, since its semantics are unclear. | |
Private Attributes | |
ArrayColumn< T > * | itsDataCol |
ArrayColumn< String > * | itsArrUnitsCol |
ScalarColumn< String > * | itsScaUnitsCol |
Vector< Unit > | itsUnitOut |
Bool | itsConvOut |
Provides read-only access to Array Quantum columns in Tables.
Public interface
The ROArrayQuantColumn class provides read-only access to quanta stored in a array Quantum Table column. The Quantum column should already exist in the table and would have been defined by means of a TableQuantumDesc object . In addition, for a ROArrayQuantColumn object to be useful the column should contain Quanta. Inserting Quanta into a column requires the use of a ArrayQuantColumn object.
The ROArrayQuantColumn class is the array version of the ROScalarQuantColumn class.
Quanta retrieved from the column will normally have the Unit that was specified when the Quantum column was defined. However, it is possible to override the default column Unit by supplying a Unit in the ROArrayQuantColumn constructor. When constructed in this fashion the retrieved Quanta will by default be retrieved in this unit, i.e. they will by default be converted to this unit.
By giving a unit (as a Unit or Quantum object) to a get function, the data can be retrieved in another unit than the default.
(See TableQuantumDesc class for an example of how to define a Quantum column).
// Create the column object with default units "deg". // It gets the quantum array from row 0 and prints it to stdout. ROArrayQuantColumn<Double> roaqCol(qtab, "ArrQuantDouble", "deg"); cout << roaqCol(0) << endl; // This retrieves the same array with units converted to "m/s". cout << roaqCol(0, "m/s") << endl;
Add support for Quanta in the Tables system.
Quantum<Array<T>>
. Definition at line 120 of file ArrayQuantColumn.h.
casa::ROArrayQuantColumn< T >::ROArrayQuantColumn | ( | ) |
The default constructor creates a null object.
It is useful for creating arrays of ROArrayQuantColumn objects. Attempting to use a null object will produce a segmentation fault so care needs to be taken to initialize the objects by using the attach() member before any attempt is made to use the object. The isNull() member can be used to test if a ROArrayQuantColumn object is null.
casa::ROArrayQuantColumn< T >::ROArrayQuantColumn | ( | const Table & | tab, |
const String & | columnName | ||
) |
Create the ROArrayQuantColumn from the supplied table and column name.
The default unit for data retrieved is the unit in which they were stored.
casa::ROArrayQuantColumn< T >::ROArrayQuantColumn | ( | const Table & | tab, |
const String & | columnName, | ||
const Unit & | |||
) |
Create the ROArrayQuantColumn from the supplied table and column name.
The default unit for data retrieved is the given unit (the data is converted as needed).
casa::ROArrayQuantColumn< T >::ROArrayQuantColumn | ( | const Table & | tab, |
const String & | columnName, | ||
const Vector< Unit > & | |||
) |
casa::ROArrayQuantColumn< T >::ROArrayQuantColumn | ( | const ROArrayQuantColumn< T > & | that | ) |
Copy constructor (copy semantics).
casa::ROArrayQuantColumn< T >::~ROArrayQuantColumn | ( | ) |
const ArrayColumn<String>* casa::ROArrayQuantColumn< T >::arrUnitsCol | ( | ) | const [inline, protected] |
Get access to itsUnitsCol.
Definition at line 218 of file ArrayQuantColumn.h.
void casa::ROArrayQuantColumn< T >::attach | ( | const Table & | tab, |
const String & | columnName | ||
) |
Attach a column to the object.
Optionally supply a default unit. which has the same meaning as the constructor unit argument.
Reimplemented in casa::ArrayQuantColumn< T >, casa::ArrayQuantColumn< Float >, and casa::ArrayQuantColumn< Double >.
void casa::ROArrayQuantColumn< T >::attach | ( | const Table & | tab, |
const String & | columnName, | ||
const Unit & | |||
) |
void casa::ROArrayQuantColumn< T >::attach | ( | const Table & | tab, |
const String & | columnName, | ||
const Vector< Unit > & | |||
) |
void casa::ROArrayQuantColumn< T >::cleanUp | ( | ) | [private] |
Deletes allocated memory etc.
Called by ~tor and any member which needs to reallocate data.
Reimplemented in casa::ArrayQuantColumn< T >, casa::ArrayQuantColumn< Float >, and casa::ArrayQuantColumn< Double >.
void casa::ROArrayQuantColumn< T >::get | ( | uInt | rownr, |
Array< Quantum< T > > & | q, | ||
const Unit & | , | ||
Bool | resize = False |
||
) | const |
Get the quantum array in the specified row.
Each quantum is converted to the given unit.
void casa::ROArrayQuantColumn< T >::get | ( | uInt | rownr, |
Array< Quantum< T > > & | q, | ||
const Vector< Unit > & | , | ||
Bool | resize = False |
||
) | const |
Get the quantum array in the specified row.
Each quantum is converted to the given units.
void casa::ROArrayQuantColumn< T >::get | ( | uInt | rownr, |
Array< Quantum< T > > & | q, | ||
const Quantum< T > & | other, | ||
Bool | resize = False |
||
) | const |
Get the quantum array in the specified row.
Each quantum is converted to the unit in other.
void casa::ROArrayQuantColumn< T >::getData | ( | uInt | rownr, |
Array< Quantum< T > > & | q, | ||
Bool | resize | ||
) | const [private] |
Get the data without possible conversion.
Vector<String> casa::ROArrayQuantColumn< T >::getUnits | ( | ) | const |
Returns the column's units as a vector of strings.
An empty vector is returned if the column has no fixed units.
void casa::ROArrayQuantColumn< T >::init | ( | const Table & | tab, |
const String & | columnName | ||
) | [private] |
Initialize the ROArrayQuantColumn from the specified table and column.
Bool casa::ROArrayQuantColumn< T >::isNull | ( | ) | const [inline] |
Test if the object is null.
Definition at line 206 of file ArrayQuantColumn.h.
Bool casa::ROArrayQuantColumn< T >::isUnitVariable | ( | ) | const [inline] |
Test whether the Quantum column has variable units.
Definition at line 198 of file ArrayQuantColumn.h.
Array<Quantum<T> > casa::ROArrayQuantColumn< T >::operator() | ( | uInt | rownr | ) | const |
Return the quantum array stored in the specified row.
Array<Quantum<T> > casa::ROArrayQuantColumn< T >::operator() | ( | uInt | rownr, |
const Unit & | |||
) | const |
Return the quantum array stored in the specified row, converted to the given unit.
Array<Quantum<T> > casa::ROArrayQuantColumn< T >::operator() | ( | uInt | rownr, |
const Vector< Unit > & | |||
) | const |
Return the quantum array stored in the specified row, converted to the given units.
Array<Quantum<T> > casa::ROArrayQuantColumn< T >::operator() | ( | uInt | rownr, |
const Quantum< T > & | other | ||
) | const |
Return the quantum array stored in the specified row, converted to the unit in other.
ROArrayQuantColumn& casa::ROArrayQuantColumn< T >::operator= | ( | const ROArrayQuantColumn< T > & | that | ) | [private] |
Assignment makes no sense in a read only class.
Declaring this operator private makes it unusable.
Bool casa::ROArrayQuantColumn< T >::operator== | ( | const ROArrayQuantColumn< T > & | that | ) | [private] |
Comparison is not defined, since its semantics are unclear.
void casa::ROArrayQuantColumn< T >::reference | ( | const ROArrayQuantColumn< T > & | that | ) |
Make this object reference the column in "that".
const ScalarColumn<String>* casa::ROArrayQuantColumn< T >::scaUnitsCol | ( | ) | const [inline, protected] |
Definition at line 220 of file ArrayQuantColumn.h.
void casa::ROArrayQuantColumn< T >::throwIfNull | ( | ) | const |
Throw an exception if the object is null.
ArrayColumn<String>* casa::ROArrayQuantColumn< T >::itsArrUnitsCol [private] |
Reimplemented in casa::ArrayQuantColumn< T >, casa::ArrayQuantColumn< Float >, and casa::ArrayQuantColumn< Double >.
Definition at line 229 of file ArrayQuantColumn.h.
Referenced by casa::ROArrayQuantColumn< Double >::arrUnitsCol(), and casa::ROArrayQuantColumn< Double >::isUnitVariable().
Bool casa::ROArrayQuantColumn< T >::itsConvOut [private] |
Definition at line 235 of file ArrayQuantColumn.h.
ArrayColumn<T>* casa::ROArrayQuantColumn< T >::itsDataCol [private] |
Reimplemented in casa::ArrayQuantColumn< T >, casa::ArrayQuantColumn< Float >, and casa::ArrayQuantColumn< Double >.
Definition at line 227 of file ArrayQuantColumn.h.
Referenced by casa::ROArrayQuantColumn< Double >::isNull().
ScalarColumn<String>* casa::ROArrayQuantColumn< T >::itsScaUnitsCol [private] |
Reimplemented in casa::ArrayQuantColumn< T >, casa::ArrayQuantColumn< Float >, and casa::ArrayQuantColumn< Double >.
Definition at line 231 of file ArrayQuantColumn.h.
Referenced by casa::ROArrayQuantColumn< Double >::isUnitVariable(), and casa::ROArrayQuantColumn< Double >::scaUnitsCol().
Vector<Unit> casa::ROArrayQuantColumn< T >::itsUnit [protected] |
Definition at line 214 of file ArrayQuantColumn.h.
Vector<Unit> casa::ROArrayQuantColumn< T >::itsUnitOut [private] |
Definition at line 233 of file ArrayQuantColumn.h.