MSMColumn.h

Classes

MSMColumn -- Column in the Memory table storage manager class (full description)

class MSMColumn: public StManColumn

Interface

Public Members
MSMColumn (MSMBase* smptr, int dataType, Bool byPtr)
virtual ~MSMColumn()
void getBoolV (uInt rownr, Bool* dataPtr)
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)
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)
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)
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)
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)
void resize (uInt nrval)
virtual void remove (uInt rownr)
virtual void doCreate (uInt nrrow)
virtual Bool ok() const
Protected Members
uInt findExt (uInt rownr, Bool setCache)
uInt nextExt (void*& ext, uInt& extnr, uInt nrmax) const
void* allocData (uInt nrval, Bool byPtr)
void deleteAll()
void deleteData (void* datap, Bool byPtr)
void removeData (void* datap, uInt inx, uInt nrvalAfter)
void initData (void* datap, uInt nrval)
void* getArrayPtr (uInt rownr)
void putArrayPtr (uInt rownr, void* dataPtr)
Private Members
MSMColumn (const MSMColumn&)
MSMColumn& operator= (const MSMColumn&)

Description

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

Member Description

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

Frees up the storage.

void getBoolV (uInt rownr, Bool* dataPtr)
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)

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).

void putBoolV (uInt rownr, const Bool* dataPtr)
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)

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).

uInt getBlockBoolV (uInt rownr, uInt nrmax, Bool* dataPtr)
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)

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).

void putBlockBoolV (uInt rownr, uInt nrmax, const Bool* dataPtr)
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)

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).

virtual void getScalarColumnCellsBoolV (const RefRows& rownrs, Vector<Bool>* dataPtr)
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)

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.

virtual void addRow (uInt newNrrow, uInt oldNrrow)

Add (newNrrow-oldNrrow) rows to the column.

void resize (uInt nrval)

Resize the data blocks. This adds an extension when needed.

virtual void remove (uInt rownr)

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

virtual void doCreate (uInt nrrow)

Create the number of rows in a new table. This is used when a table gets created or opened.

virtual Bool ok() const

Check if the class invariants still hold.

uInt findExt (uInt rownr, Bool setCache)

Find the extension in which the row number is. If the flag is true, it also sets the columnCache object.

uInt nextExt (void*& ext, uInt& extnr, uInt nrmax) const

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.

void* allocData (uInt nrval, Bool byPtr)

Allocate an extension with the data type of the column.

void deleteAll()

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

void deleteData (void* datap, Bool byPtr)

Delete an extension.

void removeData (void* datap, uInt inx, uInt nrvalAfter)

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 initData (void* datap, uInt nrval)

Initialize the data (after an open).

void* getArrayPtr (uInt rownr)

Get the pointer for the given row. This is for the derived classes like StManArrayColumnMemory.

void putArrayPtr (uInt rownr, void* dataPtr)

Put the pointer for the given row. This is for the derived classes like StManArrayColumnMemory.

MSMColumn (const MSMColumn&)

Forbid copy constructor.

MSMColumn& operator= (const MSMColumn&)

Forbid assignment.