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::SSMColumn Class Reference

A Column in the Standard Storage Manager. More...

#include <SSMColumn.h>

Inheritance diagram for casa::SSMColumn:
casa::StManColumn casa::DataManagerColumn casa::SSMDirColumn casa::SSMIndColumn casa::SSMIndStringColumn

List of all members.

Public Member Functions

 SSMColumn (SSMBase *aParent, int aDataType, uInt aColNr)
 Create a SSMColumn object with the given parent.
virtual ~SSMColumn ()
virtual void setShapeColumn (const IPosition &aShape)
 Set the shape of an array in the column.
virtual void setMaxLength (uInt maxLength)
 Set the maximum length of a 'fixed length' string.
virtual uInt ndim (uInt aRowNr)
 Get the dimensionality of the item in the given row.
virtual IPosition shape (uInt aRowNr)
 Get the shape of the array in the given row.
virtual void doCreate (uInt aNrRows)
 Let the object initialize itself for a newly created table.
virtual void getFile (uInt aNrRows)
 Let the column object initialize itself for an existing table.
void resync (uInt aNrRow)
 Resync the storage manager with the new file contents.
virtual void getBoolV (uInt aRowNr, Bool *aDataPtr)
 Get the scalar value in the given row.
virtual void getuCharV (uInt aRowNr, uChar *aDataPtr)
virtual void getShortV (uInt aRowNr, Short *aDataPtr)
virtual void getuShortV (uInt aRowNr, uShort *aDataPtr)
virtual void getIntV (uInt aRowNr, Int *aDataPtr)
virtual void getuIntV (uInt aRowNr, uInt *aDataPtr)
virtual void getfloatV (uInt aRowNr, float *aDataPtr)
virtual void getdoubleV (uInt aRowNr, double *aDataPtr)
virtual void getComplexV (uInt aRowNr, Complex *aDataPtr)
virtual void getDComplexV (uInt aRowNr, DComplex *aDataPtr)
virtual void getStringV (uInt aRowNr, String *aDataPtr)
virtual void putBoolV (uInt aRowNr, const Bool *aDataPtr)
 Put the scalar value in the given row.
virtual void putuCharV (uInt aRowNr, const uChar *aDataPtr)
virtual void putShortV (uInt aRowNr, const Short *aDataPtr)
virtual void putuShortV (uInt aRowNr, const uShort *aDataPtr)
virtual void putIntV (uInt aRowNr, const Int *aDataPtr)
virtual void putuIntV (uInt aRowNr, const uInt *aDataPtr)
virtual void putfloatV (uInt aRowNr, const float *aDataPtr)
virtual void putdoubleV (uInt aRowNr, const double *aDataPtr)
virtual void putComplexV (uInt aRowNr, const Complex *aDataPtr)
virtual void putDComplexV (uInt aRowNr, const DComplex *aDataPtr)
virtual void putStringV (uInt aRowNr, const String *aDataPtr)
virtual void getScalarColumnBoolV (Vector< Bool > *aDataPtr)
 Get the scalar values of the entire column.
virtual void getScalarColumnuCharV (Vector< uChar > *aDataPtr)
virtual void getScalarColumnShortV (Vector< Short > *aDataPtr)
virtual void getScalarColumnuShortV (Vector< uShort > *aDataPtr)
virtual void getScalarColumnIntV (Vector< Int > *aDataPtr)
virtual void getScalarColumnuIntV (Vector< uInt > *aDataPtr)
virtual void getScalarColumnfloatV (Vector< float > *aDataPtr)
virtual void getScalarColumndoubleV (Vector< double > *aDataPtr)
virtual void getScalarColumnComplexV (Vector< Complex > *aDataPtr)
virtual void getScalarColumnDComplexV (Vector< DComplex > *aDataPtr)
virtual void getScalarColumnStringV (Vector< String > *aDataPtr)
virtual void putScalarColumnBoolV (const Vector< Bool > *aDataPtr)
 Put the scalar values of the entire column.
