StManAipsIO.h

Classes

StManColumnAipsIO -- AipsIO table column storage manager class (full description)
StManAipsIO -- AipsIO table storage manager class (full description)

class StManColumnAipsIO : public StManColumn

Interface

Public Members
StManColumnAipsIO (StManAipsIO* stMan, int dataType, int internalDataType)
virtual ~StManColumnAipsIO()
virtual int dataType() const
void getBoolV (uInt rownr, Bool* dataPtr)
void getuCharV (uInt rownr, uChar* 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 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 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 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 addRow (uInt newNrrow, uInt oldNrrow)
void resize (uInt nrval)
virtual void remove (uInt rownr)
virtual void doCreate (uInt nrrow)
virtual void putFile (uInt nrval, AipsIO&)
virtual void getFile (uInt nrval, AipsIO&)
virtual Bool ok() const
Protected Members
uInt findExt (uInt rownr) const
void* allocData (uInt nrval)
void deleteAll()
void deleteData (void* datap)
void removeData (void* datap, uInt inx, uInt nrvalAfter)
virtual void putData (void* datap, uInt nrval, AipsIO&)
virtual void getData (void* datap, uInt index, uInt nrval, AipsIO&)
void* getArrayPtr (uInt rownr)
void putArrayPtr (uInt rownr, void* dataPtr)
Private Members
StManColumnAipsIO (const StManColumnAipsIO&)
StManColumnAipsIO& operator= (const StManColumnAipsIO&)

Description

Prerequisite

Etymology

StManColumnAipsIO handles a column for an AipsIO storage manager.

Synopsis

StManColumnAipsIO is used by StManAipsIO to handle the access to the data in a table column. It is an storage manager based on AipsIO. The entire column is kept in memory and only written when the storage manager closes. When the storage manager gets opened, the entire column gets read back. It fully supports addition and removal of rows.

StManColumnAipsIO serves 2 purposes:

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

StManColumnAipsIO does not hold a column as a consecutive array, because extending the column (i.e. adding rows) proofed be too expensive due to the repeated copying involved when creating a table (this method was used by the old 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

StManColumnAipsIO 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

StManColumnAipsIO (StManAipsIO* stMan, int dataType, int internalDataType)

Create a column of the given type. It will maintain a pointer to its parent storage manager.

virtual ~StManColumnAipsIO()

Frees up the storage.

virtual int dataType() const

Return the data type of the column.

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

virtual void putFile (uInt nrval, AipsIO&)

Write the column data into AipsIO. It will successively write all extensions using putData.

virtual void getFile (uInt nrval, AipsIO&)

Read the column data from AipsIO. One extension gets allocated to hold all rows in the column.

virtual Bool ok() const

Check if the class invariants still hold.

uInt findExt (uInt rownr) const

Find the extension in which the row number is.

void* allocData (uInt nrval)

Allocate an extension with the data type of the column.

void deleteAll()

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

void deleteData (void* datap)

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.

virtual void putData (void* datap, uInt nrval, AipsIO&)

Put the data (nrval elements) in an extension (starting at datap) into AipsIO.

virtual void getData (void* datap, uInt index, uInt nrval, AipsIO&)

Get data (nrval elements) into an extension (starting at datap plus the given index).

void* getArrayPtr (uInt rownr)

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

void putArrayPtr (uInt rownr, void* dataPtr)

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

StManColumnAipsIO (const StManColumnAipsIO&)

Forbid copy constructor.

StManColumnAipsIO& operator= (const StManColumnAipsIO&)

Forbid assignment.


class StManAipsIO : public DataManager

Interface

Public Members
StManAipsIO()
~StManAipsIO()
DataManager* clone() const
String dataManagerName() const
uInt uniqueNr()
uInt nrow() const
Bool canAddRow() const
Bool canDeleteRow() const
Bool canAddColumn() const
Bool canDeleteColumn() const
void addRow (uInt nrrow)
void deleteRow (uInt rownr)
DataManagerColumn* createScalarColumn (const String& name, int dataType)
DataManagerColumn* createDirArrColumn (const String& name, int dataType)
DataManagerColumn* createIndArrColumn (const String& name, int dataType)
void deleteColumn (const DataManagerColumn*)
static DataManager* makeObject (const String& dataManagerName)
Private Members
void close (AipsIO&)
void create (uInt nrrow)
void open (uInt nrrow, AipsIO&)

Description

Prerequisite

Etymology

StManAipsIO is the storage manager using AipsIO.

Synopsis

StManAipsIO is a table storage manager based on AipsIO. It holds the data in the columns in memory and writes them to a file when the table gets closed. Only the data of indirect arrays are directly read/written from/to a file. It contains pointers to the underlying StManColumnAipsIO objects, which do the actual data handling.

The AipsIO storage manager does fully support addition and removal of rows and columns.

All data, except indirect columns, for this storage manager are kept in one file. The file name is the table name appended with .N_AipsIO, where N is the (unique) storage manager sequence number. Each column containing indirect arrays is stored in a separate file using class StManIndArrayColumnAipsIO. The name of such a file is the storage manager file name appended with _cM, where M is a unique column sequence number acquired using function uniqueNr().

Motivation

To Do

Member Description

StManAipsIO()

Create an AipsIO storage manager.

~StManAipsIO()

DataManager* clone() const

Clone this object. It does not clone StManAipsIOColumn objects possibly used.

String dataManagerName() const

Get the name of the data manager (i.e. StManAipsIO).

uInt uniqueNr()

Get a unique column number for the column (it is only unique for this storage manager). This is used by StManIndArrayColumnAipsIO to create a unique file name.

uInt nrow() const

Get the nr of rows in this storage manager.

Bool canAddRow() const

Does the storage manager allow to add rows? (yes)

Bool canDeleteRow() const

Does the storage manager allow to delete rows? (yes)

Bool canAddColumn() const

Does the storage manager allow to add columns? (yes)

Bool canDeleteColumn() const

Does the storage manager allow to delete columns? (yes)

void addRow (uInt nrrow)

Add rows to all columns.

void deleteRow (uInt rownr)

Delete a row from all columns.

DataManagerColumn* createScalarColumn (const String& name, int dataType)

Create a column in the storage manager on behalf of a table column.

Create a scalar column.

DataManagerColumn* createDirArrColumn (const String& name, int dataType)

Create a column in the storage manager on behalf of a table column.

Create a direct array column.

DataManagerColumn* createIndArrColumn (const String& name, int dataType)

Create a column in the storage manager on behalf of a table column.

Create an indirect array column.

void deleteColumn (const DataManagerColumn*)

Delete a column.

static DataManager* makeObject (const String& dataManagerName)

Make the object from the string. This function gets registered in the DataManager "constructor" map.

void close (AipsIO&)

Block colSet_p;

Flush the data and close the storage manager. All StManColumnAipsIO objects will write their data and close themselves.

void create (uInt nrrow)

Let the storage manager create files as needed for a new table. This allows a column with an indirect array to create its file.

void open (uInt nrrow, AipsIO&)

Open the storage manager file for an existing table and read in the data and let the StManColumnAipsIO objects read their data.


Copyright © 1995 Associated Universities Inc., Washington, D.C.