ForwardCol.h

Classes

ForwardColumn -- Virtual column forwarding to another column (full description)
ForwardColumnEngine -- Virtual column engine forwarding to other columns (full description)

class ForwardColumn : public DataManagerColumn

Interface

Public Members
ForwardColumn (ForwardColumnEngine* enginePtr, const String& columnName, int dataType, const String& dataTypeId, const Table& referencedTable)
virtual ~ForwardColumn()
void fillTableName (const Table& thisTable, const Table& referencedTable)
virtual void prepare (const Table& thisTable)
void setRW()
Protected Members
void basePrepare (const Table& thisTable, Bool writable)
BaseColumn* colPtr() const
Private Members
ForwardColumn (const ForwardColumn&)
ForwardColumn& operator= (const ForwardColumn&)
static SetupNewTable setupNewTable (const Table& table, const String& tableName, Table::TableOption option)
Bool canChangeShape() const
Bool canAccessScalarColumn (Bool& reask) const
Bool canAccessArrayColumn (Bool& reask) const
Bool canAccessSlice (Bool& reask) const
Bool canAccessColumnSlice (Bool& reask) const
int dataType() const
String dataTypeId() const
Bool isWritable() const
void setShapeColumn (const IPosition& shape)
void setShape (uInt rownr, const IPosition& shape)
Bool isShapeDefined (uInt rownr)
uInt ndim (uInt rownr)
IPosition shape (uInt rownr)
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 getOtherV (uInt rownr, void* 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)
void putOtherV (uInt rownr, const void* dataPtr)
void getScalarColumnV (void* dataPtr)
void putScalarColumnV (const void* dataPtr)
void getArrayV (uInt rownr, void* dataPtr)
void putArrayV (uInt rownr, const void* dataPtr)
void getSliceV (uInt rownr, const Slicer& slicer, void* dataPtr)
void putSliceV (uInt rownr, const Slicer& slicer, const void* dataPtr)
void getArrayColumnV (void* dataPtr)
void putArrayColumnV (const void* dataPtr)
void getColumnSliceV (const Slicer& slicer, void* dataPtr)
void putColumnSliceV (const Slicer& slicer, const void* dataPtr)

Description

Review Status

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

Prerequisite

Synopsis

ForwardColumn represents a virtual column which forwards the gets and puts to a column with the same name in another table. It is, in fact, a reference to the other column. The name of the other table is stored as a keyword in the forwarding column. When there is a forwarding chain (i.e. forwarding to a forwarding column), the name of the last table in the chain is stored in the keyword. In this way, the length of the chain is kept to a minimum. Otherwise a very long chain could occur, which would slow things down.

Addition and deletion of rows is allowed, but the functions addRow and removeRow do not do anything at all. They are implemented to override the default "throw exception" implementation. Because the engine allows this, it can be used in a table supporting addition and removal of rows.

An object of this class is created (and deleted) by ForwardColumnEngine which creates a ForwardColumn object for each column being forwarded.

Motivation

This class will be used by the calibration software. Most columns in a measurement table will be forwarded, while a few (i.e. the data themselves) will be calculated by a dedicated calibration engine.

Member Description

ForwardColumn (ForwardColumnEngine* enginePtr, const String& columnName, int dataType, const String& dataTypeId, const Table& referencedTable)

Construct it for the given column.

virtual ~ForwardColumn()

Destructor is mandatory.

void fillTableName (const Table& thisTable, const Table& referencedTable)

Define the special keyword containing the name of the original table. If the column in the referenced table contains that special keyword, it is in its turn a forwarding column. In that case the special keyword value will be copied over to shortcut the forwarding chain. The suffix is appended to the keyword name when defining it. This makes this function usable for derived classes.

virtual void prepare (const Table& thisTable)

Initialize the object. This means binding the column to the column with the same name in the original table. It checks if the description of both columns is the same. It also determines if the column is writable.

void setRW()

Set the column to writable if its underlying table is writable.

void basePrepare (const Table& thisTable, Bool writable)

Do the preparation of the base class column object.

BaseColumn* colPtr() const

ForwardColumn (const ForwardColumn&)

Copy constructor is not needed and therefore forbidden (so make it private).

ForwardColumn& operator= (const ForwardColumn&)

Assignment is not needed and therefore forbidden (so make it private).

static SetupNewTable setupNewTable (const Table& table, const String& tableName, Table::TableOption option)

Create a SetupNewTable object with the given name and option and with the description from the given table. The SetupNewTable object will use a single ForwardColumn engine which forwards all columns to the given table. Later the SetupNewTable::bind functions can be used to bind one or more columns to another data manager.

Bool canChangeShape() const

This data manager may be able to handle changing array shapes.

Bool canAccessScalarColumn (Bool& reask) const

This data manager may be able to do get/putScalarColumn.

Bool canAccessArrayColumn (Bool& reask) const

This data manager may be able to do get/putArrayColumn.

Bool canAccessSlice (Bool& reask) const

