casa::TableColumn Class Reference
[Tables]

#include <TableColumn.h>

Inheritance diagram for casa::TableColumn:

Inheritance graph
[legend]
Collaboration diagram for casa::TableColumn:

Collaboration graph
[legend]
List of all members.

Detailed Description

Non-const access to a table column.

Intended use:

Part of API

Review Status

Reviewed By:
dschieb
Date Reviewed:
1994/08/10
Test programs:
none

Prerequisite

Synopsis

The class TableColumn augments the class ROTableColumn with write access to a table column.

The classes ScalarColumn<T> and ArrayColumn<T> can be used to put typed data in the column cells.

A default constructor is defined to allow construction of an array of TableColumn objects. However, this constructs an object not referencing a column. Functions like get, etc. will fail (i.e. result in a segmentation fault) is used on such objects. The functions isNull and throwIfNull can be used to test on this. The functions attach and reference can fill in the object.

The assignment operator is not defined for this class, because it was felt it would be too confusing. Instead the function reference can be used to do assignment with reference semantics. An assignment with copy semantics can be done with a putColumn function.

Example

See module Tables .

Definition at line 368 of file TableColumn.h.

Public Member Functions

 TableColumn ()
 The default constructor creates a null object, i.e.
 TableColumn (const Table &, const String &columnName)
 Construct the object for a column in the table using its name.
 TableColumn (const Table &, uInt columnIndex)
 Construct the object for a column in the table using its index.
 TableColumn (const TableColumn &)
 Copy constructor (reference semantics).
 ~TableColumn ()
virtual ROTableColumnclone () const
 Clone the object.
void reference (const TableColumn &)
 Change the reference to another column.
TableRecordrwKeywordSet ()
 Get access to the column keyword set.
void putColumn (const ROTableColumn &that)
 Copy the values of that column to this column.
void attach (const Table &table, const String &columnName)
 Attach a column to the object.
void attach (const Table &table, uInt columnIndex)
void put (uInt rownr, const ROTableColumn &that)
 Use the same row numbers for both cells.
