casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Member Functions | Private Attributes
casa::ArrayQuantColumn< T > Class Template Reference

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

#include <ArrayQuantColumn.h>

Inheritance diagram for casa::ArrayQuantColumn< T >:
casa::ROArrayQuantColumn< T >

List of all members.

Public Member Functions

 ArrayQuantColumn ()
 The default constructor creates a null object.
 ArrayQuantColumn (const Table &tab, const String &columnName)
 Create the ArrayQuantColumn from the supplied table and column name.
 ArrayQuantColumn (const ArrayQuantColumn< T > &that)
 Copy constructor (copy semantics).
 ~ArrayQuantColumn ()
void reference (const ArrayQuantColumn< T > &that)
 Make this object reference the column in "that".
void put (uInt rownr, const Array< Quantum< T > > &q)
 Put an array of quanta into the specified row of the table.
void attach (const Table &tab, const String &columnName)
 Attach a column to the object.

Private Member Functions

ArrayQuantColumnoperator= (const ArrayQuantColumn< T > &that)
 reference() can be used for assignment.
Bool operator== (const ArrayQuantColumn< T > &that)
 Comparison is not defined, since its semantics are unclear.
void cleanUp ()
 Deletes allocated memory etc.

Private Attributes

ArrayColumn< T > * itsDataCol
 
    

ArrayColumn< String > * itsArrUnitsCol
ScalarColumn< String > * itsScaUnitsCol

Detailed Description

template<class T>
class casa::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 Quantum Table column. The column should previously have been defined as a Quantum column by means of the TableQuantumDesc object. In addition to the operations provided by its read-only partner, ROArrayQuantColumn , use of a ArrayQuantColumn object allows the insertion of Quanta into a column.

Quantum Units

The underlying Quantum column will have been defined to have either variable or fixed Units. A variable unit can be variable per row (thus the same for an entire array in that row) or it can be variable per array element. If the Quantum column's Unit is fixed then writing quanta converts the data to that unit. If the column's unit is variable, the data is written unconverted and the unit is written into the unit column defined in the TableQuantumDesc object.
See TableQuantumDesc for more details.

Example

(See TableQuantumDesc class for an example of how to define a Quantum column).

       // This creates the Quantum array object.
       ArrayQuantColumn<Double> aqCol(qtab, "ArrQuantDouble");
   
       // Test if the column has variable of fixed units
       if (aqCol.isUnitVariable()) {
           cout << "Quantum column supports variable units!" << endl;
       } else {
           cout << "Unit for the column is: ", << aqCol.getUnits() << endl;
       }
   
       // need an array of Quanta.
       IPosition shape(2, 3, 2);
       Array<Quantum<Double> > qArr(shape);
       Bool deleteIt;
       Quantum<Double>* q_p = qArr.getStorage(deleteIt);
       q_p->setValue(1.41212);
       q_p->setUnit("GHz");
       q_p++;
       q_p->setValue(1.4921);
       q_p->setUnit("deg");
       q_p++;
       q_p->setValue(1.4111);
       q_p->setUnit("ms-1");
       q_p++;
       q_p->setValue(1.4003);
       q_p->setUnit("Jy");
       q_p++;
       q_p->setValue(1.22);
       q_p->setUnit("GHz");
       q_p++;
       q_p->setValue(1.090909);
       q_p->setUnit("g");       
       qArr.putStorage(q_p, deleteIt);
        
       // put the quantum array in the column at row 0.  If the column has
       // fixed units the Unit component of each quantum will be lost.  Just
       // their values will be stored.
       aqCol.put(0, qArr);

Motivation

Add support for Quanta in the Tables system.

Thrown Exceptions

To Do

Definition at line 357 of file ArrayQuantColumn.h.


Constructor & Destructor Documentation

template<class T>
casa::ArrayQuantColumn< T >::ArrayQuantColumn ( )

The default constructor creates a null object.

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.

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

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

Copy constructor (copy semantics).

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

Member Function Documentation

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

Attach a column to the object.

Reimplemented from casa::ROArrayQuantColumn< T >.

template<class T>
void casa::ArrayQuantColumn< T >::cleanUp ( ) [private]

Deletes allocated memory etc.

Called by destructor and any member which needs to reallocate data.

Reimplemented from casa::ROArrayQuantColumn< T >.

template<class T>
ArrayQuantColumn& casa::ArrayQuantColumn< T >::operator= ( const ArrayQuantColumn< T > &  that) [private]

reference() can be used for assignment.

Declaring this operator private makes it unusable.

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

Comparison is not defined, since its semantics are unclear.

template<class T>
void casa::ArrayQuantColumn< T >::put ( uInt  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.

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

Make this object reference the column in "that".


Member Data Documentation

template<class T>
ArrayColumn<String>* casa::ArrayQuantColumn< T >::itsArrUnitsCol [private]

Reimplemented from casa::ROArrayQuantColumn< T >.

Definition at line 394 of file ArrayQuantColumn.h.

template<class T>
ArrayColumn<T>* casa::ArrayQuantColumn< T >::itsDataCol [private]

    

Reimplemented from casa::ROArrayQuantColumn< T >.

Definition at line 392 of file ArrayQuantColumn.h.

template<class T>
ScalarColumn<String>* casa::ArrayQuantColumn< T >::itsScaUnitsCol [private]

Reimplemented from casa::ROArrayQuantColumn< T >.

Definition at line 396 of file ArrayQuantColumn.h.


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