Loading...
Searching...
No Matches
casacore::ScalarColumn< T > Class Template Reference
tables package (libcasa_tables) » Tables_module

More...

`#include <ScalarColumn.h>`

## Public Member Functions

| ScalarColumn ()
| The default constructor creates a null object, i.e.
| ScalarColumn (const Table &, const String &columnName)
| Construct for the given column in the given table.
| ScalarColumn (const TableColumn &)
| Construct from the given table column.
| ScalarColumn (const ScalarColumn< T > &)
| Copy constructor (reference semantics).
| ~ScalarColumn ()
virtual TableColumn * | clone () const
| Clone the object.
ScalarColumn< T > & | operator= (const ScalarColumn< T > &)
| Assignment uses reference semantics, thus works the same as function reference.
void | reference (const ScalarColumn< T > &)
| Change the reference to another column.
void | attach (const Table &table, const String &columnName)
| Attach a column to the object.
void | get (rownr_t rownr, T &value) const
| Get the data from a particular cell (i.e.
T | get (rownr_t rownr) const
T | operator() (rownr_t rownr) const
void | getColumn (Vector< T > &vec, Bool resize=False) const
| Get the vector of all values in the column.
Vector< T > | getColumn () const
| Get the vector of all values in the column.
void | getColumnRange (const Slicer &rowRange, Vector< T > &vec, Bool resize=False) const
| Get the vector of a range of values in the column.
Vector< T > | getColumnRange (const Slicer &rowRange) const
| Get the vector of a range of values in the column.
void | getColumnCells (const RefRows &rownrs, Vector< T > &vec, Bool resize=False) const
| Get the vector of some values in the column.
Vector< T > | getColumnCells (const RefRows &rownrs) const
| Get the vector of some values in the column.
void | put (rownr_t rownr, const T &value)
| Put the value in a particular cell (i.e.
void | put (rownr_t rownr, const ScalarColumn< T > &that)
| Copy the value of a cell of that column to a cell of this column.
void | put (rownr_t thisRownr, const ScalarColumn< T > &that, rownr_t thatRownr)
| Use possibly different row numbers for that (i.e.
void | put (rownr_t rownr, const TableColumn &that, Bool=False)
| Copy the value of a cell of that column to a cell of this column.
void | put (rownr_t thisRownr, const TableColumn &that, rownr_t thatRownr, Bool=False)
| Use possibly different row numbers for that (i.e.
void | putColumn (const Vector< T > &vec)
| Put the vector of all values in the column.
void | putColumnRange (const Slicer &rowRange, const Vector< T > &vec)
| Put the vector of a range of values in the column.
void | putColumnCells (const RefRows &rownrs, const Vector< T > &vec)
| Put the vector of some values in the column.
void | fillColumn (const T &value)
| Put the same value in all cells of the column.
void | putColumn (const ScalarColumn< T > &that)
| Put the contents of a column with the same data type into this column.
Public Member Functions inherited from casacore::TableColumn
| 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).
virtual | ~TableColumn ()
TableColumn & | operator= (const TableColumn &)
| Assignment has reference semantics.
void | reference (const TableColumn &)
| 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.
Bool | isWritable () const
| Test if the column can be written to, thus if the column and the underlying table can be written to.
Bool | isWritableAtAll () const
| Test if the column is writable at all (virtual columns might not be).
void | checkWritable () const
| Check if the column is writable and throw an exception if not.
const TableRecord & | keywordSet () const
| Get readonly access to the column keyword set.
TableRecord & | rwKeywordSet ()
| Get read/write 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.
rownr_t | 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?
uInt | ndimColumn () const
| Get the global #dimensions of an array (ie.
IPosition | shapeColumn () const
| Get the global shape of an array (ie.
Bool | isDefined (rownr_t rownr) const
| Test if the given cell contains a defined value.
Bool | hasContent (rownr_t rownr=0) const
| Does the column has content in the given row (default is the first row)?
uInt | ndim (rownr_t rownr) const
| Get the #dimensions of an array in a particular cell.
IPosition | shape (rownr_t rownr) const
| Get the shape of an array in a particular cell.
IPosition | tileShape (rownr_t rownr) const
| Get the tile shape of an array in a particular cell.
void | getScalar (rownr_t rownr, Bool &value) const
| Get the value of a scalar in the given row.
void | getScalar (rownr_t rownr, uChar &value) const
void | getScalar (rownr_t rownr, Short &value) const
void | getScalar (rownr_t rownr, uShort &value) const
void | getScalar (rownr_t rownr, Int &value) const
void | getScalar (rownr_t rownr, uInt &value) const
void | getScalar (rownr_t rownr, Int64 &value) const
void | getScalar (rownr_t rownr, float &value) const
void | getScalar (rownr_t rownr, double &value) const
void | getScalar (rownr_t rownr, Complex &value) const
void | getScalar (rownr_t rownr, DComplex &value) const
void | getScalar (rownr_t rownr, String &value) const
Bool | asBool (rownr_t rownr) const
| Get the value from the row and convert it to the required type.
uChar | asuChar (rownr_t rownr) const
Short | asShort (rownr_t rownr) const
uShort | asuShort (rownr_t rownr) const
Int | asInt (rownr_t rownr) const
uInt | asuInt (rownr_t rownr) const
Int64 | asInt64 (rownr_t rownr) const
float | asfloat (rownr_t rownr) const
double | asdouble (rownr_t rownr) const
Complex | asComplex (rownr_t rownr) const
DComplex | asDComplex (rownr_t rownr) const
String | asString (rownr_t rownr) const
void | getScalarValue (rownr_t rownr, Bool *value, const String &) const
| Get the value of a scalar in the given row.
void | getScalarValue (rownr_t rownr, uChar *value, const String &) const
void | getScalarValue (rownr_t rownr, Short *value, const String &) const
void | getScalarValue (rownr_t rownr, uShort *value, const String &) const
void | getScalarValue (rownr_t rownr, Int *value, const String &) const
void | getScalarValue (rownr_t rownr, uInt *value, const String &) const
void | getScalarValue (rownr_t rownr, Int64 *value, const String &) const
void | getScalarValue (rownr_t rownr, float *value, const String &) const
void | getScalarValue (rownr_t rownr, double *value, const String &) const
void | getScalarValue (rownr_t rownr, Complex *value, const String &) const
void | getScalarValue (rownr_t rownr, DComplex *value, const String &) const
void | getScalarValue (rownr_t rownr, String *value, const String &) const
void | getScalarValue (rownr_t rownr, void *value, const String &dataTypeId) const
void | put (rownr_t rownr, const TableColumn &that, Bool preserveTileShape=False)
| Copy the value of a cell of that column to a cell of this column.
void | putColumn (const TableColumn &that)
| Copy the values of that column to this column.
void | putScalar (rownr_t rownr, const Bool &value)
| Put the value of a scalar in the given row.
void | putScalar (rownr_t rownr, const uChar &value)
void | putScalar (rownr_t rownr, const Short &value)
void | putScalar (rownr_t rownr, const uShort &value)
void | putScalar (rownr_t rownr, const Int &value)
void | putScalar (rownr_t rownr, const uInt &value)
void | putScalar (rownr_t rownr, const Int64 &value)
void | putScalar (rownr_t rownr, const float &value)
void | putScalar (rownr_t rownr, const double &value)
void | putScalar (rownr_t rownr, const Complex &value)
void | putScalar (rownr_t rownr, const DComplex &value)
void | putScalar (rownr_t rownr, const String &value)
void | putScalar (rownr_t rownr, const Char *value)
void | checkRowNumber (rownr_t 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.

## Private Member Functions

void | checkDataType () const
| Check if the data type matches the column data type.

## Additional Inherited Members

Protected Member Functions inherited from casacore::TableColumn
BaseColumn * | baseColPtr () const
| Get the baseColPtr_p of this TableColumn object.
BaseColumn * | baseColPtr (const TableColumn &that) const
| Get the baseColPtr_p of another TableColumn object.
Protected Attributes inherited from casacore::TableColumn
BaseTable * | baseTabPtr_p
BaseColumn * | baseColPtr_p
const ColumnCache * | colCachePtr_p
Bool | canChangeShape_p
Bool | isColWritable_p

## Detailed Description

template<class T>
class casacore::ScalarColumn< T >

Access to a scalar table column with arbitrary data type

### Intended use:

Public interface

### Review Status

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

### Prerequisite

- Table
- TableColumn

### Etymology

ScalarColumn<T> gives read and write access to a column in a table containing a scalar with data type T.

### Synopsis

The class ScalarColumn allows read and write access to a column containing scalar values with an arbitrary data type. It is possible to get the data in an individual cell (i.e. table row) and to get the column as a whole.

A default constructor is defined to allow construction of an array of ScalarColumn 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.

### Example

See module Tables.

Definition at line 82 of file ScalarColumn.h.

## Constructor & Destructor Documentation

## ScalarColumn() [1/4]

template<class T>

casacore::ScalarColumn< T >::ScalarColumn | ( |  | ) |

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 ScalarColumn 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.

Referenced by attach(), operator=(), put(), put(), putColumn(), reference(), and ScalarColumn().

## ScalarColumn() [2/4]

template<class T>

casacore::ScalarColumn< T >::ScalarColumn | ( | const Table & | ,
|  | const String & | columnName )

Construct for the given column in the given table.

## ScalarColumn() [3/4]

template<class T>

casacore::ScalarColumn< T >::ScalarColumn | ( | const TableColumn & |  | ) |

explicit

Construct from the given table column.

This constructor is useful if first a table column was constructed, its type is determined and thereafter used to construct the correct column object.

References casacore::TableColumn::TableColumn().

## ScalarColumn() [4/4]

template<class T>

casacore::ScalarColumn< T >::ScalarColumn | ( | const ScalarColumn< T > & |  | ) |

Copy constructor (reference semantics).

References ScalarColumn().

## ~ScalarColumn()

template<class T>

casacore::ScalarColumn< T >::~ScalarColumn | ( |  | ) |

## Member Function Documentation

## attach()

template<class T>

void casacore::ScalarColumn< T >::attach | ( | const Table & | table,
|  | const String & | columnName )

inline

Attach a column to the object.

This is in fact only a shorthand for
reference (ScalarColumn<T> (table, columnName));

Definition at line 129 of file ScalarColumn.h.

References reference(), ScalarColumn(), and casacore::TableColumn::table().

## checkDataType()

template<class T>

void casacore::ScalarColumn< T >::checkDataType | ( |  | ) | const

private

Check if the data type matches the column data type.

## clone()

template<class T>

virtual TableColumn * casacore::ScalarColumn< T >::clone | ( |  | ) | const

virtual

Clone the object.

Reimplemented from casacore::TableColumn.

References casacore::TableColumn::TableColumn().

## fillColumn()

template<class T>

void casacore::ScalarColumn< T >::fillColumn | ( | const T & | value | ) |

Put the same value in all cells of the column.

References casacore::NewDelAllocator< T >::value.

## get() [1/2]

template<class T>

T casacore::ScalarColumn< T >::get | ( | rownr_t | rownr | ) | const

inline

Definition at line 145 of file ScalarColumn.h.

References casacore::get(), and casacore::NewDelAllocator< T >::value.

## get() [2/2]

template<class T>

void casacore::ScalarColumn< T >::get | ( | rownr_t | rownr,
|  | T & | value ) const

inline

Get the data from a particular cell (i.e.

table row). The row numbers count from 0 until #rows-1.

Definition at line 135 of file ScalarColumn.h.

References casacore::TableColumn::baseColPtr_p, casacore::TableColumn::colCachePtr_p, casacore::NewDelAllocator< T >::value, and TABLECOLUMNCHECKROW.

Referenced by casacore::areEQ().

## getColumn() [1/2]

template<class T>

Vector< T > casacore::ScalarColumn< T >::getColumn | ( |  | ) | const

Get the vector of all values in the column.

## getColumn() [2/2]

template<class T>

void casacore::ScalarColumn< T >::getColumn | ( | Vector< T > & | vec,
|  | Bool | resize = False ) const

Get the vector of all values in the column.

According to the assignment rules of class Array, the destination vector must be empty or its length must be the number of cells in the column (i.e. the number of rows in the table).

References casacore::False.

## getColumnCells() [1/2]

template<class T>

Vector< T > casacore::ScalarColumn< T >::getColumnCells | ( | const RefRows & | rownrs | ) | const

Get the vector of some values in the column.

## getColumnCells() [2/2]

template<class T>

void casacore::ScalarColumn< T >::getColumnCells | ( | const RefRows & | rownrs,
|  | Vector< T > & | vec,
|  | Bool | resize = False ) const

Get the vector of some values in the column.

The Slicer object can be used to specify start, end (or length), and stride of the rows to get. According to the assignment rules of class Array, the destination vector must be empty or its length must be the number of cells in the column (i.e. the number of rows in the RefRows object).

References casacore::False.

## getColumnRange() [1/2]

template<class T>

Vector< T > casacore::ScalarColumn< T >::getColumnRange | ( | const Slicer & | rowRange | ) | const

Get the vector of a range of values in the column.

The Slicer object can be used to specify start, end (or length), and stride of the rows to get..

## getColumnRange() [2/2]

template<class T>

void casacore::ScalarColumn< T >::getColumnRange | ( | const Slicer & | rowRange,
|  | Vector< T > & | vec,
|  | Bool | resize = False ) const

Get the vector of a range of values in the column.

The Slicer object can be used to specify start, end (or length), and stride of the rows to get. According to the assignment rules of class Array, the destination vector must be empty or its length must be the number of cells in the column (i.e. the number of rows in the slicer).

References casacore::False.

## operator()()

template<class T>

T casacore::ScalarColumn< T >::operator() | ( | rownr_t | rownr | ) | const

inline

Definition at line 151 of file ScalarColumn.h.

References casacore::get(), and casacore::NewDelAllocator< T >::value.

## operator=()

template<class T>

ScalarColumn< T > & casacore::ScalarColumn< T >::operator= | ( | const ScalarColumn< T > & |  | ) |

Assignment uses reference semantics, thus works the same as function reference.

References ScalarColumn().

## put() [1/5]

template<class T>

void casacore::ScalarColumn< T >::put | ( | rownr_t | rownr,
|  | const ScalarColumn< T > & | that )

inline

Copy the value of a cell of that column to a cell of this column.

The data types of both columns must be the same.

Use the same row numbers for both cells.

Definition at line 204 of file ScalarColumn.h.

References put(), and ScalarColumn().

## put() [2/5]

template<class T>

void casacore::ScalarColumn< T >::put | ( | rownr_t | rownr,
|  | const T & | value )

inline

Put the value in a particular cell (i.e.

table row). The row numbers count from 0 until #rows-1.

Definition at line 196 of file ScalarColumn.h.

References casacore::TableColumn::baseColPtr_p, casacore::TableColumn::checkWritable(), casacore::NewDelAllocator< T >::value, and TABLECOLUMNCHECKROW.

Referenced by put(), and put().

## put() [3/5]

template<class T>

void casacore::ScalarColumn< T >::put | ( | rownr_t | rownr,
|  | const TableColumn & | that,
|  | Bool | = False )

inline

Copy the value of a cell of that column to a cell of this column.

This function uses a generic TableColumn object as input. If possible the data will be promoted to the data type of this column. Otherwise an exception is thrown.

Use the same row numbers for both cells.

Definition at line 217 of file ScalarColumn.h.

References casacore::False, put(), and casacore::TableColumn::TableColumn().

## put() [4/5]

template<class T>

void casacore::ScalarColumn< T >::put | ( | rownr_t | thisRownr,
|  | const ScalarColumn< T > & | that,
|  | rownr_t | thatRownr )

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

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

References ScalarColumn().

## put() [5/5]

template<class T>

void casacore::ScalarColumn< T >::put | ( | rownr_t | thisRownr,
|  | const TableColumn & | that,
|  | rownr_t | thatRownr,
|  | Bool | = False )

virtual

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

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

Reimplemented from casacore::TableColumn.

References casacore::False, and casacore::TableColumn::TableColumn().

## putColumn() [1/2]

template<class T>

void casacore::ScalarColumn< T >::putColumn | ( | const ScalarColumn< T > & | that | ) |

Put the contents of a column with the same data type into this column.

To put the contents of a column with a different data type into this column, the function TableColumn::putColumn can be used (provided the data type promotion is possible). In fact, this function is an assignment operator with copy semantics.

References ScalarColumn().

## putColumn() [2/2]

template<class T>

void casacore::ScalarColumn< T >::putColumn | ( | const Vector< T > & | vec | ) |

Put the vector of all values in the column.

The length of the vector must be the number of cells in the column (i.e. the number of rows in the table).

## putColumnCells()

template<class T>

void casacore::ScalarColumn< T >::putColumnCells | ( | const RefRows & | rownrs,
|  | const Vector< T > & | vec )

Put the vector of some values in the column.

The length of the vector must be the number of cells in the RefRows object.

## putColumnRange()

template<class T>

void casacore::ScalarColumn< T >::putColumnRange | ( | const Slicer & | rowRange,
|  | const Vector< T > & | vec )

Put the vector of a range of values in the column.

The Slicer object can be used to specify start, end (or length), and stride of the rows to put. The length of the vector must be the number of cells in the slice.

## reference()

template<class T>

void casacore::ScalarColumn< T >::reference | ( | const ScalarColumn< T > & |  | ) |

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.

References ScalarColumn().

Referenced by attach().

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

- fits/FITS/CopyRecord.h
- tables/Tables/ScalarColumn.h