virtual void put (uInt thisRownr, const ROTableColumn &that, uInt thatRownr)
 Use possibly different row numbers for that (i.e.
void putScalar (uInt rownr, const Bool &value)
 Put the value of a scalar in the given row.
void putScalar (uInt rownr, const uChar &value)
void putScalar (uInt rownr, const Short &value)
void putScalar (uInt rownr, const uShort &value)
void putScalar (uInt rownr, const Int &value)
void putScalar (uInt rownr, const uInt &value)
void putScalar (uInt rownr, const float &value)
void putScalar (uInt rownr, const double &value)
void putScalar (uInt rownr, const Complex &value)
void putScalar (uInt rownr, const DComplex &value)
void putScalar (uInt rownr, const String &value)
void putScalar (uInt rownr, const Char *value)

Private Member Functions

TableColumnoperator= (const TableColumn &)
 Assigning one column to another suggests a deep copy.


Constructor & Destructor Documentation

casa::TableColumn::TableColumn (  ) 

The default constructor creates a null object, i.e.

it does not reference a table column. The sole purpose of this constructor is to allow construction of an array of TableColumn objects. The functions reference and attach can be used to make a null object reference a column. Note that get functions, etc. will cause a segmentation fault when operating on a null object. It was felt it was too expensive to test on null over and over again. The user should use the isNull function in case of doubt.

casa::TableColumn::TableColumn ( const Table ,
const String columnName 
)

Construct the object for a column in the table using its name.

casa::TableColumn::TableColumn ( const Table ,
uInt  columnIndex 
)

Construct the object for a column in the table using its index.

This allows to loop through all columns in a table as:

           for (uInt=0; i<tab.ncolumn(); i++) {
               TableColumn tabcol(tab,i);
           }

casa::TableColumn::TableColumn ( const TableColumn  ) 

Copy constructor (reference semantics).

casa::TableColumn::~TableColumn (  ) 


Member Function Documentation

virtual ROTableColumn* casa::TableColumn::clone (  )  const [virtual]

Clone the object.

Reimplemented from casa::ROTableColumn.

void casa::TableColumn::reference ( const TableColumn  ) 

Change the reference to another column.

This is in fact an assignment operator with reference semantics. It removes the reference to the current column and creates a reference to the column referenced in the other object. It will handle null objects correctly.

Referenced by attach().

void casa::TableColumn::attach ( const Table table,
const String columnName 
) [inline]

Attach a column to the object.

This is in fact only a shorthand for
reference (TableColumn (table, columnName));

Reimplemented from casa::ROTableColumn.

Definition at line 415 of file TableColumn.h.

References reference(), and casa::ROTableColumn::table().

void casa::TableColumn::attach ( const Table table,
uInt  columnIndex 
) [inline]

Reimplemented from casa::ROTableColumn.

Definition at line 417 of file TableColumn.h.

References reference(), and casa::ROTableColumn::table().

TableRecord& casa::TableColumn::rwKeywordSet (  )  [inline]

Get access to the column keyword set.

Definition at line 422 of file TableColumn.h.

References casa::ROTableColumn::baseColPtr_p, and casa::BaseColumn::rwKeywordSet().

void casa::TableColumn::put ( uInt  rownr,
const ROTableColumn that 
) [inline]

Use the same row numbers for both cells.

Definition at line 431 of file TableColumn.h.

References TABLECOLUMNCHECKROW.

virtual void casa::TableColumn::put ( uInt  thisRownr,
const ROTableColumn that,
uInt  thatRownr 
) [virtual]

Use possibly different row numbers for that (i.e.

input) and and this (i.e. output) cell.

void casa::TableColumn::putColumn ( const ROTableColumn that  ) 

Copy the values of that column to this column.

The numbers of rows in both columns must be equal. Data type promotion is possible. An exception is thrown if the data cannot be converted. This function is useful to copy one column to another without knowing their data types. In fact, this function is an assignment operator with copy semantics.

void casa::TableColumn::putScalar ( uInt  rownr,
const Bool value 
) [inline]

Put the value of a scalar in the given row.

Data type promotion is possible. These functions only work for the standard data types.

Definition at line 452 of file TableColumn.h.

References casa::ROTableColumn::baseColPtr_p, casa::BaseColumn::putScalar(), and TABLECOLUMNCHECKROW.

Referenced by putScalar().

void casa::TableColumn::putScalar ( uInt  rownr,
const uChar value 
) [inline]

Definition at line 454 of file TableColumn.h.

References casa::ROTableColumn::baseColPtr_p, casa::BaseColumn::putScalar(), and TABLECOLUMNCHECKROW.

void casa::TableColumn::putScalar ( uInt  rownr,
const Short value 
) [inline]

Definition at line 456 of file TableColumn.h.

References casa::ROTableColumn::baseColPtr_p, casa::BaseColumn::putScalar(), and TABLECOLUMNCHECKROW.

void casa::TableColumn::putScalar ( uInt  rownr,
const uShort value 
) [inline]

Definition at line 458 of file TableColumn.h.

References casa::ROTableColumn::baseColPtr_p, casa::BaseColumn::putScalar(), and TABLECOLUMNCHECKROW.

void casa::TableColumn::putScalar ( uInt  rownr,
const Int value 
) [inline]

Definition at line 460 of file TableColumn.h.

References casa::ROTableColumn::baseColPtr_p, casa::BaseColumn::putScalar(), and TABLECOLUMNCHECKROW.

void casa::TableColumn::putScalar ( uInt  rownr,
const uInt value 
) [inline]

Definition at line 462 of file TableColumn.h.

References casa::ROTableColumn::baseColPtr_p, casa::BaseColumn::putScalar(), and TABLECOLUMNCHECKROW.

void casa::TableColumn::putScalar ( uInt  rownr,
const float &  value 
) [inline]

Definition at line 464 of file TableColumn.h.

References casa::ROTableColumn::baseColPtr_p, casa::BaseColumn::putScalar(), and TABLECOLUMNCHECKROW.

void casa::TableColumn::putScalar ( uInt  rownr,
const double &  value 
) [inline]

Definition at line 466 of file TableColumn.h.

References casa::ROTableColumn::baseColPtr_p, casa::BaseColumn::putScalar(), and TABLECOLUMNCHECKROW.

void casa::TableColumn::putScalar ( uInt  rownr,
const Complex &  value 
) [inline]

Definition at line 468 of file TableColumn.h.

References casa::ROTableColumn::baseColPtr_p, casa::BaseColumn::putScalar(), and TABLECOLUMNCHECKROW.

void casa::TableColumn::putScalar ( uInt  rownr,
const DComplex &  value 
) [inline]

Definition at line 470 of file TableColumn.h.

References casa::ROTableColumn::baseColPtr_p, casa::BaseColumn::putScalar(), and TABLECOLUMNCHECKROW.

void casa::TableColumn::putScalar ( uInt  rownr,
const String value 
) [inline]

Definition at line 472 of file TableColumn.h.

References casa::ROTableColumn::baseColPtr_p, casa::BaseColumn::putScalar(), TABLECOLUMNCHECKROW, and casa::value().

void casa::TableColumn::putScalar ( uInt  rownr,
const Char value 
) [inline]

Definition at line 474 of file TableColumn.h.

References putScalar(), and String.

TableColumn& casa::TableColumn::operator= ( const TableColumn  )  [private]

Assigning one column to another suggests a deep copy.

Because the copy constructor has reference semantics, it was felt it would be too confusing to allow assignment. Instead the function reference (with reference semantics) and putColumn (with copy semantics) exist. Declaring this operator private, makes it unusable.


The documentation for this class was generated from the following file:
Generated on Mon Sep 1 22:45:42 2008 for NRAOCASA by  doxygen 1.5.1