virtual void putScalarColumnuCharV (const Vector< uChar > *aDataPtr)
virtual void putScalarColumnShortV (const Vector< Short > *aDataPtr)
virtual void putScalarColumnuShortV (const Vector< uShort > *aDataPtr)
virtual void putScalarColumnIntV (const Vector< Int > *aDataPtr)
virtual void putScalarColumnuIntV (const Vector< uInt > *aDataPtr)
virtual void putScalarColumnfloatV (const Vector< float > *aDataPtr)
virtual void putScalarColumndoubleV (const Vector< double > *aDataPtr)
virtual void putScalarColumnComplexV (const Vector< Complex > *aDataPtr)
virtual void putScalarColumnDComplexV (const Vector< DComplex > *aDataPtr)
virtual void putScalarColumnStringV (const Vector< String > *aDataPtr)
virtual void addRow (uInt aNewNrRows, uInt anOldNrRows, Bool doInit)
 Add (NewNrRows-OldNrRows) rows to the Column and initialize the new rows when needed.
virtual void deleteRow (uInt aRowNr)
 Remove the given row from the data bucket and possibly string bucket.
uInt getExternalSizeBytes () const
 Get the size of the dataType in bytes!!
uInt getExternalSizeBits () const
 Get the size of the dataType in bits!!
uInt getColNr ()
 get the sequence number of this column.
void setColNr (uInt aColNr)
 set the sequence number of this column.
void removeColumn ()
 If something special has to be done before removing the Column, as is the case with Strings, it can be done here.

Protected Member Functions

void shiftRows (char *aValue, uInt rowNr, uInt startRow, uInt endRow)
 Shift the rows in the bucket one to the left when removing the given row.
void getValue (uInt aRowNr)
 Fill the cache with data of the bucket containing the given row.
ChargetRowValue (Int *data, uInt aRowNr)
 Get the bucketnr, offset, and length of a variable length string.
void putValue (uInt aRowNr, const void *aValue)
 Put the given value for the row into the correct data bucket.
void putValueShortString (uInt aRowNr, const void *aValue, const String &string)
 Put the given string for the row into the correct data bucket.
void getColumnValue (void *anArray, uInt aNrRows)
 Get the values for the entire column.
void putColumnValue (const void *anArray, uInt aNrRows)
 Put the values from the array in the entire column.

Protected Attributes

SSMBaseitsSSMPtr
 Pointer to the parent storage manager.
uInt itsExternalSizeBytes
 Length of column cell value in storage format (0 = variable length).
uInt itsExternalSizeBits
uInt itsColNr
 Column sequence number of this column.
IPosition itsShape
 The shape of the column.
uInt itsMaxLen
 The maximum length of a 'fixed length' string.
uInt itsNrElem
 Number of elements in a value for this column.
uInt itsNrCopy
 Number of values to be copied.
uInt itsLocalSize
 The sizeof the datatype in local format.
void * itsData
 The data in local format.
Conversion::ValueFunctionitsWriteFunc
 Pointer to a convert function for writing.
Conversion::ValueFunctionitsReadFunc
 Pointer to a convert function for reading.

Private Member Functions

 SSMColumn (const SSMColumn &)
 Forbid copy constructor.
SSMColumnoperator= (const SSMColumn &)
 Forbid assignment.
void init ()
 Initialize part of the object.
char * getDataPtr ()
 Get the pointer to the cache.

Detailed Description

A Column in the Standard Storage Manager.

Intended use:

Internal

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25
Test programs:
tStandardStMan

Prerequisite

Etymology

SSMColumn represents a Column in the Standard Storage Manager.

Synopsis

SSMColumn is the base class for access to a column stored with the Standard Storage manager. It provides some basic functionality for the derived classes handling direct and indirect arrays.

The main task of SSMColumn is handling the access to a column containing scalars of the various data types. The data is stored in buckets. The classes SSMBase and SSMIndex keep track in which data bucket a given row is stored and at which offset the column starts. Using that information SSMColumn can access its data easily.

