casacore
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
casacore::ArrayQuantColumn< T > Class Template Reference

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...
 
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...
 
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< StringgetUnits () 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...
 

Protected Member Functions

const ArrayColumn< String > * arrUnitsCol () const
 Get access to itsUnitsCol. More...
 
const ScalarColumn< String > * scaUnitsCol () const
 

Protected Attributes

Vector< UnititsUnit
 

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...
 
ArrayQuantColumnoperator= (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< UnititsUnitOut
 
Bool itsConvOut
 

Detailed Description

template<class T>
class casacore::ArrayQuantColumn< T >

Provides read/write access to Array Quantum columns in Tables.

Intended use:

Public interface

Review Status

Reviewed By:
Bob Garwood
Date Reviewed:
1999/12/23
Test programs:
tTableQuantum

Prerequisite

Synopsis

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.

Quantum Units

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.

Example

(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.
ArrayQuantColumn<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;

Motivation

Add support for Quanta in the Tables system.

Thrown Exceptions

To Do

Definition at line 119 of file ArrayQuantColumn.h.

Constructor & Destructor Documentation

◆ ArrayQuantColumn() [1/5]

template<class T >
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.

◆ ArrayQuantColumn() [2/5]

template<class T >
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.

◆ ArrayQuantColumn() [3/5]

template<class T >
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).

◆ ArrayQuantColumn() [4/5]

template<class T >
casacore::ArrayQuantColumn< T >::ArrayQuantColumn ( const Table tab,
const String columnName,
const Vector< Unit > &   
)

◆ ArrayQuantColumn() [5/5]

template<class T >
casacore::ArrayQuantColumn< T >::ArrayQuantColumn ( const ArrayQuantColumn< T > &  that)

Copy constructor (copy semantics).

◆ ~ArrayQuantColumn()

template<class T >
casacore::ArrayQuantColumn< T >::~ArrayQuantColumn ( )

Member Function Documentation

◆ arrUnitsCol()

template<class T >
const ArrayColumn<String>* casacore::ArrayQuantColumn< T >::arrUnitsCol ( ) const
inlineprotected

Get access to itsUnitsCol.

Definition at line 222 of file ArrayQuantColumn.h.

References casacore::ArrayQuantColumn< T >::itsArrUnitsCol.

◆ attach() [1/3]

template<class T >
void casacore::ArrayQuantColumn< 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.

◆ attach() [2/3]

template<class T >
void casacore::ArrayQuantColumn< T >::attach ( const Table tab,
const String columnName,
const Unit  
)

◆ attach() [3/3]

template<class T >
void casacore::ArrayQuantColumn< T >::attach ( const Table tab,
const String columnName,
const Vector< Unit > &   
)

◆ cleanUp()

template<class T >
void casacore::ArrayQuantColumn< T >::cleanUp ( )
private

Deletes allocated memory etc.

Called by ~tor and any member which needs to reallocate data.

◆ get() [1/4]

template<class T >
void casacore::ArrayQuantColumn< T >::get ( rownr_t  rownr,
Array< Quantum< T > > &  q,
Bool  resize = False 
) const

Get the quantum array in the specified row.

If resize is True the resulting array is resized if its shape is not correct. Otherwise a "conformance exception" is thrown if the array is not empty and its shape mismatches.

◆ get() [2/4]

template<class T >
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.

◆ get() [3/4]

template<class T >
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.

◆ get() [4/4]

template<class T >
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.

◆ getData()

template<class T >
void casacore::ArrayQuantColumn< T >::getData ( rownr_t  rownr,
Array< Quantum< T > > &  q,
Bool  resize 
) const
private

Get the data without possible conversion.

◆ getUnits()

template<class T >
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.

◆ init()

template<class T >
void casacore::ArrayQuantColumn< T >::init ( const Table tab,
const String columnName 
)
private

Initialize the ArrayQuantColumn from the specified table and column.

◆ isNull()

template<class T >
Bool casacore::ArrayQuantColumn< T >::isNull ( ) const
inline

Test if the object is null.

Definition at line 210 of file ArrayQuantColumn.h.

References casacore::ArrayQuantColumn< T >::itsDataCol.

◆ isUnitVariable()

template<class T >
Bool casacore::ArrayQuantColumn< T >::isUnitVariable ( ) const
inline

Test whether the Quantum column has variable units.

Definition at line 202 of file ArrayQuantColumn.h.

References casacore::ArrayQuantColumn< T >::itsArrUnitsCol, and casacore::ArrayQuantColumn< T >::itsScaUnitsCol.

◆ operator()() [1/4]

template<class T >
Array<Quantum<T> > casacore::ArrayQuantColumn< T >::operator() ( rownr_t  rownr) const

Return the quantum array stored in the specified row.

◆ operator()() [2/4]

template<class T >
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.

◆ operator()() [3/4]

template<class T >
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.

◆ operator()() [4/4]

template<class T >
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.

◆ operator=()

template<class T >
ArrayQuantColumn& casacore::ArrayQuantColumn< T >::operator= ( const ArrayQuantColumn< T > &  that)
private

Assignment makes no sense in a read only class.

Declaring this operator private makes it unusable.

◆ operator==()

template<class T >
Bool casacore::ArrayQuantColumn< T >::operator== ( const ArrayQuantColumn< T > &  that)
private

Comparison is not defined, since its semantics are unclear.

◆ put()

template<class T >
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.

◆ reference()

template<class T >
void casacore::ArrayQuantColumn< T >::reference ( const ArrayQuantColumn< T > &  that)

Make this object reference the column in "that".

◆ scaUnitsCol()

template<class T >
const ScalarColumn<String>* casacore::ArrayQuantColumn< T >::scaUnitsCol ( ) const
inlineprotected

◆ throwIfNull()

template<class T >
void casacore::ArrayQuantColumn< T >::throwIfNull ( ) const

Throw an exception if the object is null.

Member Data Documentation

◆ itsArrUnitsCol

template<class T >
ArrayColumn<String>* casacore::ArrayQuantColumn< T >::itsArrUnitsCol
private

◆ itsConvOut

template<class T >
Bool casacore::ArrayQuantColumn< T >::itsConvOut
private

Definition at line 239 of file ArrayQuantColumn.h.

◆ itsDataCol

template<class T >
ArrayColumn<T>* casacore::ArrayQuantColumn< T >::itsDataCol
private

Definition at line 231 of file ArrayQuantColumn.h.

Referenced by casacore::ArrayQuantColumn< T >::isNull().

◆ itsScaUnitsCol

template<class T >
ScalarColumn<String>* casacore::ArrayQuantColumn< T >::itsScaUnitsCol
private

◆ itsUnit

template<class T >
Vector<Unit> casacore::ArrayQuantColumn< T >::itsUnit
protected

Definition at line 218 of file ArrayQuantColumn.h.

◆ itsUnitOut

template<class T >
Vector<Unit> casacore::ArrayQuantColumn< T >::itsUnitOut
private

Definition at line 237 of file ArrayQuantColumn.h.


The documentation for this class was generated from the following file: