casa  $Rev:20696$
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends
casa::ROTableColumn Class Reference

Readonly access to a table column. More...

#include <TableColumn.h>

Inheritance diagram for casa::ROTableColumn:
casa::ROArrayColumn< T > casa::ROScalarColumn< T > casa::TableColumn casa::ROArrayColumn< Int > casa::ROArrayColumn< Short > casa::ROArrayColumn< StoredType > casa::ArrayColumn< T > casa::ScalarColumn< T > casa::ArrayColumn< Int > casa::ArrayColumn< Short > casa::ArrayColumn< StoredType > casa::ArrayColumn< T > casa::ScalarColumn< T > casa::ArrayColumn< Int > casa::ArrayColumn< Short > casa::ArrayColumn< StoredType >

List of all members.

Public Member Functions

 ROTableColumn ()
 The default constructor creates a null object, i.e.
 ROTableColumn (const Table &, const String &columnName)
 Construct the object for a column in the table using its name.
 ROTableColumn (const Table &, uInt columnIndex)
 Construct the object for a column in the table using its index.
 ROTableColumn (const ROTableColumn &)
 Copy constructor (reference semantics).
virtual ~ROTableColumn ()
virtual ROTableColumnclone () const
 Clone the object.
void reference (const ROTableColumn &)
 Change the reference to another column.
void attach (const Table &table, const String &columnName)
 Attach a column to the object.
void attach (const Table &table, uInt columnIndex)
Bool isNull () const
 Test if the object is null, i.e.
void throwIfNull () const
 Throw an exception if the object is null, i.e.
const TableRecordkeywordSet () const
 Get readonly access to the column keyword set.
TableRecordrwKeywordSet ()
 Get read/write access to the column keyword set.
const ColumnDesccolumnDesc () const
 Get const access to the column description.
Table table () const
 Get the Table object this column belongs to.
uInt nrow () const
 Get the number of rows in the column.
Bool canChangeShape () const
 Can the shape of an already existing non-FixedShape array be changed? This depends on the storage manager.
uInt ndimColumn () const
 Get the global #dimensions of an array (ie.