This data manager may be able to do get/putSlice.

Bool canAccessColumnSlice (Bool& reask) const

This data manager may be able to do get/putColumnSlice.

int dataType() const

Get the data type of the column as defined in DataType.h.

String dataTypeId() const

Get the data type id of the column for dataType==TpOther. This function is required for virtual column engines handling non-standard data types. It is used to check the data type.

Bool isWritable() const

Test if data can be put into this column.

void setShapeColumn (const IPosition& shape)

Set the shape of an direct array. This only checks if the shape matches the referenced column.

void setShape (uInt rownr, const IPosition& shape)

Set the shape of an (indirect) array in the given row.

Bool isShapeDefined (uInt rownr)

Is the value shape defined in the given row?

uInt ndim (uInt rownr)

Get the dimensionality of the item in the given row.

IPosition shape (uInt rownr)

Get the shape of the item in the given row.

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 the scalar value with a standard data type in the given row.

void getOtherV (uInt rownr, void* dataPtr)

Get the scalar value with a non-standard data type in the given row.

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 the scalar value with a standard data type into the given row.

void putOtherV (uInt rownr, const void* dataPtr)

Put the scalar value with a non-standard data type into the given row.

void getScalarColumnV (void* dataPtr)

Get all scalar values in the column. The argument dataPtr is in fact a Vector*, but a void* is needed to be generic. The vector pointed to by dataPtr has to have the correct length (which is guaranteed by the ScalarColumn getColumn function).

void putScalarColumnV (const void* dataPtr)

Put all scalar values in the column. The argument dataPtr is in fact a const Vector*, but a const void* is needed to be generic. The vector pointed to by dataPtr has to have the correct length (which is guaranteed by the ScalarColumn putColumn function).

void getArrayV (uInt rownr, void* dataPtr)

Get the array value in the given row. The argument dataPtr is in fact a Array*, but a void* is needed to be generic. The array pointed to by dataPtr has to have the correct shape (which is guaranteed by the ArrayColumn get function).

void putArrayV (uInt rownr, const void* dataPtr)

Put the array value into the given row. The argument dataPtr is in fact a const Array*, but a const void* is needed to be generic. The array pointed to by dataPtr has to have the correct shape (which is guaranteed by the ArrayColumn put function).

void getSliceV (uInt rownr, const Slicer& slicer, void* dataPtr)

Get a section of the array in the given row. The argument dataPtr is in fact a Array*, but a void* is needed to be generic. The array pointed to by dataPtr has to have the correct shape (which is guaranteed by the ArrayColumn getSlice function).

void putSliceV (uInt rownr, const Slicer& slicer, const void* dataPtr)

Put into a section of the array in the given row. The argument dataPtr is in fact a const Array*, but a const void* is needed to be generic. The array pointed to by dataPtr has to have the correct shape (which is guaranteed by the ArrayColumn putSlice function).

void getArrayColumnV (void* dataPtr)

Get all scalar values in the column. The argument dataPtr is in fact a Vector*, but a void* is needed to be generic. The vector pointed to by dataPtr has to have the correct length (which is guaranteed by the ScalarColumn getColumn function).

void putArrayColumnV (const void* dataPtr)

Put all scalar values in the column. The argument dataPtr is in fact a const Vector*, but a const void* is needed to be generic. The vector pointed to by dataPtr has to have the correct length (which is guaranteed by the ScalarColumn putColumn function).

void getColumnSliceV (const Slicer& slicer, void* dataPtr)

Get a section of all arrays in the column. The argument dataPtr is in fact a Array*, but a void* is needed to be generic. The array pointed to by dataPtr has to have the correct shape (which is guaranteed by the ArrayColumn getColumn function).

void putColumnSliceV (const Slicer& slicer, const void* dataPtr)

Put a section into all arrays in the column. The argument dataPtr is in fact a const Array*, but a const void* is needed to be generic. The array pointed to by dataPtr has to have the correct shape (which is guaranteed by the ArrayColumn putColumn function).


class ForwardColumnEngine : public VirtualColumnEngine

Interface

Public Members
ForwardColumnEngine (const String& dataManagerName, const Record& spec)
ForwardColumnEngine (const Table& referencedTable, const String& dataManagerName)
ForwardColumnEngine (const Table& referencedTable)
~ForwardColumnEngine()
DataManager* clone() const
String dataManagerName() const
String dataManagerType() const
virtual Record dataManagerSpec() const
const String& suffix() const
static void registerClass()
Protected Members
void setSuffix (const String& suffix)
void addForwardColumn (ForwardColumn* colp)
const Table& refTable() const
void baseCreate()
void basePrepare()
Private Members
ForwardColumnEngine (const ForwardColumnEngine&)
ForwardColumnEngine& operator= (const ForwardColumnEngine&)
Bool canAddRow() const
Bool canRemoveRow() const
void addRow (uInt nrrow)
void removeRow (uInt rownr)
Bool canAddColumn() const
Bool canRemoveColumn() const
void addColumn (DataManagerColumn*)
void removeColumn (DataManagerColumn*)
DataManagerColumn* makeScalarColumn (const String& columnName, int dataType, const String& dataTypeId)
DataManagerColumn* makeIndArrColumn (const String& columnName, int dataType, const String& dataTypeId)
void create (uInt initialNrrow)
void prepare()
void reopenRW()
Public Members
void setRefTable (const Table& refTable)
static DataManager* makeObject (const String& dataManagerType, const Record& spec)

