SSMColumn.h

Classes

SSMColumn -- A Column in the Standard Storage Manager. (full description)

class SSMColumn : public StManColumn

Interface

Public Members
SSMColumn (SSMBase* aParent, int aDataType, uInt aColNr)
virtual ~SSMColumn()
virtual void setShapeColumn (const IPosition& aShape)
virtual void setMaxLength (uInt maxLength)
virtual uInt ndim (uInt aRowNr)
virtual IPosition shape (uInt aRowNr)
virtual void doCreate (uInt aNrRows)
virtual void getFile (uInt aNrRows)
void resync (uInt aNrRow)
virtual void getBoolV (uInt aRowNr, Bool* aDataPtr)
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)
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)
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)
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)
virtual void deleteRow (uInt aRowNr)
uInt getExternalSizeBytes() const
uInt getExternalSizeBits() const
uInt getColNr()
void setColNr (uInt aColNr)
void removeColumn()
Protected Members
void shiftRows (char* aValue, uInt rowNr, uInt startRow, uInt endRow)
void getValue (uInt aRowNr)
Char* getRowValue (Int* data, uInt aRowNr)
void putValue (uInt aRowNr, const void* aValue)
void putValueShortString (uInt aRowNr, const void* aValue, const String& string)
void getColumnValue (void* anArray, uInt aNrRows)
void putColumnValue (const void* anArray, uInt aNrRows)
Private Members
SSMColumn (const SSMColumn&)
SSMColumn& operator= (const SSMColumn&)
void init()
char* getDataPtr()

Description

Review Status

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

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.

Member Description

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 ~SSMColumn()

virtual void setShapeColumn (const IPosition& aShape)

Set the shape of an array in the column. It is only called (right after the constructor) if the array has a fixed shape.

virtual void setMaxLength (uInt maxLength)

Set the maximum length of a 'fixed length' string. It is only called (right after the constructor) if the string has a fixed length

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. It is meant for a derived class.

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. It resets the last rownr put.

virtual void getBoolV (uInt aRowNr, Bool* aDataPtr)
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)

Get the scalar value in the given row.

virtual void putBoolV (uInt aRowNr, const Bool* aDataPtr)
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)

Put the scalar value in the given row. It updates the cache if the row is contained in the cache.

virtual void getScalarColumnBoolV (Vector<Bool>* aDataPtr)
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)

Get the scalar values of the entire column.

virtual void putScalarColumnBoolV (const Vector<Bool>* aDataPtr)
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)

Put the scalar values of the entire column. It invalidates the cache.

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. If needed, it also removes it from the cache.

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.

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.

Char* getRowValue (Int* data, uInt aRowNr)

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.

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. The argument aValue> must be 3 Ints (for bucketnr, offset, and length). Only the length is actually used.

void getColumnValue (void* anArray, uInt aNrRows)

Get the values for the entire column. The data from all buckets is copied to the array.

void putColumnValue (const void* anArray, uInt aNrRows)

Put the values from the array in the entire column. Each data bucket is filled with the the appropriate part of the array.

SSMColumn (const SSMColumn&)

Forbid copy constructor.

SSMColumn& operator= (const SSMColumn&)

Forbid assignment.

void init()

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

char* getDataPtr()

Get the pointer to the cache. It is Created if not done yet.