Almost all data types have a fixed length and can be handled easily. However, strings are a special case.
If the string is fixed length (which means it has a maximum length), the string is stored directly in the data bucket. If the string is shorter than the maximum length, its length is indicated by a trailing 0.
Variable strings are in principle stored in a special string bucket. The data bucket contains 3 integers telling the bucketnr, offset, and length of the string. However, it the string is short enough (ie. <= 8 characters), the string is stored directly in data bucket using the space for bucketnr and offset.

The class maintains a cache of the data in the bucket last read. This cache is used by the higher level table classes to get faster read access to the data. The cache is not used for strings, because they are stored differently.

Definition at line 99 of file SSMColumn.h.


Constructor & Destructor Documentation

casa::SSMColumn::SSMColumn ( SSMBase aParent,
int  aDataType,
uInt  aColNr 
)

Create a SSMColumn object with the given parent.

It initializes the various variables. It keeps the pointer to its parent (but does not own it).

virtual casa::SSMColumn::~SSMColumn ( ) [virtual]
casa::SSMColumn::SSMColumn ( const SSMColumn ) [private]

Forbid copy constructor.


Member Function Documentation

virtual void casa::SSMColumn::addRow ( uInt  aNewNrRows,
uInt  anOldNrRows,
Bool  doInit 
) [virtual]

Add (NewNrRows-OldNrRows) rows to the Column and initialize the new rows when needed.

Reimplemented in casa::SSMIndColumn.

virtual void casa::SSMColumn::deleteRow ( uInt  aRowNr) [virtual]

Remove the given row from the data bucket and possibly string bucket.

If needed, it also removes it from the cache.

Reimplemented in casa::SSMIndColumn, and casa::SSMDirColumn.

virtual void casa::SSMColumn::doCreate ( uInt  aNrRows) [virtual]

Let the object initialize itself for a newly created table.

It is meant for a derived class.

Reimplemented in casa::SSMIndColumn.

virtual void casa::SSMColumn::getBoolV ( uInt  aRowNr,
Bool aDataPtr 
) [virtual]

Get the scalar value in the given row.

Reimplemented from casa::DataManagerColumn.

get the sequence number of this column.

Definition at line 314 of file SSMColumn.h.

References itsColNr.

void casa::SSMColumn::getColumnValue ( void *  anArray,
uInt  aNrRows 
) [protected]

Get the values for the entire column.

The data from all buckets is copied to the array.

