casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::ScalarColumnData< T > Class Template Reference

Access to a table column containing scalars. More...

#include <ScaColData.h>

Inheritance diagram for casacore::ScalarColumnData< T >:
casacore::PlainColumn casacore::BaseColumn

Public Member Functions

 ScalarColumnData (const ScalarColumnDesc< T > *, ColumnSet *)
 Construct a scalar column object from the given description in the given column set. More...
 
 ~ScalarColumnData ()
 
Bool canAccessScalarColumn (Bool &reask) const
 Ask if the data manager can handle a column. More...
 
Bool canAccessScalarColumnCells (Bool &reask) const
 Ask if the data manager can handle some cells in a column. More...
 
void initialize (uInt startRownr, uInt endRownr)
 Initialize the rows from startRownr till endRownr (inclusive) with the default value defined in the column description. More...
 
Bool isDefined (uInt rownr) const
 Test if the given cell contains a defined value. More...
 
void get (uInt rownr, void *) const
 Get the value from a particular cell. More...
 
void getScalarColumn (void *dataPtr) const
 Get the array of all values in the column. More...
 
void getScalarColumnCells (const RefRows &rownrs, void *dataPtr) const
 Get the array of some values in the column (on behalf of RefColumn). More...
 
void put (uInt rownr, const void *dataPtr)
 Put the value in a particular cell. More...
 
void putScalarColumn (const void *dataPtr)
 Put the array of all values in the column. More...
 
void putScalarColumnCells (const RefRows &rownrs, const void *dataPtr)
 Put the array of some values in the column (on behalf on RefColumn). More...
 
void makeSortKey (Sort &, CountedPtr< BaseCompare > &cmpFunc, Int order, const void *&dataSave)
 Add this column and its data to the Sort object. More...
 
void makeRefSortKey (Sort &, CountedPtr< BaseCompare > &cmpFunc, Int order, const Vector< uInt > &rownrs, const void *&dataSave)
 Do it only for the given row numbers. More...
 
void freeSortKey (const void *&dataSave)
 Free storage on the heap allocated by makeSortkey(). More...
 
void allocIterBuf (void *&lastVal, void *&curVal, CountedPtr< BaseCompare > &cmpObj)
 Allocate value buffers for the table iterator. More...
 
void freeIterBuf (void *&lastVal, void *&curVal)
 Free the value buffers allocated by allocIterBuf. More...
 
void createDataManagerColumn ()
 Create a data manager column object for this column. More...
 
- Public Member Functions inherited from casacore::PlainColumn
 PlainColumn (const BaseColumnDesc *, ColumnSet *)
 
virtual ~PlainColumn ()
 
virtual Bool isWritable () const
 Test if the column is in principle writable. More...
 
virtual Bool isStored () const
 Test if the column is stored (otherwise it is virtual). More...
 
TableRecordrwKeywordSet ()
 Get access to the column keyword set. More...
 
TableRecordkeywordSet ()
 
uInt nrow () const
 Get nr of rows in the column. More...
 
virtual void setShapeColumn (const IPosition &shape)
 Define the shape of all arrays in the column. More...
 
virtual Bool isBound () const
 Test if the column is bound to a storage manager or virtual column engine. More...
 
virtual void bind (DataManager *)
 Bind the column to a data manager. More...
 
DataManagerdataManager () const
 Get the pointer to the data manager. More...
 
DataManagerColumn *& dataManagerColumn ()
 Get the pointer to the data manager column. More...
 
virtual ColumnCachecolumnCache ()
 Get a pointer to the underlying column cache. More...
 
virtual void setMaximumCacheSize (uInt nbytes)
 Set the maximum cache size (in bytes) to be used by a storage manager. More...
 
void putFile (AipsIO &, const TableAttr &)
 Write the column. More...
 
void getFile (AipsIO &, const ColumnSet &, const TableAttr &)
 Read the column. More...
 
- Public Member Functions inherited from casacore::BaseColumn
 BaseColumn (const BaseColumnDesc *)
 Construct it using the given column description. More...
 
virtual ~BaseColumn ()
 
const ColumnDesccolumnDesc () const
 Get const access to the column description. More...
 
virtual void setShape (uInt rownr, const IPosition &shape)
 Set the shape of the array in the given row. More...
 
virtual void setShape (uInt rownr, const IPosition &shape, const IPosition &tileShape)
 Set the shape and tile shape of the array in the given row. More...
 