IPosition shapeColumn () const
 Get the global shape of an array (ie.
Bool isDefined (uInt rownr) const
 Test if the given cell contains a defined value.
Bool hasContent () const
 Tests whether the column is not null and that the first cell is defined and not a degenerate Array.
uInt ndim (uInt rownr) const
 Get the #dimensions of an array in a particular cell.
IPosition shape (uInt rownr) const
 Get the shape of an array in a particular cell.
void getScalar (uInt rownr, Bool &value) const
 Get the value of a scalar in the given row.
void getScalar (uInt rownr, uChar &value) const
void getScalar (uInt rownr, Short &value) const
void getScalar (uInt rownr, uShort &value) const
void getScalar (uInt rownr, Int &value) const
void getScalar (uInt rownr, uInt &value) const
void getScalar (uInt rownr, Int64 &value) const
void getScalar (uInt rownr, float &value) const
void getScalar (uInt rownr, double &value) const
void getScalar (uInt rownr, Complex &value) const
void getScalar (uInt rownr, DComplex &value) const
void getScalar (uInt rownr, String &value) const
Bool asBool (uInt rownr) const
 Get the value from the row and convert it to the required type.
uChar asuChar (uInt rownr) const
Short asShort (uInt rownr) const
uShort asuShort (uInt rownr) const
Int asInt (uInt rownr) const
uInt asuInt (uInt rownr) const
float asfloat (uInt rownr) const
double asdouble (uInt rownr) const
Complex asComplex (uInt rownr) const
DComplex asDComplex (uInt rownr) const
String asString (uInt rownr) const
void getScalarValue (uInt rownr, Bool *value, const String &) const
 Get the value of a scalar in the given row.
void getScalarValue (uInt rownr, uChar *value, const String &) const
void getScalarValue (uInt rownr, Short *value, const String &) const
void getScalarValue (uInt rownr, uShort *value, const String &) const
void getScalarValue (uInt rownr, Int *value, const String &) const
void getScalarValue (uInt rownr, uInt *value, const String &) const
void getScalarValue (uInt rownr, float *value, const String &) const
void getScalarValue (uInt rownr, double *value, const String &) const
void getScalarValue (uInt rownr, Complex *value, const String &) const
void getScalarValue (uInt rownr, DComplex *value, const String &) const
void getScalarValue (uInt rownr, String *value, const String &) const
void getScalarValue (uInt rownr, void *value, const String &dataTypeId) const
void checkRowNumber (uInt rownr) const
 Check if the row number is valid.
void setMaximumCacheSize (uInt nbytes) const
 Set the maximum cache size (in bytes) to be used by a storage manager.

Protected Member Functions

BaseColumnbaseColPtr () const
 Get the baseColPtr_p of this ROTableColumn object.
BaseColumnbaseColPtr (const ROTableColumn &that) const
 Get the baseColPtr_p of another ROTableColumn object.

Protected Attributes

BaseTablebaseTabPtr_p
BaseColumnbaseColPtr_p
const ColumnCachecolCachePtr_p
Bool canChangeShape_p

Private Member Functions

ROTableColumnoperator= (const ROTableColumn &)
 Assignment makes no sense for a readonly class.

Friends

class ForwardColumn

Detailed Description

Readonly access to a table column.

Intended use:

Public interface

Review Status

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

Prerequisite

Etymology

ROTableColumn gives readonly access to an arbitrary column in a table.

Synopsis

The class ROTableColumn gives readonly access to a column in a table. In particular access to the column description (for name, data type, etc.) and to the column keyword set can be obtained. Another important function is isDefined, which tests if a cell (i.e. table row) in a column contains a value.

The classes ROScalarColumn<T> and ROArrayColumn<T> have to be used to get the data in the column cells. However, ROTableColumn has get functions for the basic data types (Bool, uChar, Short, uSort, Int, uInt, float, double, Complex, DComplex and String). Opposite to the get functions in ROScalarColumn<T>, the ROTableColumn get functions support data type promotion.

A default constructor is defined to allow construction of an array of ROTableColumn objects. However, this constructs an object not referencing a column. Functions like get, etc. will fail (i.e. result in a segmentation fault) when 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 makes no sense for a readonly column.

Example

See module Tables .

Definition at line 107 of file TableColumn.h.


Constructor & Destructor Documentation

casa::ROTableColumn::ROTableColumn ( )

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 ROTableColumn 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 or throwIfNull function in case of doubt.

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

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

casa::ROTableColumn::ROTableColumn ( 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++) {
               ROTableColumn tabcol(tab,i);
           }
casa::ROTableColumn::ROTableColumn ( const ROTableColumn )

Copy constructor (reference semantics).

virtual casa::ROTableColumn::~ROTableColumn ( ) [virtual]

Member Function Documentation

Bool casa::ROTableColumn::asBool ( uInt  rownr) const

Get the value from the row and convert it to the required type.

This can only be used for scalar columns with a standard data type.

Complex casa::ROTableColumn::asComplex ( uInt  rownr) const
DComplex casa::ROTableColumn::asDComplex ( uInt  rownr) const
double casa::ROTableColumn::asdouble ( uInt  rownr) const
float casa::ROTableColumn::asfloat ( uInt  rownr) const
Int casa::ROTableColumn::asInt ( uInt  rownr) const
Short casa::ROTableColumn::asShort ( uInt  rownr) const
String casa::ROTableColumn::asString ( uInt  rownr) const
uChar casa::ROTableColumn::asuChar ( uInt  rownr) const
uInt casa::ROTableColumn::asuInt ( uInt  rownr) const
uShort casa::ROTableColumn::asuShort ( uInt  rownr) const
void casa::ROTableColumn::attach ( const Table table,
const String columnName 
) [inline]
void casa::ROTableColumn::attach ( const Table table,
uInt  columnIndex 
) [inline]

Reimplemented in casa::TableColumn.

Definition at line 158 of file TableColumn.h.

References reference().

BaseColumn* casa::ROTableColumn::baseColPtr ( ) const [inline, protected]

Get the baseColPtr_p of this ROTableColumn object.

Definition at line 322 of file TableColumn.h.

References baseColPtr_p.

BaseColumn* casa::ROTableColumn::baseColPtr ( const ROTableColumn that) const [inline, protected]

Get the baseColPtr_p of another ROTableColumn object.

This is needed for function put, because baseColPtr_p is a protected member of ROTableColumn. Another TableColumn has no access to that.

Definition at line 329 of file TableColumn.h.

References baseColPtr_p.

Bool casa::ROTableColumn::canChangeShape ( ) const [inline]

Can the shape of an already existing non-FixedShape array be changed? This depends on the storage manager.

Most storage managers can handle it, but TiledDataStMan and TiledColumnStMan can not.

Definition at line 192 of file TableColumn.h.

References canChangeShape_p.

void casa::ROTableColumn::checkRowNumber ( uInt  rownr) const [inline]

Check if the row number is valid.

It throws an exception if out of range.

Definition at line 306 of file TableColumn.h.

References baseTabPtr_p, and casa::BaseTable::checkRowNumber().

virtual ROTableColumn* casa::ROTableColumn::clone ( ) const [virtual]
const ColumnDesc& casa::ROTableColumn::columnDesc ( ) const

Get const access to the column description.

ColumnDesc functions have to be used to get the data type, etc.\.

void casa::ROTableColumn::getScalar ( uInt  rownr,
Bool value 
) const [inline]

Get 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 229 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalar ( uInt  rownr,
uChar value 
) const [inline]

Definition at line 231 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalar ( uInt  rownr,
Short value 
) const [inline]

Definition at line 233 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalar ( uInt  rownr,
uShort value 
) const [inline]

Definition at line 235 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalar ( uInt  rownr,
Int value 
) const [inline]

Definition at line 237 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalar ( uInt  rownr,
uInt value 
) const [inline]

Definition at line 239 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalar ( uInt  rownr,
Int64 value 
) const [inline]

Definition at line 241 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalar ( uInt  rownr,
float &  value 
) const [inline]

Definition at line 243 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalar ( uInt  rownr,
double &  value 
) const [inline]

Definition at line 245 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalar ( uInt  rownr,
Complex &  value 
) const [inline]

Definition at line 247 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalar ( uInt  rownr,
DComplex &  value 
) const [inline]

Definition at line 249 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalar ( uInt  rownr,
String value 
) const [inline]

Definition at line 251 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalarValue ( uInt  rownr,
Bool value,
const String  
) const [inline]

Get the value of a scalar in the given row.

These functions work for all data types. Data type promotion is possible for the standard data types. The functions are primarily meant for ScalarColumn<T>.

Definition at line 276 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalarValue ( uInt  rownr,
uChar value,
const String  
) const [inline]

Definition at line 278 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalarValue ( uInt  rownr,
Short value,
const String  
) const [inline]

Definition at line 280 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalarValue ( uInt  rownr,
uShort value,
const String  
) const [inline]

Definition at line 282 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalarValue ( uInt  rownr,
Int value,
const String  
) const [inline]

Definition at line 284 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalarValue ( uInt  rownr,
uInt value,
const String  
) const [inline]

Definition at line 286 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalarValue ( uInt  rownr,
float *  value,
const String  
) const [inline]

Definition at line 288 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalarValue ( uInt  rownr,
double *  value,
const String  
) const [inline]

Definition at line 290 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalarValue ( uInt  rownr,
Complex *  value,
const String  
) const [inline]

Definition at line 292 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalarValue ( uInt  rownr,
DComplex *  value,
const String  
) const [inline]

Definition at line 294 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalarValue ( uInt  rownr,
String value,
const String  
) const [inline]

Definition at line 296 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

void casa::ROTableColumn::getScalarValue ( uInt  rownr,
void *  value,
const String dataTypeId 
) const [inline]

Definition at line 298 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.

Bool casa::ROTableColumn::hasContent ( ) const

Tests whether the column is not null and that the first cell is defined and not a degenerate Array.

Bool casa::ROTableColumn::isDefined ( uInt  rownr) const [inline]

Test if the given cell contains a defined value.

Definition at line 208 of file TableColumn.h.

References baseColPtr_p, casa::BaseColumn::isDefined(), and TABLECOLUMNCHECKROW.

Bool casa::ROTableColumn::isNull ( ) const [inline]

Test if the object is null, i.e.

does not reference a column.

Definition at line 163 of file TableColumn.h.

References baseColPtr_p, casa::False, and casa::True.

Referenced by casa::TableLogSink::location(), casa::TableLogSink::message(), casa::TableLogSink::objectID(), casa::TableLogSink::priority(), and casa::TableLogSink::time().

const TableRecord& casa::ROTableColumn::keywordSet ( ) const [inline]

Get readonly access to the column keyword set.

Definition at line 171 of file TableColumn.h.

References baseColPtr_p, and casa::BaseColumn::keywordSet().

uInt casa::ROTableColumn::ndim ( uInt  rownr) const [inline]
uInt casa::ROTableColumn::ndimColumn ( ) const [inline]

Get the global #dimensions of an array (ie.

for all cells in column). This is always set for fixed shape arrays. Otherwise, 0 will be returned.