Description

Review Status

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

Prerequisite

Synopsis

ForwardColumnEngine is a data manager which forwards the gets and puts of columns to columns with the same names in another table. It is, in fact, a reference to the other table columns. The engine consists of a set of ForwardColumn objects, which handle the actual gets and puts.

Motivation

This class will be used by the calibration software. Most columns in a measurement table will be forwarded (thus bound to a ForwardColumnEngine object), while a few (i.e. the data themselves) will be calculated by a dedicated calibration engine.

Example

    // The original table.
    Table tab("someTable");
    // Create another table with the same description.
    SetupNewTable newtab("tForwardCol1.data", tab.tableDesc(), Table::New);
    // Create an engine which forwards to the original table.
    // Bind all columns in the new table to the forwarding engine.
    ForwardColumnEngine fce(tab);
    newtab.bindAll (fce);
    // Create the new table.
    // Every get and put on this table is forwarded to the original table.
    // NB. Puts cannot be done here, because the original table was
    //     opened as readonly.
    // Of course, some columns could have been bound to another
    // data manager (storage manager, calibration engine, ...).
    Table forwTab(newtab);

Member Description

ForwardColumnEngine (const String& dataManagerName, const Record& spec)

The default constructor is required for reconstruction of the engine when a table is read back.

ForwardColumnEngine (const Table& referencedTable, const String& dataManagerName)

Create the engine. The columns using this engine will reference the given table. The data manager gets the given name.

ForwardColumnEngine (const Table& referencedTable)

Create the engine. The columns using this engine will reference the given table. The data manager has no name.

~ForwardColumnEngine()

Destructor is mandatory.

DataManager* clone() const

Clone the engine object.

String dataManagerName() const

Return the name of the data manager. This is the name of this instantiation of the data manager, thus not its type name.

String dataManagerType() const

Return the type of the engine (i.e. its class name ForwardColumnEngine).

virtual Record dataManagerSpec() const

Record a record containing data manager specifications.

const String& suffix() const

Get the suffix to be used for names.

static void registerClass()

Register the class name and the static makeObject "constructor". This will make the engine known to the table system.

void setSuffix (const String& suffix)

Set the suffix.

void addForwardColumn (ForwardColumn* colp)

Add a ForwardColumn object to the block.

const Table& refTable() const

Get access to the refTable_p data member.

void baseCreate()

Do the creation (i.e. initialization) of the engine.

void basePrepare()

Do the preparation of the engine by preparing all columns.

ForwardColumnEngine (const ForwardColumnEngine&)

The copy constructor is forbidden (so it is private).

ForwardColumnEngine& operator= (const ForwardColumnEngine&)

Assignment is forbidden (so it is private).

Bool canAddRow() const

This data manager allows to add rows.

Bool canRemoveRow() const

This data manager allows to delete rows.

void addRow (uInt nrrow)

Add rows to all columns. This is not doing anything (but needed to override the default).

void removeRow (uInt rownr)

Delete a row from all columns. This is not doing anything (but needed to override the default).

Bool canAddColumn() const

This data manager allows to add columns.

Bool canRemoveColumn() const

This data manager allows to delete columns.

void addColumn (DataManagerColumn*)

Add a column.

void removeColumn (DataManagerColumn*)

Delete a column.

DataManagerColumn* makeScalarColumn (const String& columnName, int dataType, const String& dataTypeId)

Create the column object for the scalar column in this engine.

DataManagerColumn* makeIndArrColumn (const String& columnName, int dataType, const String& dataTypeId)

Create the column object for the indirect array column in this engine.

void create (uInt initialNrrow)

Initialize the object for a new table. It defines the column keywords containing the name of the original table, which can be the parent of the referenced table.

void prepare()

Initialize the engine. It gets the name of the original table(s) from the column keywords, opens those tables and attaches the ForwardColumn objects to the columns in those tables.

void reopenRW()

Reopen the engine for read/write access. It makes all its columns writable if their underlying table is writable.

void setRefTable (const Table& refTable)

Set RefTable_p if not set yet. This is done by ForwardColumn to cover the case for existing tables where the default constructor of ForwardColumnEngine is used and refTable_p is not filled in.

static DataManager* makeObject (const String& dataManagerType, const Record& spec)

Define the "constructor" to construct this engine when a table is read back. This "constructor" has to be registered by the user of the engine. If the engine is commonly used, its registration can be added into the registerAllCtor function in DataManReg.cc. This function gets automatically invoked by the table system.