casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
casa::MSMColumn Class Reference

Column in the Memory table storage manager class. More...

#include <MSMColumn.h>

Inheritance diagram for casa::MSMColumn:
casa::StManColumn casa::DataManagerColumn casa::MSMDirColumn casa::MSMIndColumn

List of all members.

Public Member Functions

 MSMColumn (MSMBase *smptr, int dataType, Bool byPtr)
 Create a column of the given type.
virtual ~MSMColumn ()
 Frees up the storage.
void getBoolV (uInt rownr, Bool *dataPtr)
 Get a scalar value in the given row.
void getuCharV (uInt rownr, uChar *dataPtr)
void getShortV (uInt rownr, Short *dataPtr)
void getuShortV (uInt rownr, uShort *dataPtr)
void getIntV (uInt rownr, Int *dataPtr)
void getuIntV (uInt rownr, uInt *dataPtr)
void getfloatV (uInt rownr, float *dataPtr)
void getdoubleV (uInt rownr, double *dataPtr)
void getComplexV (uInt rownr, Complex *dataPtr)
void getDComplexV (uInt rownr, DComplex *dataPtr)
void getStringV (uInt rownr, String *dataPtr)
void putBoolV (uInt rownr, const Bool *dataPtr)
 Put a scalar value into the given row.
void putuCharV (uInt rownr, const uChar *dataPtr)
void putShortV (uInt rownr, const Short *dataPtr)
void putuShortV (uInt rownr, const uShort *dataPtr)
void putIntV (uInt rownr, const Int *dataPtr)
void putuIntV (uInt rownr, const uInt *dataPtr)
void putfloatV (uInt rownr, const float *dataPtr)
void putdoubleV (uInt rownr, const double *dataPtr)
void putComplexV (uInt rownr, const Complex *dataPtr)
void putDComplexV (uInt rownr, const DComplex *dataPtr)
void putStringV (uInt rownr, const String *dataPtr)
uInt getBlockBoolV (uInt rownr, uInt nrmax, Bool *dataPtr)
 Get scalars from the given row on with a maximum of nrmax values.
uInt getBlockuCharV (uInt rownr, uInt nrmax, uChar *dataPtr)
uInt getBlockShortV (uInt rownr, uInt nrmax, Short *dataPtr)
uInt getBlockuShortV (uInt rownr, uInt nrmax, uShort *dataPtr)
uInt getBlockIntV (uInt rownr, uInt nrmax, Int *dataPtr)
uInt getBlockuIntV (uInt rownr, uInt nrmax, uInt *dataPtr)
uInt getBlockfloatV (uInt rownr, uInt nrmax, float *dataPtr)
uInt getBlockdoubleV (uInt rownr, uInt nrmax, double *dataPtr)
uInt getBlockComplexV (uInt rownr, uInt nrmax, Complex *dataPtr)
uInt getBlockDComplexV (uInt rownr, uInt nrmax, DComplex *dataPtr)
uInt getBlockStringV (uInt rownr, uInt nrmax, String *dataPtr)
void putBlockBoolV (uInt rownr, uInt nrmax, const Bool *dataPtr)
 Put nrmax scalars from the given row on.
void putBlockuCharV (uInt rownr, uInt nrmax, const uChar *dataPtr)
void putBlockShortV (uInt rownr, uInt nrmax, const Short *dataPtr)
void putBlockuShortV (uInt rownr, uInt nrmax, const uShort *dataPtr)
void putBlockIntV (uInt rownr, uInt nrmax, const Int *dataPtr)
void putBlockuIntV (uInt rownr, uInt nrmax, const uInt *dataPtr)
void putBlockfloatV (uInt rownr, uInt nrmax, const float *dataPtr)
void putBlockdoubleV (uInt rownr, uInt nrmax, const double *dataPtr)
void putBlockComplexV (uInt rownr, uInt nrmax, const Complex *dataPtr)
void putBlockDComplexV (uInt rownr, uInt nrmax, const DComplex *dataPtr)
void putBlockStringV (uInt rownr, uInt nrmax, const String *dataPtr)
virtual void getScalarColumnCellsBoolV (const RefRows &rownrs, Vector< Bool > *dataPtr)
 Get the scalar values in some cells of the column.
