casa::ArrayColumn< T > Class Template Reference
[Tables]

#include <ArrayColumn.h>

Inheritance diagram for casa::ArrayColumn< T >:

Inheritance graph
[legend]
Collaboration diagram for casa::ArrayColumn< T >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<class T>
class casa::ArrayColumn< T >

Read/write access to an array table column with arbitrary data type.

Intended use:

Part of API

Review Status

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

Prerequisite

Synopsis

The class ArrayColumn allows read/write access to a column containing arrays with an arbitrary data type. It augments the class ROArrayColumn with the possibility to put data into a column (cell). It is possible to put the data in an individual cell; either the whole array or a slice of the array can be accessed. It is also possible to put the column as a whole if the arrays in all cells of the column has the same shape, which is always true for direct arrays. As in the case of individual cells it is possible to put the whole arrays or a slice of the arrays. If slices are put, the array shape must be defined in advance.

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

Template Type Argument Requirements (T)

Example

See module Tables .

Definition at line 356 of file ArrayColumn.h.

Public Member Functions

 ArrayColumn ()
 The default constructor creates a null object, i.e.
 ArrayColumn (const Table &, const String &columnName)
 Construct the array column object for the table column.
 ArrayColumn (const TableColumn &)
 Construct from the given table column.
 ArrayColumn (const ArrayColumn< T > &)
 A const ArrayColumn can only be copied as a ROArrayColumn.
 ~ArrayColumn ()
virtual ROTableColumnclone () const
 Clone the object.
void reference (const ArrayColumn< T > &)
 Change the reference to another column.
void attach (const Table &table, const String &columnName)
 Attach a column to the object.
void put (uInt rownr, const Array< T > &array)
 Put the array in a particular cell (i.e.
void putSlice (uInt rownr, const Slicer &arraySection, const Array< T > &array)
 Put into a slice of an N-dimensional array in a particular cell.
void putColumn (const Array< T > &array)
 Put the array of all values in the column.
void putColumn (const Slicer &arraySection, const Array< T > &array)
 Put into subsections of the table arrays in the entire column.
void fillColumn (const Array< T > &value)
 Put the same value in all cells of the column.
void putColumn (const ROArrayColumn< T > &that)
 Put the contents of a column with the same data type into this column.
void basePut (uInt rownr, const Array< T > &array)
 The put() function like above which does not check shapes, etc.
void setShape (uInt rownr, const IPosition &shape)
 Set the shape of the array in the given row.
void setShape (uInt rownr, const IPosition &shape, const IPosition &tileShape)
 Try to store the array in a tiled way using the given tile shape.
void put (uInt rownr, const ROArrayColumn< T > &that)
 Use the same row numbers for both cells.
void put (uInt thisRownr, const ROArrayColumn< T > &that, uInt thatRownr)
 Use possibly different row numbers for that (i.e.
void put (uInt rownr, const ROTableColumn &that)
 Use the same row numbers for both cells.
void put (uInt thisRownr, const ROTableColumn &that, uInt thatRownr)
 Use possibly different row numbers for that (i.e.
void putColumnRange (const Slicer &rowRange, const Array< T > &arr)
 Put the array of some values in the column.
void putColumnCells (const RefRows &rownrs, const Array< T > &arr)
void putColumnRange (const Slicer &rowRange, const Slicer &arraySection, const Array< T > &arr)
 Put into subsection of the table arrays in some rows of the column.
void putColumnCells (const RefRows &rownrs, const Slicer &arraySection, const Array< T > &arr)

Private Member Functions

ArrayColumn< T > & operator= (const ArrayColumn< T > &)
 Assigning one column to another suggests a deep copy.
void reference (const TableColumn &)
 Referencing any other typed column cannot be done.
void putColumn (const ROTableColumn &)
 Copy the values of that column to this column.


Constructor & Destructor Documentation

template<class T>
casa::ArrayColumn< T >::ArrayColumn (  ) 

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

template<class T>
casa::ArrayColumn< T >::ArrayColumn ( const Table ,
const String columnName 
)

Construct the array column object for the table column.

template<class T>
casa::ArrayColumn< T >::ArrayColumn ( const TableColumn  ) 

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.

template<class T>
casa::ArrayColumn< T >::ArrayColumn ( const ArrayColumn< T > &   ) 

A const ArrayColumn can only be copied as a ROArrayColumn.

template<class T>
casa::ArrayColumn< T >::~ArrayColumn (  ) 


Member Function Documentation

template<class T>
virtual ROTableColumn* casa::ArrayColumn< T >::clone (  )  const [virtual]

Clone the object.

Reimplemented from casa::ROArrayColumn< T >.

template<class T>
void casa::ArrayColumn< T >::reference ( const ArrayColumn< 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.

Referenced by casa::ArrayColumn< std::complex< Float > >::attach().

template<class T>
void casa::ArrayColumn< T >::attach ( const Table table,
const String columnName 
) [inline]

Attach a column to the object.

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

Reimplemented from casa::ROArrayColumn< T >.

Definition at line 409 of file ArrayColumn.h.

template<class T>
void casa::ArrayColumn< T >::setShape ( uInt  rownr,
const IPosition shape 
)

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.

template<class T>
void casa::ArrayColumn< T >::setShape ( uInt  rownr,
const IPosition shape,
const IPosition tileShape 
)

Try to store the array in a tiled way using the given tile shape.

template<class T>
void casa::ArrayColumn< T >::put ( uInt  rownr,
const Array< T > &  array 
)

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.

Referenced by casa::ArrayColumn< std::complex< Float > >::put().

template<class T>
void casa::ArrayColumn< T >::put ( uInt  rownr,
const ROArrayColumn< T > &  that 
) [inline]

Use the same row numbers for both cells.

Definition at line 434 of file ArrayColumn.h.

template<class T>
void casa::ArrayColumn< T >::put ( uInt  thisRownr,
const ROArrayColumn< T > &  that,
uInt  thatRownr 
)

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

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

template<class T>
void casa::ArrayColumn< T >::put ( uInt  rownr,
const ROTableColumn that 
) [inline]

Use the same row numbers for both cells.

Reimplemented from casa::TableColumn.

Definition at line 447 of file ArrayColumn.h.

template<class T>
void casa::ArrayColumn< T >::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.

Reimplemented from casa::TableColumn.

template<class T>
void casa::ArrayColumn< T >::putSlice ( uInt  rownr,
const Slicer arraySection,
const Array< T > &  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.

template<class T>
void casa::ArrayColumn< T >::putColumn ( const Array< T > &  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.

template<class T>
void casa::ArrayColumn< T >::putColumn ( const Slicer arraySection,
const Array< T > &  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.

template<class T>
void casa::ArrayColumn< T >::putColumnRange ( const Slicer rowRange,
const Array< T > &  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.

template<class T>
void casa::ArrayColumn< T >::putColumnCells ( const RefRows rownrs,
const Array< T > &  arr 
)

template<class T>
void casa::ArrayColumn< T >::putColumnRange ( const Slicer rowRange,
const Slicer arraySection,
const Array< T > &  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.

template<class T>
void casa::ArrayColumn< T >::putColumnCells ( const RefRows rownrs,
const Slicer arraySection,
const Array< T > &  arr 
)

template<class T>
void casa::ArrayColumn< T >::fillColumn ( const Array< T > &  value  ) 

Put the same value in all cells of the column.

template<class T>
void casa::ArrayColumn< T >::putColumn ( const ROArrayColumn< 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.

template<class T>
void casa::ArrayColumn< T >::basePut ( uInt  rownr,
const Array< T > &  array 
) [inline]

The put() function like above which does not check shapes, etc.

\. It is faster and can be used for performance reasons if one knows for sure that the arguments are correct. E.g. it is used internally in virtual column engines.

Definition at line 514 of file ArrayColumn.h.

template<class T>
ArrayColumn<T>& casa::ArrayColumn< T >::operator= ( const ArrayColumn< T > &   )  [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.

template<class T>
void casa::ArrayColumn< T >::reference ( const TableColumn  )  [private]

Referencing any other typed column cannot be done.

If we do not put this function here, the conversion constructor ROArrayColumn (const ROTableColumn&) will be used and no compile error is given.

Reimplemented from casa::TableColumn.

template<class T>
void casa::ArrayColumn< T >::putColumn ( const ROTableColumn  )  [private]

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.

Reimplemented from casa::TableColumn.


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