virtual uInt ndimColumn () const
 Get the global #dimensions of an array (ie. More...
 
virtual IPosition shapeColumn () const
 Get the global shape of an array (ie. More...
 
virtual uInt ndim (uInt rownr) const
 Get the #dimensions of an array in a particular cell. More...
 
virtual IPosition shape (uInt rownr) const
 Get the shape of an array in a particular cell. More...
 
virtual IPosition tileShape (uInt rownr) const
 Get the tile shape of an array in a particular cell. More...
 
virtual Bool canChangeShape () const
 Ask the data manager if the shape of an existing array can be changed. More...
 
virtual Bool canAccessArrayColumn (Bool &reask) const
 Ask if the data manager can handle an array column. More...
 
virtual Bool canAccessArrayColumnCells (Bool &reask) const
 Ask if the data manager can handle a collection of cells in an array column. More...
 
virtual Bool canAccessSlice (Bool &reask) const
 Ask if the data manager can handle a cell slice. More...
 
virtual Bool canAccessColumnSlice (Bool &reask) const
 Ask if the data manager can handle a column slice. More...
 
virtual void getSlice (uInt rownr, const Slicer &, void *dataPtr) const
 Get a slice of an N-dimensional array in a particular cell. More...
 
virtual void getArrayColumn (void *dataPtr) const
 Get the array of all array values in a column. More...
 
virtual void getColumnSlice (const Slicer &, void *dataPtr) const
 Get subsections from all arrays in the column. More...
 
virtual void getArrayColumnCells (const RefRows &rownrs, void *dataPtr) const
 Get the array of some array values in a column. More...
 
virtual void getColumnSliceCells (const RefRows &rownrs, const Slicer &, void *dataPtr) const
 Get subsections from some arrays in the column. More...
 
virtual void putSlice (uInt rownr, const Slicer &, const void *dataPtr)
 Put a slice of an N-dimensional array in a particular cell. More...
 
virtual void putArrayColumn (const void *dataPtr)
 Put the array of all array values in the column. More...
 
virtual void putColumnSlice (const Slicer &, const void *dataPtr)
 Put into subsections of all table arrays in the column. More...
 
virtual void putArrayColumnCells (const RefRows &rownrs, const void *dataPtr)
 Get the array of some array values in a column. More...
 
virtual void putColumnSliceCells (const RefRows &rownrs, const Slicer &, const void *dataPtr)
 Put subsections of some arrays in the column. More...
 
void getScalar (uInt rownr, Bool &value) const
 Get the value from the row and convert it to the required type. More...
 
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, Int64 &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
 
void getScalar (uInt rownr, TableRecord &value) const
 
void getScalar (uInt rownr, void *value, const String &dataTypeId) const
 Get a scalar for the other data types. More...
 
void putScalar (uInt rownr, const Bool &value)
 Put the value into the row and convert it from the given type. More...
 
void putScalar (uInt rownr, const uChar &value)
 
void putScalar (uInt rownr, const Short &value)
 
void putScalar (uInt rownr, const uShort &value)
 
void putScalar (uInt rownr, const Int &value)
 
void putScalar (uInt rownr, const uInt &value)
 
void putScalar (uInt rownr, const Int64 &value)
 
void putScalar (uInt rownr, const float &value)
 
void putScalar (uInt rownr, const double &value)
 
void putScalar (uInt rownr, const Complex &value)
 
void putScalar (uInt rownr, const DComplex &value)
 
void putScalar (uInt rownr, const String &value)
 
void putScalar (uInt rownr, const Char *value)
 
void putScalar (uInt rownr, const TableRecord &value)
 

Private Member Functions

 ScalarColumnData (const ScalarColumnData< T > &)
 Copy constructor cannot be used. More...
 
ScalarColumnData< T > & operator= (const ScalarColumnData< T > &)
 Assignment cannot be used. More...
 
void putFileDerived (AipsIO &)
 Write the column data. More...
 
void getFileDerived (AipsIO &, const ColumnSet &)
 Read the column data back. More...
 
void fillSortKey (const Vector< T > *dataPtr, Sort &, CountedPtr< BaseCompare > &cmpObj, Int order)
 Fill in the sort key on behalf of the Table sort function. More...
 

Private Attributes

const ScalarColumnDesc< T > * scaDescPtr_p
 Pointer to column description. More...
 
Bool undefFlag_p
 Undefined value can exist? More...
 
undefVal_p
 Undefined value. More...
 

Additional Inherited Members

- Protected Member Functions inherited from casacore::PlainColumn
int traceId () const
 Get the trace-id of the table. More...
 
void checkValueLength (const void *) const
 Check the length of a value. More...
 
void checkValueLength (const String *value) const
 
void checkValueLength (const Array< String > *value) const
 
void checkReadLock (Bool wait) const
 Lock the table before reading or writing. More...
 
void checkWriteLock (Bool wait) const
 
void autoReleaseLock () const
 Inspect the auto lock when the inspection interval has expired and release it when another process needs the lock. More...
 
- Protected Member Functions inherited from casacore::BaseColumn
void throwGetScalar () const
 Throw exceptions for invalid scalar get or put. More...
 
void throwPutScalar () const
 
void throwGetType (const String &type) const
 
void throwPutType (const String &type) const
 
- Protected Attributes inherited from casacore::PlainColumn
DataManagerdataManPtr_p
 
DataManagerColumndataColPtr_p
 
ColumnSetcolSetPtr_p
 
String originalName_p
 
Bool rtraceColumn_p
 
Bool wtraceColumn_p
 
- Protected Attributes inherited from casacore::BaseColumn
const BaseColumnDesccolDescPtr_p
 

Detailed Description

template<class T>
class casacore::ScalarColumnData< T >

Access to a table column containing scalars.

Intended use:

Internal

Review Status

Reviewed By:
Gareth Hunt
Date Reviewed:
94Nov17

Prerequisite

Etymology

ScalarColumnData represents a table column containing scalars.

Synopsis

The class ScalarColumnData is derived from PlainColumn. It implements the virtual functions accessing a table column containing scalars with an arbitrary data type.

It is possible to access an scalar an individual cell (i.e. table row) or in the entire column.

The main task of this class is to communicate with the data manager column object. This consists of:

The class is hidden from the user by the envelope class ScalarColumn. It used directly, it should be done with care. It assumes that the arrays in the various get and put functions have the correct length. ScalarColumn does that check.

Definition at line 95 of file ScaColData.h.

Constructor & Destructor Documentation

template<class T>
casacore::ScalarColumnData< T >::ScalarColumnData ( const ScalarColumnDesc< T > *  ,
ColumnSet  
)

Construct a scalar column object from the given description in the given column set.

This constructor is used by ScalarColumnDesc::makeColumn.

template<class T>
casacore::ScalarColumnData< T >::~ScalarColumnData ( )
template<class T>
casacore::ScalarColumnData< T >::ScalarColumnData ( const ScalarColumnData< T > &  )
private

Copy constructor cannot be used.

Member Function Documentation

template<class T>
void casacore::ScalarColumnData< T >::allocIterBuf ( void *&  lastVal,
void *&  curVal,
CountedPtr< BaseCompare > &  cmpObj 
)
virtual

Allocate value buffers for the table iterator.

Also get a comparison object if undefined. The function freeIterBuf must be called to free the buffers.

Reimplemented from casacore::BaseColumn.

template<class T>
Bool casacore::ScalarColumnData< T >::canAccessScalarColumn ( Bool reask) const
virtual

Ask if the data manager can handle a column.

Reimplemented from casacore::BaseColumn.

template<class T>
Bool casacore::ScalarColumnData< T >::canAccessScalarColumnCells ( Bool reask) const
virtual

Ask if the data manager can handle some cells in a column.

Reimplemented from casacore::BaseColumn.

template<class T>
void casacore::ScalarColumnData< T >::createDataManagerColumn ( )
virtual

Create a data manager column object for this column.

Implements casacore::PlainColumn.

template<class T>
void casacore::ScalarColumnData< T >::fillSortKey ( const Vector< T > *  dataPtr,
Sort ,
CountedPtr< BaseCompare > &  cmpObj,
Int  order 
)
private

Fill in the sort key on behalf of the Table sort function.

The pointer to the data (which can be allocated on the heap) is stored in dataPtr. This is used by freeSortKey to release it. It checks if a compare function is given when needed.

Thrown Exceptions

template<class T>
void casacore::ScalarColumnData< T >::freeIterBuf ( void *&  lastVal,
void *&  curVal 
)
virtual

Free the value buffers allocated by allocIterBuf.

Reimplemented from casacore::BaseColumn.

template<class T>
void casacore::ScalarColumnData< T >::freeSortKey ( const void *&  dataSave)
virtual

Free storage on the heap allocated by makeSortkey().

The pointer will be set to zero.

Reimplemented from casacore::BaseColumn.

template<class T>
void casacore::ScalarColumnData< T >::get ( uInt  rownr,
void *   
) const
virtual

Get the value from a particular cell.

Implements casacore::BaseColumn.

template<class T>
void casacore::ScalarColumnData< T >::getFileDerived ( AipsIO ,
const ColumnSet  
)
privatevirtual

Read the column data back.

The control information is read from the given AipsIO object. This is used to bind the column to the appropriate data manager. Thereafter the data manager gets opened.

Implements casacore::PlainColumn.

template<class T>
void casacore::ScalarColumnData< T >::getScalarColumn ( void *  dataPtr) const
virtual

Get the array of all values in the column.

The length of the buffer pointed to by dataPtr must match the actual length. This is checked by ScalarColumn.

Reimplemented from casacore::BaseColumn.

template<class T>
void casacore::ScalarColumnData< T >::getScalarColumnCells ( const RefRows rownrs,
void *  dataPtr 
) const
virtual

Get the array of some values in the column (on behalf of RefColumn).

The length of the buffer pointed to by dataPtr must match the actual length. This is checked by ScalarColumn.

Reimplemented from casacore::BaseColumn.

template<class T>
void casacore::ScalarColumnData< T >::initialize ( uInt  startRownr,
uInt  endRownr 
)
virtual

Initialize the rows from startRownr till endRownr (inclusive) with the default value defined in the column description.

Implements casacore::BaseColumn.

template<class T>
Bool casacore::ScalarColumnData< T >::isDefined ( uInt  rownr) const
virtual

Test if the given cell contains a defined value.

Implements casacore::BaseColumn.

template<class T>
void casacore::ScalarColumnData< T >::makeRefSortKey ( Sort ,
CountedPtr< BaseCompare > &  cmpFunc,
Int  order,
const Vector< uInt > &  rownrs,
const void *&  dataSave 
)
virtual

Do it only for the given row numbers.

Reimplemented from casacore::BaseColumn.

template<class T>
void casacore::ScalarColumnData< T >::makeSortKey ( Sort ,
CountedPtr< BaseCompare > &  cmpFunc,
Int  order,
const void *&  dataSave 
)
virtual

Add this column and its data to the Sort object.

It may allocate some storage on the heap, which will be saved in the argument dataSave. The function freeSortKey must be called to free this storage.

Thrown Exceptions

Reimplemented from casacore::BaseColumn.

template<class T>
ScalarColumnData<T>& casacore::ScalarColumnData< T >::operator= ( const ScalarColumnData< T > &  )
private

Assignment cannot be used.

template<class T>
void casacore::ScalarColumnData< T >::put ( uInt  rownr,
const void *  dataPtr 
)
virtual

Put the value in a particular cell.

The length of the buffer pointed to by dataPtr must match the actual length. This is checked by ScalarColumn.

Implements casacore::BaseColumn.

template<class T>
void casacore::ScalarColumnData< T >::putFileDerived ( AipsIO )
privatevirtual

Write the column data.

The control information is written into the given AipsIO object, while the data is written/flushed by the data manager.

Implements casacore::PlainColumn.

template<class T>
void casacore::ScalarColumnData< T >::putScalarColumn ( const void *  dataPtr)
virtual

Put the array of all values in the column.

The length of the buffer pointed to by dataPtr must match the actual length. This is checked by ScalarColumn.

Reimplemented from casacore::BaseColumn.

template<class T>
void casacore::ScalarColumnData< T >::putScalarColumnCells ( const RefRows rownrs,
const void *  dataPtr 
)
virtual

Put the array of some values in the column (on behalf on RefColumn).

The length of the buffer pointed to by dataPtr must match the actual length. This is checked by ScalarColumn.

Reimplemented from casacore::BaseColumn.

Member Data Documentation

template<class T>
const ScalarColumnDesc<T>* casacore::ScalarColumnData< T >::scaDescPtr_p
private

Pointer to column description.

Definition at line 181 of file ScaColData.h.

template<class T>
Bool casacore::ScalarColumnData< T >::undefFlag_p
private

Undefined value can exist?

Definition at line 183 of file ScaColData.h.

template<class T>
T casacore::ScalarColumnData< T >::undefVal_p
private

Undefined value.

Definition at line 185 of file ScaColData.h.


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