casacore
|
Read and write access to an array table column with arbitrary data type. More...
#include <ArrayColumnBase.h>
Public Member Functions | |
ArrayColumnBase () | |
The default constructor creates a null object, i.e. More... | |
ArrayColumnBase (const Table &, const String &columnName) | |
Construct for the given column in the given table. More... | |
ArrayColumnBase (const TableColumn &column) | |
Construct from the given table column. More... | |
ArrayColumnBase (const ArrayColumnBase &) | |
Copy constructor (reference semantics). More... | |
~ArrayColumnBase () | |
ArrayColumnBase & | operator= (const ArrayColumnBase &) |
Assignment uses reference semantics, thus works the same as function reference. More... | |
void | reference (const ArrayColumnBase &) |
Change the reference to another column. More... | |
uInt | ndim (rownr_t rownr) const |
Get the #dimensions of an array in a particular cell. More... | |
IPosition | shape (rownr_t rownr) const |
Get the shape of an array in a particular cell. More... | |
void | baseGet (rownr_t rownr, ArrayBase &array) const |
Counterparts of the acbGet() functions below not checking shapes, etc. More... | |
void | baseGetSlice (rownr_t rownr, const Slicer &arraySection, ArrayBase &array) const |
void | acbGet (rownr_t rownr, ArrayBase &array, Bool resize) const |
Get the array value in a particular cell (i.e. More... | |
void | acbGetSlice (rownr_t rownr, const Slicer &arraySection, ArrayBase &array, Bool resize) const |
Get a slice of an N-dimensional array in a particular cell (i.e. More... | |
void | acbGetSlice (rownr_t rownr, const Vector< Vector< Slice > > &arraySlices, ArrayBase &arr, Bool resize) const |
Get an irregular slice of an N-dimensional array in a particular cell (i.e. More... | |
void | acbGetColumn (ArrayBase &array, Bool resize) const |
Get the array of all values in a column. More... | |
void | acbGetColumn (const Slicer &arraySection, ArrayBase &array, Bool resize) const |
Get regular slices from all arrays in the column. More... | |
void | acbGetColumn (const Vector< Vector< Slice > > &arraySection, ArrayBase &array, Bool resize) const |
Get irregular slices from all arrays in the column as given by the vectors of Slice objects. More... | |
void | acbGetColumnRange (const Slicer &rowRange, ArrayBase &arr, Bool resize) const |
Get the array of some values in a column. More... | |
void | acbGetColumnCells (const RefRows &rownrs, ArrayBase &arr, Bool resize) const |
void | acbGetColumnRange (const Slicer &rowRange, const Slicer &arraySection, ArrayBase &arr, Bool resize) const |
Get slices from some arrays in a column. More... | |
void | acbGetColumnCells (const RefRows &rownrs, const Slicer &arraySection, ArrayBase &arr, Bool resize) const |
void | acbGetColumnCells (const RefRows &rows, const ColumnSlicer &columnSlicer, ArrayBase &destination, Bool resize) const |
Get various slices from the given rows. More... | |
void | setShape (rownr_t rownr, const IPosition &shape) |
Set the shape of the array in the given row. More... | |
void | setShape (rownr_t rownr, const IPosition &shape, const IPosition &tileShape) |
Try to store the array in a tiled way using the given tile shape. More... | |
void | basePut (rownr_t rownr, const ArrayBase &array) |
Counterparts of the acbPut() functions below not checking shapes, etc. More... | |
void | basePutSlice (rownr_t rownr, const Slicer &arraySection, const ArrayBase &array) |
void | acbPut (rownr_t rownr, const ArrayBase &array) |
Put the array in a particular cell (i.e. More... | |
void | acbPutSlice (rownr_t rownr, const Slicer &arraySection, const ArrayBase &array) |
Put into a slice of an N-dimensional array in a particular cell. More... | |
void | acbPutSlice (rownr_t rownr, const Vector< Vector< Slice > > &arraySlices, const ArrayBase &arr) |
void | acbPutColumn (const ArrayBase &array) |
Put the array of all values in the column. More... | |
void | acbPutColumn (const Slicer &arraySection, const ArrayBase &array) |
Put into subsections of the table arrays in the entire column. More... | |
void | acbPutColumn (const Vector< Vector< Slice > > &arraySlices, const ArrayBase &arr) |
void | acbPutColumnRange (const Slicer &rowRange, const ArrayBase &arr) |
Put the array of some values in the column. More... | |
void | acbPutColumnCells (const RefRows &rownrs, const ArrayBase &arr) |
void | acbPutColumnRange (const Slicer &rowRange, const Slicer &arraySection, const ArrayBase &arr) |
Put into subsection of the table arrays in some rows of the column. More... | |
void | acbPutColumnCells (const RefRows &rownrs, const Slicer &arraySection, const ArrayBase &arr) |
void | acbPutColumnCells (const RefRows &rows, const Vector< Vector< Slice > > &arraySlices, const ArrayBase &source) |
Put various slices in the given rows. More... | |
void | acbPutColumnCells (const RefRows &rows, const ColumnSlicer &columnSlicer, const ArrayBase &source) |
void | acbFillColumn (const ArrayBase &value) |
Put the same value in all cells of the column. More... | |
void | acbPutColumn (const ArrayColumnBase &that) |
Put the contents of that column into this one. More... | |
void | adaptShape (const IPosition &shp, ArrayBase &arr, Bool resize, Int64 rownr, const String &where) const |
Adapt the shape of the array if possible. More... | |
Bool | checkShape (const IPosition &expShape, const IPosition &arrShape, Bool noSlicing, Int64 rownr, const String &where) const |
Throw an exception if the array does not have the expected shape. More... | |
void | handleSlices (const Vector< Vector< Slice > > &slices, BaseSlicesFunctor &functor, const Slicer &slicer, const ArrayBase &array) const |
A common function used by all functions that can get or put irregular array slices. More... | |
Public Member Functions inherited from casacore::TableColumn | |
TableColumn () | |
The default constructor creates a null object, i.e. More... | |
TableColumn (const Table &, const String &columnName) | |
Construct the object for a column in the table using its name. More... | |
TableColumn (const Table &, uInt columnIndex) | |
Construct the object for a column in the table using its index. More... | |
TableColumn (const TableColumn &) | |
Copy constructor (reference semantics). More... | |
virtual | ~TableColumn () |
TableColumn & | operator= (const TableColumn &) |
Assignment has reference semantics. More... | |
virtual TableColumn * | clone () const |
Clone the object. More... | |
void | reference (const TableColumn &) |
Change the reference to another column. More... | |
void | attach (const Table &table, const String &columnName) |
Attach a column to the object. More... | |
void | attach (const Table &table, uInt columnIndex) |
Bool | isNull () const |
Test if the object is null, i.e. More... | |
void | throwIfNull () const |
Throw an exception if the object is null, i.e. More... | |
Bool | isWritable () const |
Test if the column can be written to, thus if the column and the underlying table can be written to. More... | |
Bool | isWritableAtAll () const |
Test if the column is writable at all (virtual columns might not be). More... | |
void | checkWritable () const |
Check if the column is writable and throw an exception if not. More... | |
const TableRecord & | keywordSet () const |
Get readonly access to the column keyword set. More... | |
TableRecord & | rwKeywordSet () |
Get read/write access to the column keyword set. More... | |
const ColumnDesc & | columnDesc () const |
Get const access to the column description. More... | |
Table | table () const |
Get the Table object this column belongs to. More... | |
rownr_t | nrow () const |
Get the number of rows in the column. More... | |
Bool | canChangeShape () const |
Can the shape of an already existing non-FixedShape array be changed? This depends on the storage manager. More... | |
uInt | ndimColumn () const |
Get the global #dimensions of an array (ie. More... | |
IPosition | shapeColumn () const |
Get the global shape of an array (ie. More... | |
Bool | isDefined (rownr_t rownr) const |
Test if the given cell contains a defined value. More... | |
Bool | hasContent (rownr_t rownr=0) const |
Does the column has content in the given row (default is the first row)? It has if it is defined and does not contain an empty array. More... | |
uInt | ndim (rownr_t rownr) const |
Get the #dimensions of an array in a particular cell. More... | |
IPosition | shape (rownr_t rownr) const |
Get the shape of an array in a particular cell. More... | |
IPosition | tileShape (rownr_t rownr) const |
Get the tile shape of an array in a particular cell. More... | |
void | getScalar (rownr_t rownr, Bool &value) const |
Get the value of a scalar in the given row. More... | |
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. More... | |
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. More... | |
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. More... | |
virtual void | put (rownr_t thisRownr, const TableColumn &that, rownr_t thatRownr, Bool preserveTileShape=False) |
Use possibly different row numbers for that (i.e. More... | |
void | putColumn (const TableColumn &that) |
Copy the values of that column to this column. More... | |
void | putScalar (rownr_t rownr, const Bool &value) |
Put the value of a scalar in the given row. More... | |
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. More... | |
void | setMaximumCacheSize (uInt nbytes) const |
Set the maximum cache size (in bytes) to be used by a storage manager. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from casacore::TableColumn | |
BaseColumn * | baseColPtr () const |
Get the baseColPtr_p of this TableColumn object. More... | |
BaseColumn * | baseColPtr (const TableColumn &that) const |
Get the baseColPtr_p of another TableColumn object. More... | |
Protected Attributes inherited from casacore::TableColumn | |
BaseTable * | baseTabPtr_p |
BaseColumn * | baseColPtr_p |
const ColumnCache * | colCachePtr_p |
Bool | canChangeShape_p |
Bool | isColWritable_p |
Read and write access to an array table column with arbitrary data type.
Public interface
ArrayColumn<T> gives read and write access to an column in a table containing an array with data type T.
ArrayColumnBase is the base class of the templated class ArrayColumn which allows readonly access to a column containing arrays with an arbitrary data type. It can handle direct as well as indirect arrays.
All get and put functions are implemented in this base class as non-templated functions. Type-specific operations are done by means of virtual functions in the Array classes.
See module Tables.
Definition at line 83 of file ArrayColumnBase.h.
casacore::ArrayColumnBase::ArrayColumnBase | ( | ) |
The default constructor creates a null object, i.e.
it does not reference a table column.
Construct for the given column in the given table.
casacore::ArrayColumnBase::ArrayColumnBase | ( | const TableColumn & | column | ) |
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.
casacore::ArrayColumnBase::ArrayColumnBase | ( | const ArrayColumnBase & | ) |
Copy constructor (reference semantics).
casacore::ArrayColumnBase::~ArrayColumnBase | ( | ) |
void casacore::ArrayColumnBase::acbFillColumn | ( | const ArrayBase & | value | ) |
Put the same value in all cells of the column.
Get the array value in a particular cell (i.e.
table row). The row numbers count from 0 until #rows-1.
Get the array of all values in a column.
If the column contains n-dim arrays, the resulting array is (n+1)-dim with the last dimension representing the number of rows. The arrays in the column must have the same shape in all cells.
Referenced by casacore::GetColumnSlices::apply().
void casacore::ArrayColumnBase::acbGetColumn | ( | const Slicer & | arraySection, |
ArrayBase & | array, | ||
Bool | resize | ||
) | const |
Get regular slices from all arrays in the column.
If the column contains n-dim arrays, the resulting array is (n+1)-dim. with the last dimension representing the number of rows and the other dimensions representing the shape of the slice. The arrays in the column must have the same shape in all cells.
void casacore::ArrayColumnBase::acbGetColumn | ( | const Vector< Vector< Slice > > & | arraySection, |
ArrayBase & | array, | ||
Bool | resize | ||
) | const |
Get irregular slices from all arrays in the column as given by the vectors of Slice objects.
The outer vector represents the array axes. A missing or empty axis means the entire axis. The inner vector represents the slices to take for each axis. For example, to get slices from 2-dim arrays:
If the column contains n-dim arrays, the resulting array is (n+1)-dim. with the last dimension representing the number of rows and the other dimensions representing the shape of the slice. The arrays in the column must have the same shape in all cells.
void casacore::ArrayColumnBase::acbGetColumnCells | ( | const RefRows & | rownrs, |
ArrayBase & | arr, | ||
Bool | resize | ||
) | const |
void casacore::ArrayColumnBase::acbGetColumnCells | ( | const RefRows & | rownrs, |
const Slicer & | arraySection, | ||
ArrayBase & | arr, | ||
Bool | resize | ||
) | const |
void casacore::ArrayColumnBase::acbGetColumnCells | ( | const RefRows & | rows, |
const ColumnSlicer & | columnSlicer, | ||
ArrayBase & | destination, | ||
Bool | resize | ||
) | const |
Get various slices from the given rows.
void casacore::ArrayColumnBase::acbGetColumnRange | ( | const Slicer & | rowRange, |
ArrayBase & | arr, | ||
Bool | resize | ||
) | const |
Get the array of some values in a column.
The Slicer object can be used to specify start, end (or length), and stride of the rows to get. If the column contains n-dim arrays, the resulting array is (n+1)-dim with the last dimension representing the number of rows in the slicer. The arrays in the column must have the same shape in all those cells.
void casacore::ArrayColumnBase::acbGetColumnRange | ( | const Slicer & | rowRange, |
const Slicer & | arraySection, | ||
ArrayBase & | arr, | ||
Bool | resize | ||
) | const |
Get slices from some arrays in a column.
The first Slicer object can be used to specify start, end (or length), and stride of the rows to get. The second Slicer object can be used to specify the slice to take from each array. If the column contains n-dim arrays, the resulting array is (n+1)-dim with the last dimension representing the number of rows in the slicer. The arrays in the column must have the same shape in all those cells.
void casacore::ArrayColumnBase::acbGetSlice | ( | rownr_t | rownr, |
const Slicer & | arraySection, | ||
ArrayBase & | array, | ||
Bool | resize | ||
) | const |
Get a slice of an N-dimensional array in a particular cell (i.e.
table row). The row numbers count from 0 until #rows-1. The dimensionality of the slice must match the dimensionality of the table array and the slice definition should not exceed the shape of the table array.
void casacore::ArrayColumnBase::acbGetSlice | ( | rownr_t | rownr, |
const Vector< Vector< Slice > > & | arraySlices, | ||
ArrayBase & | arr, | ||
Bool | resize | ||
) | const |
Get an irregular slice of an N-dimensional array in a particular cell (i.e.
table row) as given by the vectors of Slice objects. The outer vector represents the array axes. A missing or empty axis means the entire axis. The inner vector represents the slices to take for each axis. For example, to get slices from 2-dim arrays:
If the column contains n-dim arrays, the resulting array is (n+1)-dim. with the last dimension representing the number of rows and the other dimensions representing the shape of the slice. The arrays in the column must have the same shape in all cells.
Put the array in a particular cell (i.e.
table row). The row numbers count from 0 until #rows-1. If the shape of the table array in that cell has not already been defined, it will be defined implicitly.
void casacore::ArrayColumnBase::acbPutColumn | ( | const ArrayBase & | array | ) |
Put the array of all values in the column.
If the column contains n-dim arrays, the source array must be (n+1)-dim with the last dimension representing the number of rows.
Referenced by casacore::PutColumnSlices::apply().
void casacore::ArrayColumnBase::acbPutColumn | ( | const Slicer & | arraySection, |
const ArrayBase & | array | ||
) |
Put into subsections of the table arrays in the entire column.
If the column contains n-dim arrays, the source array is (n+1)-dim with the last dimension representing the number of rows and other dimensions representing the shape of the slice. The dimensionality of the slice must match the dimensionality of the table array, thus must be n-dim. Also the slice definition should not exceed the shape of the table arrays.
void casacore::ArrayColumnBase::acbPutColumn | ( | const Vector< Vector< Slice > > & | arraySlices, |
const ArrayBase & | arr | ||
) |
void casacore::ArrayColumnBase::acbPutColumn | ( | const ArrayColumnBase & | that | ) |
Put the contents of that column into this one.
void casacore::ArrayColumnBase::acbPutColumnCells | ( | const RefRows & | rownrs, |
const Slicer & | arraySection, | ||
const ArrayBase & | arr | ||
) |
void casacore::ArrayColumnBase::acbPutColumnCells | ( | const RefRows & | rows, |
const Vector< Vector< Slice > > & | arraySlices, | ||
const ArrayBase & | source | ||
) |
Put various slices in the given rows.
void casacore::ArrayColumnBase::acbPutColumnCells | ( | const RefRows & | rows, |
const ColumnSlicer & | columnSlicer, | ||
const ArrayBase & | source | ||
) |
void casacore::ArrayColumnBase::acbPutColumnRange | ( | const Slicer & | rowRange, |
const ArrayBase & | arr | ||
) |
Put the array of some values in the column.
The Slicer object can be used to specify start, end (or length), and stride of the rows to put. If the column contains n-dim arrays, the source array must be (n+1)-dim with the last dimension representing the number of rows in the slicer.
void casacore::ArrayColumnBase::acbPutColumnRange | ( | const Slicer & | rowRange, |
const Slicer & | arraySection, | ||
const ArrayBase & | arr | ||
) |
Put into subsection of the table arrays in some rows of the column.
The first Slicer object can be used to specify start, end (or length), and stride of the rows to put. The second Slicer object can be used to specify the slice to take from each array. If the column contains n-dim arrays, the source array must be (n+1)-dim with the last dimension representing the number of rows in the slicer.
void casacore::ArrayColumnBase::acbPutSlice | ( | rownr_t | rownr, |
const Slicer & | arraySection, | ||
const ArrayBase & | array | ||
) |
Put into a slice of an N-dimensional array in a particular cell.
The row numbers count from 0 until #rows-1. The shape of the table array must have been defined. The dimensionality of the slice must match the dimensionality of the table array and the slice definition should not exceed the shape of the table array.
void casacore::ArrayColumnBase::acbPutSlice | ( | rownr_t | rownr, |
const Vector< Vector< Slice > > & | arraySlices, | ||
const ArrayBase & | arr | ||
) |
void casacore::ArrayColumnBase::adaptShape | ( | const IPosition & | shp, |
ArrayBase & | arr, | ||
Bool | resize, | ||
Int64 | rownr, | ||
const String & | where | ||
) | const |
Adapt the shape of the array if possible.
If the array is empty or if resize=True
, the array is resized if needed. Otherwise checkShape is used to throw an exception if not conforming.
Counterparts of the acbGet() functions below not checking shapes, etc.
They are faster and can be used for performance reasons if one knows for sure that the arguments are correct. E.g., they are used internally in virtual column engines.
Definition at line 132 of file ArrayColumnBase.h.
References casacore::TableColumn::baseColPtr_p, and casacore::BaseColumn::getArray().
|
inline |
Definition at line 134 of file ArrayColumnBase.h.
References casacore::TableColumn::baseColPtr_p, and casacore::BaseColumn::getSlice().
Referenced by casacore::GetCellSlices::apply().
Counterparts of the acbPut() functions below not checking shapes, etc.
They are faster and can be used for performance reasons if one knows for sure that the arguments are correct. E.g., they are used internally in virtual column engines.
Definition at line 260 of file ArrayColumnBase.h.
References casacore::TableColumn::baseColPtr_p, and casacore::BaseColumn::putArray().
|
inline |
Definition at line 262 of file ArrayColumnBase.h.
References casacore::TableColumn::baseColPtr_p, and casacore::BaseColumn::putSlice().
Referenced by casacore::PutCellSlices::apply().
Bool casacore::ArrayColumnBase::checkShape | ( | const IPosition & | expShape, |
const IPosition & | arrShape, | ||
Bool | noSlicing, | ||
Int64 | rownr, | ||
const String & | where | ||
) | const |
Throw an exception if the array does not have the expected shape.
However, False is returned if noSlicing and canChangeShape_p are True (meaning no slices are put and the shape of a full row can change). The column name is made part of the error message, as well as the rownr if it is not negative (meaning a put of a column).
void casacore::ArrayColumnBase::handleSlices | ( | const Vector< Vector< Slice > > & | slices, |
BaseSlicesFunctor & | functor, | ||
const Slicer & | slicer, | ||
const ArrayBase & | array | ||
) | const |
A common function used by all functions that can get or put irregular array slices.
The functor performs the get or put operation.
Get the #dimensions of an array in a particular cell.
If the cell does not contain an array, 0 is returned. Use the function isDefined to test if the cell contains an array.
Definition at line 118 of file ArrayColumnBase.h.
References casacore::TableColumn::baseColPtr_p, casacore::BaseColumn::ndim(), and TABLECOLUMNCHECKROW.
ArrayColumnBase& casacore::ArrayColumnBase::operator= | ( | const ArrayColumnBase & | ) |
Assignment uses reference semantics, thus works the same as function reference.
void casacore::ArrayColumnBase::reference | ( | const ArrayColumnBase & | ) |
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.
Set the shape of the array in the given row.
Setting the shape is needed if the array is put in slices, otherwise the table system would not know the shape.
void casacore::ArrayColumnBase::setShape | ( | rownr_t | rownr, |
const IPosition & | shape, | ||
const IPosition & | tileShape | ||
) |
Try to store the array in a tiled way using the given tile shape.
Get the shape of an array in a particular cell.
If the cell does not contain an array, a 0-dim shape is returned. Use the function isDefined to test if the cell contains an array.
Definition at line 124 of file ArrayColumnBase.h.
References casacore::TableColumn::baseColPtr_p, casacore::BaseColumn::shape(), and TABLECOLUMNCHECKROW.