virtual void getScalarColumnCellsuCharV (const RefRows &rownrs, Vector< uChar > *dataPtr)
virtual void getScalarColumnCellsShortV (const RefRows &rownrs, Vector< Short > *dataPtr)
virtual void getScalarColumnCellsuShortV (const RefRows &rownrs, Vector< uShort > *dataPtr)
virtual void getScalarColumnCellsIntV (const RefRows &rownrs, Vector< Int > *dataPtr)
virtual void getScalarColumnCellsuIntV (const RefRows &rownrs, Vector< uInt > *dataPtr)
virtual void getScalarColumnCellsfloatV (const RefRows &rownrs, Vector< float > *dataPtr)
virtual void getScalarColumnCellsdoubleV (const RefRows &rownrs, Vector< double > *dataPtr)
virtual void getScalarColumnCellsComplexV (const RefRows &rownrs, Vector< Complex > *dataPtr)
virtual void getScalarColumnCellsDComplexV (const RefRows &rownrs, Vector< DComplex > *dataPtr)
virtual void getScalarColumnCellsStringV (const RefRows &rownrs, Vector< String > *dataPtr)
virtual void addRow (uInt newNrrow, uInt oldNrrow)
 Add (newNrrow-oldNrrow) rows to the column.
void resize (uInt nrval)
 Resize the data blocks.
virtual void remove (uInt rownr)
 Remove the given row.
virtual void doCreate (uInt nrrow)
 Create the number of rows in a new table.
virtual Bool ok () const
 Check if the class invariants still hold.

Protected Member Functions

uInt findExt (uInt rownr, Bool setCache)
 Find the extension in which the row number is.
uInt nextExt (void *&ext, uInt &extnr, uInt nrmax) const
 Get the next extension.
void * allocData (uInt nrval, Bool byPtr)
 Allocate an extension with the data type of the column.
void deleteAll ()
 Delete all extensions.
void deleteData (void *datap, Bool byPtr)
 Delete an extension.