Definition at line 198 of file TableColumn.h.

References baseColPtr_p, and casa::BaseColumn::ndimColumn().

uInt casa::ROTableColumn::nrow ( ) const [inline]
ROTableColumn& casa::ROTableColumn::operator= ( const ROTableColumn ) [private]

Assignment makes no sense for a readonly class.

Declaring this operator private, makes it unusable.

void casa::ROTableColumn::reference ( const ROTableColumn )
TableRecord& casa::ROTableColumn::rwKeywordSet ( )

Get read/write access to the column keyword set.

An exception is thrown if the table is not writable.

void casa::ROTableColumn::setMaximumCacheSize ( uInt  nbytes) const [inline]

Set the maximum cache size (in bytes) to be used by a storage manager.

Definition at line 310 of file TableColumn.h.

References baseColPtr_p, and casa::BaseColumn::setMaximumCacheSize().

IPosition casa::ROTableColumn::shape ( uInt  rownr) const [inline]
IPosition casa::ROTableColumn::shapeColumn ( ) const [inline]

Get the global shape of an array (ie.

for all cells in the column). This is always set for fixed shape arrays. Otherwise, a 0-dim shape will be returned.

Definition at line 204 of file TableColumn.h.

References baseColPtr_p, and casa::BaseColumn::shapeColumn().

Table casa::ROTableColumn::table ( ) const

Get the Table object this column belongs to.

void casa::ROTableColumn::throwIfNull ( ) const

Throw an exception if the object is null, i.e.

if function isNull() is True.


Friends And Related Function Documentation

friend class ForwardColumn [friend]

Definition at line 109 of file TableColumn.h.


Member Data Documentation

Definition at line 315 of file TableColumn.h.

Referenced by checkRowNumber().

Definition at line 318 of file TableColumn.h.

Referenced by canChangeShape().

Definition at line 317 of file TableColumn.h.

Referenced by casa::ROScalarColumn< uInt >::get().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines