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

#include <ArrayColumn.h>

Inheritance diagram for casa::ROArrayColumn< T >:

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

Collaboration graph
[legend]
List of all members.

Detailed Description

template<class T>
class casa::ROArrayColumn< T >

Readonly 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

Etymology

ROArrayColumn<T> gives readonly access to an column in a table containing an array with data type T.

Synopsis

The class ROArrayColumn allows readonly access to a column containing arrays with an arbitrary data type. It can handle direct as well as indirect arrays. It is possible to get the data in an individual cell (i.e. table row); either the whole array or a slice of the array can be accessed. It is also possible to get the column as a whole if the arrays in all cells of the column have the same shape (which is always true for direct arrays). As in the case of individual cells it is possible to get the entire arrays or a slice of the arrays.

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

Template Type Argument Requirements (T)

Example

See module Tables .

Definition at line 101 of file ArrayColumn.h.

Public Member Functions

 ROArrayColumn ()
 The default constructor creates a null object, i.e.
 ROArrayColumn (const Table &, const String &columnName)
 Construct for the given column in the given table.
 ROArrayColumn (const ROTableColumn &)
 Construct from the given table column.
 ROArrayColumn (const ROArrayColumn< T > &)
 Copy constructor (reference semantics).
 ~ROArrayColumn ()
virtual ROTableColumnclone () const
 Clone the object.
void reference (const ROArrayColumn< T > &)
 Change the reference to another column.
void attach (const Table &table, const String &columnName)
 Attach a column to the object.
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 baseGet (uInt rownr, Array< T > &array) const
 The get() function like above which does not check shapes, etc.
void get (uInt rownr, Array< T > &array, Bool resize=False) const
 According to the assignment rules of class Array, the destination array must be empty or its shape must conform the table array shape.
Array< T > operator() (uInt rownr) const
void getSlice (uInt rownr, const Slicer &arraySection, Array< T > &array, Bool resize=False) const
 According to the assignment rules of class Array, the destination array must be empty or its shape must conform the shape of the table array slice.
Array< T > getSlice (uInt rownr, const Slicer &arraySection) const
void getColumn (Array< T > &array, Bool resize=False) const
 According to the assignment rules of class Array, the destination array must be empty or its shape must conform the resulting (n+1)-dim array.
Array< T > getColumn () const
void getColumn (const Slicer &arraySection, Array< T > &array, Bool resize=False) const
 According to the assignment rules of class Array, the destination array must be empty or its shape must conform the resulting (n+1)-dim array.
Array< T > getColumn (const Slicer &arraySection) const
void getColumnRange (const Slicer &rowRange, Array< T > &arr, Bool resize=False) const
 Get the array of some values in a column.
Array< T > getColumnRange (const Slicer &rowRange) const
void getColumnCells (const RefRows &rownrs, Array< T > &arr, Bool resize=False) const
Array< T > getColumnCells (const RefRows &rownrs) const
void getColumnRange (const Slicer &rowRange, const Slicer &arraySection, Array< T > &arr, Bool resize=False) const
 Get slices from some arrays in a column.
Array< T > getColumnRange (const Slicer &rowRange, const Slicer &arraySection) const
void getColumnCells (const RefRows &rownrs, const Slicer &arraySection, Array< T > &arr, Bool resize=False) const
Array< T > getColumnCells (const RefRows &rownrs, const Slicer &arraySection) const

Protected Attributes

BoolcanAccessSlice_p
 Keep switches to determine if a slice or an entire column can be accessed or the change of an array can be changed.
BoolcanAccessColumn_p
BoolcanAccessColumnSlice_p
BoolreaskAccessSlice_p
 Keep switches to know if access knowledge is permanent or has to be asked again the next time.
BoolreaskAccessColumn_p
BoolreaskAccessColumnSlice_p

Private Member Functions

ROArrayColumn< T > & operator= (const ROArrayColumn< T > &)
 Assignment makes no sense for a readonly class.
void reference (const ROTableColumn &)
 Referencing any other typed column cannot be done.
void checkDataType () const
 Check if the data type matches the column data type.


Constructor & Destructor Documentation

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

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 ROArrayColumn 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::ROArrayColumn< T >::ROArrayColumn ( const Table ,
const String columnName 
)

Construct for the given column in the given table.

template<class T>
casa::ROArrayColumn< T >::ROArrayColumn ( const ROTableColumn  ) 

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::ROArrayColumn< T >::ROArrayColumn ( const ROArrayColumn< T > &   ) 

Copy constructor (reference semantics).

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


Member Function Documentation

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

Clone the object.

Reimplemented from casa::ROTableColumn.

template<class T>
void casa::ROArrayColumn< T >::reference ( const ROArrayColumn< 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::ROArrayColumn< std::complex< Float > >::attach().

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

Attach a column to the object.

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

Reimplemented from casa::ROTableColumn.

Definition at line 144 of file ArrayColumn.h.

template<class T>
uInt casa::ROArrayColumn< T >::ndim ( uInt  rownr  )  const [inline]

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.

Reimplemented from casa::ROTableColumn.

Definition at line 150 of file ArrayColumn.h.

template<class T>
IPosition casa::ROArrayColumn< T >::shape ( uInt  rownr  )  const [inline]

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.

Reimplemented from casa::ROTableColumn.

Definition at line 156 of file ArrayColumn.h.

template<class T>
void casa::ROArrayColumn< T >::get ( uInt  rownr,
Array< T > &  array,
Bool  resize = False 
) const

According to the assignment rules of class Array, the destination array must be empty or its shape must conform the table array shape.

However, if the resize flag is set the destination array will be resized if not conforming.

template<class T>
Array<T> casa::ROArrayColumn< T >::operator() ( uInt  rownr  )  const

template<class T>
void casa::ROArrayColumn< T >::getSlice ( uInt  rownr,
const Slicer arraySection,
Array< T > &  array,
Bool  resize = False 
) const

According to the assignment rules of class Array, the destination array must be empty or its shape must conform the shape of the table array slice.

However, if the resize flag is set the destination array will be resized if not conforming.

template<class T>
Array<T> casa::ROArrayColumn< T >::getSlice ( uInt  rownr,
const Slicer arraySection 
) const

template<class T>
void casa::ROArrayColumn< T >::getColumn ( Array< T > &  array,
Bool  resize = False 
) const

According to the assignment rules of class Array, the destination array must be empty or its shape must conform the resulting (n+1)-dim array.

However, if the resize flag is set the destination array will be resized if not conforming.

template<class T>
Array<T> casa::ROArrayColumn< T >::getColumn (  )  const

template<class T>
void casa::ROArrayColumn< T >::getColumn ( const Slicer arraySection,
Array< T > &  array,
Bool  resize = False 
) const

According to the assignment rules of class Array, the destination array must be empty or its shape must conform the resulting (n+1)-dim array.

However, if the resize flag is set the destination array will be resized if not conforming.

template<class T>
Array<T> casa::ROArrayColumn< T >::getColumn ( const Slicer arraySection  )  const

template<class T>
void casa::ROArrayColumn< T >::getColumnRange ( const Slicer rowRange,
Array< T > &  arr,
Bool  resize = False 
) 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. According to the assignment rules of class Array, the destination array must be empty or its shape must conform the resulting (n+1)-dim array. However, if the resize flag is set the destination array will be resized if not conforming.

template<class T>
Array<T> casa::ROArrayColumn< T >::getColumnRange ( const Slicer rowRange  )  const

template<class T>
void casa::ROArrayColumn< T >::getColumnCells ( const RefRows rownrs,
Array< T > &  arr,
Bool  resize = False 
) const

template<class T>
Array<T> casa::ROArrayColumn< T >::getColumnCells ( const RefRows rownrs  )  const

template<class T>
void casa::ROArrayColumn< T >::getColumnRange ( const Slicer rowRange,
const Slicer arraySection,
Array< T > &  arr,
Bool  resize = False 
) 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. According to the assignment rules of class Array, the destination array must be empty or its shape must conform the resulting (n+1)-dim array. However, if the resize flag is set the destination array will be resized if not conforming.

template<class T>
Array<T> casa::ROArrayColumn< T >::getColumnRange ( const Slicer rowRange,
const Slicer arraySection 
) const

template<class T>
void casa::ROArrayColumn< T >::getColumnCells ( const RefRows rownrs,
const Slicer arraySection,
Array< T > &  arr,
Bool  resize = False 
) const

template<class T>
Array<T> casa::ROArrayColumn< T >::getColumnCells ( const RefRows rownrs,
const Slicer arraySection 
) const

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

The get() 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 266 of file ArrayColumn.h.

template<class T>
ROArrayColumn<T>& casa::ROArrayColumn< T >::operator= ( const ROArrayColumn< T > &   )  [private]

Assignment makes no sense for a readonly class.

Declaring this operator private, makes it unusable.

template<class T>
void casa::ROArrayColumn< T >::reference ( const ROTableColumn  )  [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::ROTableColumn.

template<class T>
void casa::ROArrayColumn< T >::checkDataType (  )  const [private]

Check if the data type matches the column data type.


Member Data Documentation

template<class T>
Bool* casa::ROArrayColumn< T >::canAccessSlice_p [protected]

Keep switches to determine if a slice or an entire column can be accessed or the change of an array can be changed.

All switches are Bool*, because they can be changed in a const function. True = yes; False = no.

Definition at line 288 of file ArrayColumn.h.

template<class T>
Bool* casa::ROArrayColumn< T >::canAccessColumn_p [protected]

Definition at line 289 of file ArrayColumn.h.

template<class T>
Bool* casa::ROArrayColumn< T >::canAccessColumnSlice_p [protected]

Definition at line 290 of file ArrayColumn.h.

template<class T>
Bool* casa::ROArrayColumn< T >::reaskAccessSlice_p [protected]

Keep switches to know if access knowledge is permanent or has to be asked again the next time.

Definition at line 293 of file ArrayColumn.h.

template<class T>
Bool* casa::ROArrayColumn< T >::reaskAccessColumn_p [protected]

Definition at line 294 of file ArrayColumn.h.

template<class T>
Bool* casa::ROArrayColumn< T >::reaskAccessColumnSlice_p [protected]

Definition at line 295 of file ArrayColumn.h.


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