void removeData (void *datap, uInt inx, uInt nrvalAfter)
 Remove an entry (i.e.
void initData (void *datap, uInt nrval)
 Initialize the data (after an open).
void * getArrayPtr (uInt rownr)
 Get the pointer for the given row.
void putArrayPtr (uInt rownr, void *dataPtr)
 Put the pointer for the given row.

Protected Attributes

MSMBasestmanPtr_p
int dtype_p
 The data type (for caching purposes).
Bool byPtr_p
 The data is indirectly accessed via a pointer (for the derived classes).
uInt nralloc_p
 The number of allocated rows in the column.
uInt nrext_p
 The nr of extensions in use.
Block< void * > data_p
 The assembly of all extensions (actually Block<T*>).
Block< uIntncum_p
 The cumulative nr of rows in all extensions.

Private Member Functions

 MSMColumn (const MSMColumn &)
 Forbid copy constructor.
MSMColumnoperator= (const MSMColumn &)
 Forbid assignment.

Detailed Description

Column in the Memory table storage manager class.

Intended use:

Internal

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25

Prerequisite

Etymology

MSMColumn handles a column for the memory-based storage manager.

Synopsis

MSMColumn is used by MemoryStMan to handle the access to the data in a table column. It is an storage manager based in memory. Thus the data is lost when the table is closed. On reopen it will be initialized to the default column value. It fully supports addition and removal of rows.

MSMColumn serves 2 purposes:

  1. It handles a column containing scalar values.
  2. It serves as a base class for MSMDirColumn and MSMIndColumn These classes handle arrays and use MSMColumn to hold a pointer to the array in each row.

MSMColumn does not hold a column as a consecutive array, because extending the column (i.e. adding rows) proved be too expensive due to the repeated copying involved when creating a table (this method was used by the first version of the table system). Instead it has a number of data blocks (extensions) indexed to by a super block. Accessing a row means finding the appropriate extension via a binary search. Because there is only 1 extension when a table is read back, the overhead in finding a row is small.

Motivation

MSMColumn handles the standard data types. The class is not templated, but a switch statement is used instead. Templates would cause too many instantiations.

To Do

Definition at line 104 of file MSMColumn.h.


Constructor & Destructor Documentation

casa::MSMColumn::MSMColumn ( MSMBase smptr,
int  dataType,
Bool  byPtr 
)

Create a column of the given type.

It will maintain a pointer to its parent storage manager.

virtual casa::MSMColumn::~MSMColumn ( ) [virtual]

Frees up the storage.

casa::MSMColumn::MSMColumn ( const MSMColumn ) [private]

Forbid copy constructor.


Member Function Documentation

virtual void casa::MSMColumn::addRow ( uInt  newNrrow,
uInt  oldNrrow 
) [virtual]

Add (newNrrow-oldNrrow) rows to the column.

Reimplemented in casa::MSMDirColumn.

void* casa::MSMColumn::allocData ( uInt  nrval,
Bool  byPtr 
) [protected]

Allocate an extension with the data type of the column.

void casa::MSMColumn::deleteAll ( ) [protected]

Delete all extensions.

Possible underlying data (as used by StManArrayColumnMemory) will not be deleted and should have been deleted beforehand.

void casa::MSMColumn::deleteData ( void *  datap,
Bool  byPtr 
) [protected]

Delete an extension.

virtual void casa::MSMColumn::doCreate ( uInt  nrrow) [virtual]

Create the number of rows in a new table.

This is used when a table gets created or opened.

Reimplemented in casa::MSMDirColumn.

uInt casa::MSMColumn::findExt ( uInt  rownr,
Bool  setCache 
) [protected]

Find the extension in which the row number is.

If the flag is true, it also sets the columnCache object.

void* casa::MSMColumn::getArrayPtr ( uInt  rownr) [protected]

Get the pointer for the given row.

This is for the derived classes like StManArrayColumnMemory.

uInt casa::MSMColumn::getBlockBoolV ( uInt  rownr,
uInt  nrmax,
Bool dataPtr 
) [virtual]

Get scalars from the given row on with a maximum of nrmax values.

This can be used to get an entire column of scalars or to get a part of a column (for a cache for example). The buffer pointed to by dataPtr has to have the correct length (which is guaranteed by the ScalarColumn get function).

Reimplemented from casa::StManColumn.

uInt casa::MSMColumn::getBlockComplexV ( uInt  rownr,
uInt  nrmax,
Complex *  dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

uInt casa::MSMColumn::getBlockDComplexV ( uInt  rownr,
uInt  nrmax,
DComplex *  dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

uInt casa::MSMColumn::getBlockdoubleV ( uInt  rownr,
uInt  nrmax,
double *  dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

uInt casa::MSMColumn::getBlockfloatV ( uInt  rownr,
uInt  nrmax,
float *  dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

uInt casa::MSMColumn::getBlockIntV ( uInt  rownr,
uInt  nrmax,
Int dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

uInt casa::MSMColumn::getBlockShortV ( uInt  rownr,
uInt  nrmax,
Short dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

uInt casa::MSMColumn::getBlockStringV ( uInt  rownr,
uInt  nrmax,
String dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

uInt casa::MSMColumn::getBlockuCharV ( uInt  rownr,
uInt  nrmax,
uChar dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

uInt casa::MSMColumn::getBlockuIntV ( uInt  rownr,
uInt  nrmax,
uInt dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

uInt casa::MSMColumn::getBlockuShortV ( uInt  rownr,
uInt  nrmax,
uShort dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

void casa::MSMColumn::getBoolV ( uInt  rownr,
Bool dataPtr 
) [virtual]

Get a scalar value in the given row.

The buffer pointed to by dataPtr has to have the correct length (which is guaranteed by the Scalar/ArrayColumn get function).

Reimplemented from casa::DataManagerColumn.

void casa::MSMColumn::getComplexV ( uInt  rownr,
Complex *  dataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

void casa::MSMColumn::getDComplexV ( uInt  rownr,
DComplex *  dataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

void casa::MSMColumn::getdoubleV ( uInt  rownr,
double *  dataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

void casa::MSMColumn::getfloatV ( uInt  rownr,
float *  dataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

void casa::MSMColumn::getIntV ( uInt  rownr,
Int dataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

virtual void casa::MSMColumn::getScalarColumnCellsBoolV ( const RefRows rownrs,
Vector< Bool > *  dataPtr 
) [virtual]

Get the scalar values in some cells of the column.

The buffer pointed to by dataPtr has to have the correct length. (which is guaranteed by the ScalarColumn getColumnCells function). The default implementation loops through all rows.

Reimplemented from casa::StManColumn.

virtual void casa::MSMColumn::getScalarColumnCellsComplexV ( const RefRows rownrs,
Vector< Complex > *  dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::MSMColumn::getScalarColumnCellsDComplexV ( const RefRows rownrs,
Vector< DComplex > *  dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::MSMColumn::getScalarColumnCellsdoubleV ( const RefRows rownrs,
Vector< double > *  dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::MSMColumn::getScalarColumnCellsfloatV ( const RefRows rownrs,
Vector< float > *  dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::MSMColumn::getScalarColumnCellsIntV ( const RefRows rownrs,
Vector< Int > *  dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::MSMColumn::getScalarColumnCellsShortV ( const RefRows rownrs,
Vector< Short > *  dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::MSMColumn::getScalarColumnCellsStringV ( const RefRows rownrs,
Vector< String > *  dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::MSMColumn::getScalarColumnCellsuCharV ( const RefRows rownrs,
Vector< uChar > *  dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::MSMColumn::getScalarColumnCellsuIntV ( const RefRows rownrs,
Vector< uInt > *  dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::MSMColumn::getScalarColumnCellsuShortV ( const RefRows rownrs,
Vector< uShort > *  dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

void casa::MSMColumn::getShortV ( uInt  rownr,
Short dataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

void casa::MSMColumn::getStringV ( uInt  rownr,
String dataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

void casa::MSMColumn::getuCharV ( uInt  rownr,
uChar dataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

void casa::MSMColumn::getuIntV ( uInt  rownr,
uInt dataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

void casa::MSMColumn::getuShortV ( uInt  rownr,
uShort dataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

void casa::MSMColumn::initData ( void *  datap,
uInt  nrval 
) [protected]

Initialize the data (after an open).

uInt casa::MSMColumn::nextExt ( void *&  ext,
uInt extnr,
uInt  nrmax 
) const [protected]

Get the next extension.

For the first iteration extnr should be zero. It returns the number of values in it until the maximum is reached. Zero means no more extensions.

virtual Bool casa::MSMColumn::ok ( ) const [virtual]

Check if the class invariants still hold.

Reimplemented in casa::MSMDirColumn.

MSMColumn& casa::MSMColumn::operator= ( const MSMColumn ) [private]

Forbid assignment.

void casa::MSMColumn::putArrayPtr ( uInt  rownr,
void *  dataPtr 
) [protected]

Put the pointer for the given row.

This is for the derived classes like StManArrayColumnMemory.

void casa::MSMColumn::putBlockBoolV ( uInt  rownr,
uInt  nrmax,
const Bool dataPtr 
) [virtual]

Put nrmax scalars from the given row on.

This can be used to put an entire column of scalars or to put a part of a column (for a cache for example). The buffer pointed to by dataPtr has to have the correct length (which is guaranteed by the ScalarColumn put function).

Reimplemented from casa::StManColumn.

void casa::MSMColumn::putBlockComplexV ( uInt  rownr,
uInt  nrmax,
const Complex *  dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

void casa::MSMColumn::putBlockDComplexV ( uInt  rownr,
uInt  nrmax,
const DComplex *  dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

void casa::MSMColumn::putBlockdoubleV ( uInt  rownr,
uInt  nrmax,
const double *  dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

void casa::MSMColumn::putBlockfloatV ( uInt  rownr,
uInt  nrmax,
const float *  dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

void casa::MSMColumn::putBlockIntV ( uInt  rownr,
uInt  nrmax,
const Int dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

void casa::MSMColumn::putBlockShortV ( uInt  rownr,
uInt  nrmax,
const Short dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

void casa::MSMColumn::putBlockStringV ( uInt  rownr,
uInt  nrmax,
const String dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

void casa::MSMColumn::putBlockuCharV ( uInt  rownr,
uInt  nrmax,
const uChar dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

void casa::MSMColumn::putBlockuIntV ( uInt  rownr,
uInt  nrmax,
const uInt dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

void casa::MSMColumn::putBlockuShortV ( uInt  rownr,
uInt  nrmax,
const uShort dataPtr 
) [virtual]

Reimplemented from casa::StManColumn.

void casa::MSMColumn::putBoolV ( uInt  rownr,
const Bool dataPtr 
) [virtual]

Put a scalar value into the given row.

The buffer pointed to by dataPtr has to have the correct length (which is guaranteed by the Scalar/ArrayColumn put function).

Reimplemented from casa::DataManagerColumn.

void casa::MSMColumn::putComplexV ( uInt  rownr,
const Complex *  dataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

void casa::MSMColumn::putDComplexV ( uInt  rownr,
const DComplex *  dataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

void casa::MSMColumn::putdoubleV ( uInt  rownr,
const double *  dataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

void casa::MSMColumn::putfloatV ( uInt  rownr,
const float *  dataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

void casa::MSMColumn::putIntV ( uInt  rownr,
const Int dataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

void casa::MSMColumn::putShortV ( uInt  rownr,
const Short dataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

void casa::MSMColumn::putStringV ( uInt  rownr,
const String dataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

void casa::MSMColumn::putuCharV ( uInt  rownr,
const uChar dataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

void casa::MSMColumn::putuIntV ( uInt  rownr,
const uInt dataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

void casa::MSMColumn::putuShortV ( uInt  rownr,
const uShort dataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

virtual void casa::MSMColumn::remove ( uInt  rownr) [virtual]

Remove the given row.

If no rows remain in the extension, the extension is also removed.

Reimplemented in casa::MSMDirColumn, and casa::MSMIndColumn.

void casa::MSMColumn::removeData ( void *  datap,
uInt  inx,
uInt  nrvalAfter 
) [protected]

Remove an entry (i.e.

a row) from an extension at the given index. It will do this by shifting the rest (nrvalAfter elements) one position to the left.

void casa::MSMColumn::resize ( uInt  nrval)

Resize the data blocks.

This adds an extension when needed.


Member Data Documentation

The data is indirectly accessed via a pointer (for the derived classes).

Definition at line 238 of file MSMColumn.h.

Block<void*> casa::MSMColumn::data_p [protected]

The assembly of all extensions (actually Block<T*>).

Definition at line 244 of file MSMColumn.h.

int casa::MSMColumn::dtype_p [protected]

The data type (for caching purposes).

Reimplemented from casa::StManColumn.

Definition at line 236 of file MSMColumn.h.

The cumulative nr of rows in all extensions.

Definition at line 246 of file MSMColumn.h.

The number of allocated rows in the column.

Definition at line 240 of file MSMColumn.h.

The nr of extensions in use.

Definition at line 242 of file MSMColumn.h.

Definition at line 234 of file MSMColumn.h.


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