virtual void casa::SSMColumn::getComplexV ( uInt  aRowNr,
Complex *  aDataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

char * casa::SSMColumn::getDataPtr ( ) [inline, private]

Get the pointer to the cache.

It is created if not done yet.

Definition at line 306 of file SSMColumn.h.

References casa::SSMBase::getRowsPerBucket(), itsColNr, itsData, itsLocalSize, and itsSSMPtr.

virtual void casa::SSMColumn::getDComplexV ( uInt  aRowNr,
DComplex *  aDataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

virtual void casa::SSMColumn::getdoubleV ( uInt  aRowNr,
double *  aDataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

Get the size of the dataType in bits!!

Definition at line 301 of file SSMColumn.h.

References itsExternalSizeBits.

Get the size of the dataType in bytes!!

Definition at line 296 of file SSMColumn.h.

References itsExternalSizeBytes.

virtual void casa::SSMColumn::getFile ( uInt  aNrRows) [virtual]

Let the column object initialize itself for an existing table.

Reimplemented in casa::SSMIndColumn.

virtual void casa::SSMColumn::getfloatV ( uInt  aRowNr,
float *  aDataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

virtual void casa::SSMColumn::getIntV ( uInt  aRowNr,
Int aDataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

Char* casa::SSMColumn::getRowValue ( Int data,
uInt  aRowNr 
) [protected]

Get the bucketnr, offset, and length of a variable length string.

data must have 3 Ints to hold the values. It returns a pointer to the data in the bucket, which can be used for the case that the data bucket contains the (short) string.

virtual void casa::SSMColumn::getScalarColumnBoolV ( Vector< Bool > *  aDataPtr) [virtual]

Get the scalar values of the entire column.

Reimplemented from casa::StManColumn.

virtual void casa::SSMColumn::getScalarColumnComplexV ( Vector< Complex > *  aDataPtr) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::SSMColumn::getScalarColumnDComplexV ( Vector< DComplex > *  aDataPtr) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::SSMColumn::getScalarColumndoubleV ( Vector< double > *  aDataPtr) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::SSMColumn::getScalarColumnfloatV ( Vector< float > *  aDataPtr) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::SSMColumn::getScalarColumnIntV ( Vector< Int > *  aDataPtr) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::SSMColumn::getScalarColumnShortV ( Vector< Short > *  aDataPtr) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::SSMColumn::getScalarColumnStringV ( Vector< String > *  aDataPtr) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::SSMColumn::getScalarColumnuCharV ( Vector< uChar > *  aDataPtr) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::SSMColumn::getScalarColumnuIntV ( Vector< uInt > *  aDataPtr) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::SSMColumn::getScalarColumnuShortV ( Vector< uShort > *  aDataPtr) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::SSMColumn::getShortV ( uInt  aRowNr,
Short aDataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

virtual void casa::SSMColumn::getStringV ( uInt  aRowNr,
String aDataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

virtual void casa::SSMColumn::getuCharV ( uInt  aRowNr,
uChar aDataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

virtual void casa::SSMColumn::getuIntV ( uInt  aRowNr,
uInt aDataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

virtual void casa::SSMColumn::getuShortV ( uInt  aRowNr,
uShort aDataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

void casa::SSMColumn::getValue ( uInt  aRowNr) [protected]

Fill the cache with data of the bucket containing the given row.

void casa::SSMColumn::init ( ) [private]

Initialize part of the object.

It determines the nr of elements, the function to use to convert from local to file format, etc..

Reimplemented in casa::SSMIndColumn.

virtual uInt casa::SSMColumn::ndim ( uInt  aRowNr) [virtual]

Get the dimensionality of the item in the given row.

Reimplemented from casa::DataManagerColumn.

Reimplemented in casa::SSMIndColumn, and casa::SSMIndStringColumn.

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

Forbid assignment.

virtual void casa::SSMColumn::putBoolV ( uInt  aRowNr,
const Bool aDataPtr 
) [virtual]

Put the scalar value in the given row.

It updates the cache if the row is contained in the cache.

Reimplemented from casa::DataManagerColumn.

void casa::SSMColumn::putColumnValue ( const void *  anArray,
uInt  aNrRows 
) [protected]

Put the values from the array in the entire column.

Each data bucket is filled with the the appropriate part of the array.

virtual void casa::SSMColumn::putComplexV ( uInt  aRowNr,
const Complex *  aDataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

virtual void casa::SSMColumn::putDComplexV ( uInt  aRowNr,
const DComplex *  aDataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

virtual void casa::SSMColumn::putdoubleV ( uInt  aRowNr,
const double *  aDataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

virtual void casa::SSMColumn::putfloatV ( uInt  aRowNr,
const float *  aDataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

virtual void casa::SSMColumn::putIntV ( uInt  aRowNr,
const Int aDataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

virtual void casa::SSMColumn::putScalarColumnBoolV ( const Vector< Bool > *  aDataPtr) [virtual]

Put the scalar values of the entire column.

It invalidates the cache.

Reimplemented from casa::StManColumn.

virtual void casa::SSMColumn::putScalarColumnComplexV ( const Vector< Complex > *  aDataPtr) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::SSMColumn::putScalarColumnDComplexV ( const Vector< DComplex > *  aDataPtr) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::SSMColumn::putScalarColumndoubleV ( const Vector< double > *  aDataPtr) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::SSMColumn::putScalarColumnfloatV ( const Vector< float > *  aDataPtr) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::SSMColumn::putScalarColumnIntV ( const Vector< Int > *  aDataPtr) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::SSMColumn::putScalarColumnShortV ( const Vector< Short > *  aDataPtr) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::SSMColumn::putScalarColumnStringV ( const Vector< String > *  aDataPtr) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::SSMColumn::putScalarColumnuCharV ( const Vector< uChar > *  aDataPtr) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::SSMColumn::putScalarColumnuIntV ( const Vector< uInt > *  aDataPtr) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::SSMColumn::putScalarColumnuShortV ( const Vector< uShort > *  aDataPtr) [virtual]

Reimplemented from casa::StManColumn.

virtual void casa::SSMColumn::putShortV ( uInt  aRowNr,
const Short aDataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

virtual void casa::SSMColumn::putStringV ( uInt  aRowNr,
const String aDataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

virtual void casa::SSMColumn::putuCharV ( uInt  aRowNr,
const uChar aDataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

virtual void casa::SSMColumn::putuIntV ( uInt  aRowNr,
const uInt aDataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

virtual void casa::SSMColumn::putuShortV ( uInt  aRowNr,
const uShort aDataPtr 
) [virtual]

Reimplemented from casa::DataManagerColumn.

void casa::SSMColumn::putValue ( uInt  aRowNr,
const void *  aValue 
) [protected]

Put the given value for the row into the correct data bucket.

void casa::SSMColumn::putValueShortString ( uInt  aRowNr,
const void *  aValue,
const String string 
) [protected]

Put the given string for the row into the correct data bucket.

The argument aValue> must be 3 Ints (for bucketnr, offset, and length). Only the length is actually used.

If something special has to be done before removing the Column, as is the case with Strings, it can be done here.

void casa::SSMColumn::resync ( uInt  aNrRow)

Resync the storage manager with the new file contents.

It resets the last rownr put.

void casa::SSMColumn::setColNr ( uInt  aColNr) [inline]

set the sequence number of this column.

Definition at line 319 of file SSMColumn.h.

References itsColNr.

virtual void casa::SSMColumn::setMaxLength ( uInt  maxLength) [virtual]

Set the maximum length of a 'fixed length' string.

It is only called (right after the constructor) if the string has a fixed length

Reimplemented from casa::DataManagerColumn.

Reimplemented in casa::SSMIndColumn, and casa::SSMDirColumn.

virtual void casa::SSMColumn::setShapeColumn ( const IPosition aShape) [virtual]

Set the shape of an array in the column.

It is only called (right after the constructor) if the array has a fixed shape.

Reimplemented from casa::DataManagerColumn.

Reimplemented in casa::SSMIndColumn.

virtual IPosition casa::SSMColumn::shape ( uInt  aRowNr) [virtual]

Get the shape of the array in the given row.

Reimplemented from casa::DataManagerColumn.

Reimplemented in casa::SSMIndColumn, and casa::SSMIndStringColumn.

void casa::SSMColumn::shiftRows ( char *  aValue,
uInt  rowNr,
uInt  startRow,
uInt  endRow 
) [protected]

Shift the rows in the bucket one to the left when removing the given row.


Member Data Documentation

Column sequence number of this column.

Definition at line 259 of file SSMColumn.h.

Referenced by getColNr(), getDataPtr(), and setColNr().

void* casa::SSMColumn::itsData [protected]

The data in local format.

Definition at line 273 of file SSMColumn.h.

Referenced by getDataPtr().

Definition at line 257 of file SSMColumn.h.

Referenced by getExternalSizeBits().

Length of column cell value in storage format (0 = variable length).

Definition at line 256 of file SSMColumn.h.

Referenced by getExternalSizeBytes().

The sizeof the datatype in local format.

Definition at line 271 of file SSMColumn.h.

Referenced by getDataPtr().

The maximum length of a 'fixed length' string.

Definition at line 263 of file SSMColumn.h.

Number of values to be copied.

Normally this is itsNrElem, but for complex types it is 2*itsNrElem. When local format is used, it is the number of bytes.

Definition at line 269 of file SSMColumn.h.

Number of elements in a value for this column.

Definition at line 265 of file SSMColumn.h.

Pointer to a convert function for reading.

Definition at line 277 of file SSMColumn.h.

The shape of the column.

Definition at line 261 of file SSMColumn.h.

Pointer to the parent storage manager.

Definition at line 254 of file SSMColumn.h.

Referenced by getDataPtr().

Pointer to a convert function for writing.

Definition at line 275 of file SSMColumn.h.


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