ScaColData.h

Classes

ScalarColumnData -- Access to a table column containing scalars (full description)

class ScalarColumnData : public PlainColumn

Interface

Public Members
ScalarColumnData (const ScalarColumnDesc<T>*, ColumnSet*)
~ScalarColumnData()
Bool canAccessScalarColumn (Bool& reask) const
Bool canAccessScalarColumnCells (Bool& reask) const
void initialize (uInt startRownr, uInt endRownr)
Bool isDefined (uInt rownr) const
void get (uInt rownr, void*) const
void getScalarColumn (void* dataPtr) const
void getScalarColumnCells (const RefRows& rownrs, void* dataPtr) const
void put (uInt rownr, const void* dataPtr)
void putScalarColumn (const void* dataPtr)
void putScalarColumnCells (const RefRows& rownrs, const void* dataPtr)
void makeSortKey (Sort&, ObjCompareFunc* cmpFunc, Int order, const void*& dataSave)
void makeRefSortKey (Sort&, ObjCompareFunc* cmpFunc, Int order, const Vector<uInt>& rownrs, const void*& dataSave)
void freeSortKey (const void*& dataSave)
void allocIterBuf (void*& lastVal, void*& curVal, ObjCompareFunc*& cmpFunc)
void freeIterBuf (void*& lastVal, void*& curVal)
void createDataManagerColumn()
Private Members
ScalarColumnData (const ScalarColumnData<T>&)
ScalarColumnData<T>& operator= (const ScalarColumnData<T>&)
void putFileDerived (AipsIO&)
void getFileDerived (AipsIO&, const ColumnSet&)
void fillSortKey (const Vector<T>* dataPtr, Sort&, ObjCompareFunc* cmpFunc, Int order)

Description

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.

To Do

Member Description

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.

~ScalarColumnData()

Bool canAccessScalarColumn (Bool& reask) const

Ask if the data manager can handle a column.

Bool canAccessScalarColumnCells (Bool& reask) const

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

void initialize (uInt startRownr, uInt endRownr)

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

Bool isDefined (uInt rownr) const

Test if the given cell contains a defined value.

void get (uInt rownr, void*) const

Get the value from a particular cell.

void getScalarColumn (void* dataPtr) const

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.

void getScalarColumnCells (const RefRows& rownrs, void* dataPtr) const

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.

void put (uInt rownr, const void* dataPtr)

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.

void putScalarColumn (const void* dataPtr)

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.

void putScalarColumnCells (const RefRows& rownrs, const void* dataPtr)

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.

void makeRefSortKey (Sort&, ObjCompareFunc* cmpFunc, Int order, const Vector<uInt>& rownrs, const void*& dataSave)

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

Do it only for the given row numbers.

void makeSortKey (Sort&, ObjCompareFunc* cmpFunc, Int order, const void*& dataSave)

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

void freeSortKey (const void*& dataSave)

Free storage on the heap allocated by makeSortkey(). The pointer will be set to zero.

void allocIterBuf (void*& lastVal, void*& curVal, ObjCompareFunc*& cmpFunc)

Allocate value buffers for the table iterator. Also get a comparison function if undefined. The function freeIterBuf must be called to free the buffers.

void freeIterBuf (void*& lastVal, void*& curVal)

Free the value buffers allocated by allocIterBuf.

void createDataManagerColumn()

Create a data manager column object for this column.

ScalarColumnData (const ScalarColumnData<T>&)

Copy constructor cannot be used.

ScalarColumnData<T>& operator= (const ScalarColumnData<T>&)

Assignment cannot be used.

void putFileDerived (AipsIO&)

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

void getFileDerived (AipsIO&, const ColumnSet&)

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.

void fillSortKey (const Vector<T>* dataPtr, Sort&, ObjCompareFunc* cmpFunc, Int order)

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