#include <TableColumn.h>
Inheritance diagram for casa::ROTableColumn:


Part of API
ROTableColumn gives readonly access to an arbitrary column in a table.
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.
See module Tables .
Definition at line 107 of file TableColumn.h.
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 ROTableColumn * | clone () const |
| Clone the object. | |
| void | reference (const ROTableColumn &) |
| Change the reference to another column. | |
| 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 TableRecord & | keywordSet () const |
| Get const access to the column keyword set. | |
| const ColumnDesc & | columnDesc () 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. | |
| 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 | 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. | |
| void | attach (const Table &table, const String &columnName) |
| Attach a column to the object. | |
| void | attach (const Table &table, uInt columnIndex) |
| 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, 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 |
Protected Member Functions | |
| BaseColumn * | baseColPtr () const |
| Get the baseColPtr_p of this ROTableColumn object. | |
| BaseColumn * | baseColPtr (const ROTableColumn &that) const |
| Get the baseColPtr_p of another ROTableColumn object. | |
Protected Attributes | |
| BaseTable * | baseTabPtr_p |
| BaseColumn * | baseColPtr_p |
| const ColumnCache * | colCachePtr_p |
| Bool | canChangeShape_p |
Private Member Functions | |
| ROTableColumn & | operator= (const ROTableColumn &) |
| Assignment makes no sense for a readonly class. | |
Friends | |
| class | ForwardColumn |
| 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.
Construct the object for a column in the table using its name.
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] |
| virtual ROTableColumn* casa::ROTableColumn::clone | ( | ) | const [virtual] |
Clone the object.
| void casa::ROTableColumn::reference | ( | const ROTableColumn & | ) |
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().
Attach a column to the object.
This is in fact only a shorthand for <
reference (ROTableColumn (table, columnName));
Definition at line 156 of file TableColumn.h.
References reference(), and table().
| 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.
| void casa::ROTableColumn::throwIfNull | ( | ) | const |
Throw an exception if the object is null, i.e.
if function isNull() is True.
| const TableRecord& casa::ROTableColumn::keywordSet | ( | ) | const [inline] |
Get const access to the column keyword set.
Definition at line 171 of file TableColumn.h.
References baseColPtr_p, and casa::BaseColumn::keywordSet().
| 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.\.
| Table casa::ROTableColumn::table | ( | ) | const |
Get the Table object this column belongs to.
Referenced by attach(), casa::ScalarColumn< std::complex< Float > >::attach(), casa::TableColumn::attach(), casa::ArrayColumn< std::complex< Float > >::attach(), casa::ROArrayColumn< std::complex< Float > >::attach(), and casa::ROScalarColumn< std::complex< Float > >::attach().
| uInt casa::ROTableColumn::nrow | ( | ) | const [inline] |
Get the number of rows in the column.
Definition at line 182 of file TableColumn.h.
References baseColPtr_p, and casa::BaseColumn::nrow().
| 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 188 of file TableColumn.h.
References canChangeShape_p.
| 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 194 of file TableColumn.h.
References baseColPtr_p, and casa::BaseColumn::ndimColumn().
| 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 200 of file TableColumn.h.
References baseColPtr_p, and casa::BaseColumn::shapeColumn().
Test if the given cell contains a defined value.
Definition at line 204 of file TableColumn.h.
References baseColPtr_p, casa::BaseColumn::isDefined(), and TABLECOLUMNCHECKROW.
Get the #dimensions of an array in a particular cell.
Definition at line 208 of file TableColumn.h.
References baseColPtr_p, casa::BaseColumn::ndim(), and TABLECOLUMNCHECKROW.
Get the shape of an array in a particular cell.
Definition at line 212 of file TableColumn.h.
References baseColPtr_p, casa::BaseColumn::shape(), and TABLECOLUMNCHECKROW.
Referenced by casa::SDIterAxes::shape().
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 219 of file TableColumn.h.
References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.
Definition at line 221 of file TableColumn.h.
References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.
Definition at line 223 of file TableColumn.h.
References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.
Definition at line 225 of file TableColumn.h.
References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.
Definition at line 227 of file TableColumn.h.
References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.
Definition at line 229 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 231 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 233 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 235 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 237 of file TableColumn.h.
References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.
Definition at line 239 of file TableColumn.h.
References baseColPtr_p, casa::BaseColumn::getScalar(), TABLECOLUMNCHECKROW, and casa::value().
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.
| float casa::ROTableColumn::asfloat | ( | uInt | rownr | ) | const |
| double casa::ROTableColumn::asdouble | ( | uInt | rownr | ) | const |
| Complex casa::ROTableColumn::asComplex | ( | uInt | rownr | ) | const |
| DComplex casa::ROTableColumn::asDComplex | ( | uInt | rownr | ) | const |
| 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 264 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 266 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 268 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 270 of file TableColumn.h.
References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.
Definition at line 272 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 274 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 276 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 278 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 280 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 282 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 284 of file TableColumn.h.
References baseColPtr_p, casa::BaseColumn::getScalar(), TABLECOLUMNCHECKROW, and casa::value().
| void casa::ROTableColumn::getScalarValue | ( | uInt | rownr, | |
| void * | value, | |||
| const String & | dataTypeId | |||
| ) | const [inline] |
Definition at line 286 of file TableColumn.h.
References baseColPtr_p, casa::BaseColumn::getScalar(), and TABLECOLUMNCHECKROW.
| 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 294 of file TableColumn.h.
References baseTabPtr_p, and casa::BaseTable::checkRowNumber().
| 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 298 of file TableColumn.h.
References baseColPtr_p, and casa::BaseColumn::setMaximumCacheSize().
| BaseColumn* casa::ROTableColumn::baseColPtr | ( | ) | const [inline, protected] |
Get the baseColPtr_p of this ROTableColumn object.
Definition at line 310 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 317 of file TableColumn.h.
References baseColPtr_p.
| ROTableColumn& casa::ROTableColumn::operator= | ( | const ROTableColumn & | ) | [private] |
Assignment makes no sense for a readonly class.
Declaring this operator private, makes it unusable.
friend class ForwardColumn [friend] |
Definition at line 109 of file TableColumn.h.
BaseTable* casa::ROTableColumn::baseTabPtr_p [protected] |
BaseColumn* casa::ROTableColumn::baseColPtr_p [protected] |
Definition at line 304 of file TableColumn.h.
Referenced by baseColPtr(), casa::ROArrayColumn< std::complex< Float > >::baseGet(), casa::ArrayColumn< std::complex< Float > >::basePut(), casa::ROScalarColumn< std::complex< Float > >::get(), getScalar(), getScalarValue(), isDefined(), isNull(), keywordSet(), ndim(), casa::ROArrayColumn< std::complex< Float > >::ndim(), ndimColumn(), nrow(), casa::ScalarColumn< std::complex< Float > >::put(), casa::TableColumn::putScalar(), casa::TableColumn::rwKeywordSet(), setMaximumCacheSize(), shape(), casa::ROArrayColumn< std::complex< Float > >::shape(), and shapeColumn().
const ColumnCache* casa::ROTableColumn::colCachePtr_p [protected] |
Definition at line 305 of file TableColumn.h.
Referenced by casa::ROScalarColumn< std::complex< Float > >::get().
Bool casa::ROTableColumn::canChangeShape_p [protected] |
1.5.1