casacore
|
Provides read/write access to Array Quantum columns in Tables. More...
#include <ArrayQuantColumn.h>
Public Member Functions | |
ArrayQuantColumn () | |
The default constructor creates a null object. More... | |
ArrayQuantColumn (const Table &tab, const String &columnName) | |
Create the ArrayQuantColumn from the supplied table and column name. More... | |
ArrayQuantColumn (const Table &tab, const String &columnName, const Unit &) | |
Create the ArrayQuantColumn from the supplied table and column name. More... | |
ArrayQuantColumn (const Table &tab, const String &columnName, const Vector< Unit > &) | |
ArrayQuantColumn (const ArrayQuantColumn< T > &that) | |
Copy constructor (copy semantics). More... | |
~ArrayQuantColumn () | |
void | reference (const ArrayQuantColumn< T > &that) |
Make this object reference the column in "that". More... | |
Array< Quantum< T > > | operator() (rownr_t rownr) const |
Return the quantum array stored in the specified row. More... | |
Array< Quantum< T > > | operator() (rownr_t rownr, const Unit &) const |
Return the quantum array stored in the specified row, converted to the given unit. More... | |
Array< Quantum< T > > | operator() (rownr_t rownr, const Vector< Unit > &) const |
Return the quantum array stored in the specified row, converted to the given units. More... | |
Array< Quantum< T > > | operator() (rownr_t rownr, const Quantum< T > &other) const |
Return the quantum array stored in the specified row, converted to the unit in other. More... | |
void | put (rownr_t rownr, const Array< Quantum< T > > &q) |
Put an array of quanta into the specified row of the table. More... | |
Bool | isUnitVariable () const |
Test whether the Quantum column has variable units. More... | |
Vector< String > | getUnits () const |
Returns the column's units as a vector of strings. More... | |
Bool | isNull () const |
Test if the object is null. More... | |
void | throwIfNull () const |
Throw an exception if the object is null. More... | |
void | attach (const Table &tab, const String &columnName) |
Attach a column to the object. More... | |
void | attach (const Table &tab, const String &columnName, const Unit &) |
void | attach (const Table &tab, const String &columnName, const Vector< Unit > &) |
void | get (rownr_t rownr, Array< Quantum< T > > &q, Bool resize=False) const |
Get the quantum array in the specified row. More... | |
void | get (rownr_t rownr, Array< Quantum< T > > &q, const Unit &, Bool resize=False) const |
Get the quantum array in the specified row. More... | |
void | get (rownr_t rownr, Array< Quantum< T > > &q, const Vector< Unit > &, Bool resize=False) const |
Get the quantum array in the specified row. More... | |
void | get (rownr_t rownr, Array< Quantum< T > > &q, const Quantum< T > &other, Bool resize=False) const |
Get the quantum array in the specified row. More... | |
Protected Member Functions | |
const ArrayColumn< String > * | arrUnitsCol () const |
Get access to itsUnitsCol. More... | |
const ScalarColumn< String > * | scaUnitsCol () const |
Protected Attributes | |
Vector< Unit > | itsUnit |
Private Member Functions | |
void | init (const Table &tab, const String &columnName) |
Initialize the ArrayQuantColumn from the specified table and column. More... | |
void | cleanUp () |
Deletes allocated memory etc. More... | |
void | getData (rownr_t rownr, Array< Quantum< T > > &q, Bool resize) const |
Get the data without possible conversion. More... | |
ArrayQuantColumn & | operator= (const ArrayQuantColumn< T > &that) |
Assignment makes no sense in a read only class. More... | |
Bool | operator== (const ArrayQuantColumn< T > &that) |
Comparison is not defined, since its semantics are unclear. More... | |
Private Attributes | |
ArrayColumn< T > * | itsDataCol |
ArrayColumn< String > * | itsArrUnitsCol |
ScalarColumn< String > * | itsScaUnitsCol |
Vector< Unit > | itsUnitOut |
Bool | itsConvOut |
Provides read/write access to Array Quantum columns in Tables.
Public interface
The ArrayQuantColumn class provides read/write 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 ArrayQuantColumn object to be useful the column should contain Quanta.
The ArrayQuantColumn class is the array version of the ScalarQuantColumn 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 ArrayQuantColumn 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).
Add support for Quanta in the Tables system.
Quantum<Array<T>>
. Definition at line 119 of file ArrayQuantColumn.h.
casacore::ArrayQuantColumn< T >::ArrayQuantColumn | ( | ) |
The default constructor creates a null object.
It is useful for creating arrays of ArrayQuantColumn 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 ArrayQuantColumn object is null.
casacore::ArrayQuantColumn< T >::ArrayQuantColumn | ( | const Table & | tab, |
const String & | columnName | ||
) |
Create the ArrayQuantColumn from the supplied table and column name.
The default unit for data retrieved is the unit in which they were stored.
casacore::ArrayQuantColumn< T >::ArrayQuantColumn | ( | const Table & | tab, |
const String & | columnName, | ||
const Unit & | |||
) |
Create the ArrayQuantColumn from the supplied table and column name.
The default unit for data retrieved is the given unit (the data is converted as needed).
casacore::ArrayQuantColumn< T >::ArrayQuantColumn | ( | const Table & | tab, |
const String & | columnName, | ||
const Vector< Unit > & | |||
) |
casacore::ArrayQuantColumn< T >::ArrayQuantColumn | ( | const ArrayQuantColumn< T > & | that | ) |
Copy constructor (copy semantics).
casacore::ArrayQuantColumn< T >::~ArrayQuantColumn | ( | ) |
|
inlineprotected |
Get access to itsUnitsCol.
Definition at line 222 of file ArrayQuantColumn.h.
void casacore::ArrayQuantColumn< T >::attach | ( | const Table & | tab, |
const String & | columnName | ||
) |
void casacore::ArrayQuantColumn< T >::attach | ( | const Table & | tab, |
const String & | columnName, | ||
const Unit & | |||
) |
void casacore::ArrayQuantColumn< T >::attach | ( | const Table & | tab, |
const String & | columnName, | ||
const Vector< Unit > & | |||
) |
|
private |
Deletes allocated memory etc.
Called by ~tor and any member which needs to reallocate data.
void casacore::ArrayQuantColumn< T >::get | ( | rownr_t | 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 casacore::ArrayQuantColumn< T >::get | ( | rownr_t | 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 casacore::ArrayQuantColumn< T >::get | ( | rownr_t | 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.
|
private |
Get the data without possible conversion.
Vector<String> casacore::ArrayQuantColumn< 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.
|
private |
Initialize the ArrayQuantColumn from the specified table and column.
|
inline |
Test if the object is null.
Definition at line 210 of file ArrayQuantColumn.h.
|
inline |
Test whether the Quantum column has variable units.
Definition at line 202 of file ArrayQuantColumn.h.
Array<Quantum<T> > casacore::ArrayQuantColumn< T >::operator() | ( | rownr_t | rownr | ) | const |
Return the quantum array stored in the specified row.
Array<Quantum<T> > casacore::ArrayQuantColumn< T >::operator() | ( | rownr_t | rownr, |
const Unit & | |||
) | const |
Return the quantum array stored in the specified row, converted to the given unit.
Array<Quantum<T> > casacore::ArrayQuantColumn< T >::operator() | ( | rownr_t | rownr, |
const Vector< Unit > & | |||
) | const |
Return the quantum array stored in the specified row, converted to the given units.
Array<Quantum<T> > casacore::ArrayQuantColumn< T >::operator() | ( | rownr_t | rownr, |
const Quantum< T > & | other | ||
) | const |
Return the quantum array stored in the specified row, converted to the unit in other.
|
private |
Assignment makes no sense in a read only class.
Declaring this operator private makes it unusable.
|
private |
Comparison is not defined, since its semantics are unclear.
void casacore::ArrayQuantColumn< T >::put | ( | rownr_t | rownr, |
const Array< Quantum< T > > & | q | ||
) |
Put an array of quanta into the specified row of the table.
If the column supports variable units, the units are stored as well. Otherwise the quanta are converted to the column's units.
void casacore::ArrayQuantColumn< T >::reference | ( | const ArrayQuantColumn< T > & | that | ) |
Make this object reference the column in "that".
|
inlineprotected |
Definition at line 224 of file ArrayQuantColumn.h.
void casacore::ArrayQuantColumn< T >::throwIfNull | ( | ) | const |
Throw an exception if the object is null.
|
private |
Definition at line 233 of file ArrayQuantColumn.h.
Referenced by casacore::ArrayQuantColumn< Double >::arrUnitsCol(), and casacore::ArrayQuantColumn< Double >::isUnitVariable().
|
private |
Definition at line 239 of file ArrayQuantColumn.h.
|
private |
Definition at line 231 of file ArrayQuantColumn.h.
Referenced by casacore::ArrayQuantColumn< Double >::isNull().
|
private |
Definition at line 235 of file ArrayQuantColumn.h.
Referenced by casacore::ArrayQuantColumn< Double >::isUnitVariable(), and casacore::ArrayQuantColumn< Double >::scaUnitsCol().
|
protected |
Definition at line 218 of file ArrayQuantColumn.h.
|
private |
Definition at line 237 of file ArrayQuantColumn.h.