casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
casa::ForwardColumnIndexedRowEngine Class Reference

Virtual column engine forwarding to other columns/rows. More...

#include <ForwardColRow.h>

Inheritance diagram for casa::ForwardColumnIndexedRowEngine:
casa::ForwardColumnEngine casa::VirtualColumnEngine casa::DataManager

List of all members.

Public Member Functions

 ForwardColumnIndexedRowEngine (const String &dataManagerName, const Record &spec)
 The default constructor is required for reconstruction of the engine when a table is read back.
 ForwardColumnIndexedRowEngine (const Table &referencedTable, const String &rowColumnName, const String &dataManagerName)
 Create the engine.
 ForwardColumnIndexedRowEngine (const Table &referencedTable, const String &rowColumnName)
 Create the engine.
 ~ForwardColumnIndexedRowEngine ()
 Destructor is mandatory.
DataManagerclone () const
 Clone the engine object.
String dataManagerType () const
 Return the type name of the engine (i.e.
virtual Record dataManagerSpec () const
 Record a record containing data manager specifications.
uInt convertRownr (uInt rownr)
 Convert the rownr to the rownr in the underlying table.

Static Public Member Functions

static String className ()
 Return the name of the class.
static void registerClass ()
 Register the class name and the static makeObject "constructor".
static DataManagermakeObject (const String &dataManagerName, const Record &spec)
 Define the "constructor" to construct this engine when a table is read back.

Private Member Functions

 ForwardColumnIndexedRowEngine (const ForwardColumnIndexedRowEngine &)
 The copy constructor is forbidden (so it is private).
ForwardColumnIndexedRowEngineoperator= (const ForwardColumnIndexedRowEngine &)
 Assignment is forbidden (so it is private).
DataManagerColumnmakeScalarColumn (const String &columnName, int dataType, const String &dataTypeId)
 Create the column object for the scalar column in this engine.
DataManagerColumnmakeIndArrColumn (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.
void prepare ()
 Initialize the engine.
void reopenRW ()
 Reopen the engine for read/write access.

Private Attributes

String rowColumnName_p
 Define the column with the row numbers (must have data type uInt).
ROScalarColumn< uIntrowColumn_p
PtrBlock
< ForwardColumnIndexedRow * > 
refColumns_p
 Define the various engine column objects.
Int lastRow_p
 Cache of last row used to get row number.
uInt rowNumber_p

Detailed Description

Virtual column engine forwarding to other columns/rows.

Intended use:

Public interface

Prerequisite

Etymology

ForwardColumnIndexedRowEngine is a virtual column engine which forwards the gets and puts of columns to corresponding columns in another table. Furthermore it maps the row number by indexing the row number in the referenced table.

Synopsis

ForwardColumnIndexedRowEngine is a data manager which forwards the gets and puts of columns to columns with the same names in another table. In that sense it is the same as the virtual column engine

ForwardColumnEngine . However, it also forwards the row number. That is, it uses a column containing row numbers to index the correct row in the referenced table. The name of this column and the name of the referenced table have to be given when constructing the engine.

For example:
Table TABA contains columns A, B and C and consists of N rows. Table TABF uses ForwardColumnIndexedRowEngine to forward its columns A, B and C to the corresponding columns in TABA. Furthermore it contains a column ROW containing row numbers in TABA. This column is the mapping of row numbers in TABF to rows in TABA. E.g. if ROW has the value 25 in row 10, row 10 of TABF is forwarded to row 25 in TABA.

Actually, puts are not possible. When multiple rows map to the same row in the referenced table, putting a value in one row would also change the value in another row referencing the same underlying row. This could result in unexpected behaviour.

The engine consists of a set of

ForwardColumnIndexedRow objects, which handle the actual gets.

Motivation

In some ways it overlaps the functionality of the storage manager StManMirAIO. They both allow to have the same value used by multiple rows. However, StManMirAIO only allows that for consecutive rows, while this engine allows it for any row. On the other side, StManMirAIO is faster.

Example

       // The original table.
       Table tab("someTable");
       // Create another table with the same description.
       SetupNewTable newtab("tForwardColRow.data", tab.tableDesc(), Table::New);
       // Create an engine which forwards to the original table and uses
       // column rowColumn to get the row number in the referenced table.
       // Bind all columns in the new table to the forwarding engine.
       ForwardColumnIndexedRowEngine fce(tab, "rowColumn");
       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);

Definition at line 288 of file ForwardColRow.h.


Constructor & Destructor Documentation

casa::ForwardColumnIndexedRowEngine::ForwardColumnIndexedRowEngine ( const String dataManagerName,
const Record spec 
)

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

casa::ForwardColumnIndexedRowEngine::ForwardColumnIndexedRowEngine ( const Table referencedTable,
const String rowColumnName,
const String dataManagerName 
)

Create the engine.

The columns using this engine will reference the given table. The column with the given name contains the row number mapping, i.e. a row number in a get or put is converted to a row number in the referenced table using the value in this column. The data manager gets the given name.

casa::ForwardColumnIndexedRowEngine::ForwardColumnIndexedRowEngine ( const Table referencedTable,
const String rowColumnName 
)

Create the engine.

The columns using this engine will reference the given table. The column with the given name contains the row number mapping, i.e. a row number in a get or put is converted to a row number in the referenced table using the value in this column. The data manager has no name.

Destructor is mandatory.

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


Member Function Documentation

Return the name of the class.

Reimplemented from casa::ForwardColumnEngine.

Clone the engine object.

Reimplemented from casa::ForwardColumnEngine.

Convert the rownr to the rownr in the underlying table.

Definition at line 397 of file ForwardColRow.h.

References lastRow_p, rowColumn_p, and rowNumber_p.

Referenced by casa::ForwardColumnIndexedRow::convertRownr().

void casa::ForwardColumnIndexedRowEngine::create ( uInt  initialNrrow) [private, virtual]

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. It also defines a keyword containing the row column name.

Reimplemented from casa::ForwardColumnEngine.

Record a record containing data manager specifications.

Reimplemented from casa::ForwardColumnEngine.

Return the type name of the engine (i.e.

its class name ForwardColumnIndexedRowEngine).

Reimplemented from casa::ForwardColumnEngine.

DataManagerColumn* casa::ForwardColumnIndexedRowEngine::makeIndArrColumn ( const String columnName,
int  dataType,
const String dataTypeId 
) [private, virtual]

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

Reimplemented from casa::ForwardColumnEngine.

static DataManager* casa::ForwardColumnIndexedRowEngine::makeObject ( const String dataManagerName,
const Record spec 
) [static]

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.

Reimplemented from casa::ForwardColumnEngine.

DataManagerColumn* casa::ForwardColumnIndexedRowEngine::makeScalarColumn ( const String columnName,
int  dataType,
const String dataTypeId 
) [private, virtual]

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

Reimplemented from casa::ForwardColumnEngine.

ForwardColumnIndexedRowEngine& casa::ForwardColumnIndexedRowEngine::operator= ( const ForwardColumnIndexedRowEngine ) [private]

Assignment is forbidden (so it is private).

void casa::ForwardColumnIndexedRowEngine::prepare ( ) [private, virtual]

Initialize the engine.

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

Reimplemented from casa::ForwardColumnEngine.

Register the class name and the static makeObject "constructor".

This will make the engine known to the table system.

Reimplemented from casa::ForwardColumnEngine.

void casa::ForwardColumnIndexedRowEngine::reopenRW ( ) [private, virtual]

Reopen the engine for read/write access.

This cannot be done, so all columns remain readonly. The function is needed to override the behaviour of its base class.

Reimplemented from casa::ForwardColumnEngine.


Member Data Documentation

Cache of last row used to get row number.

Definition at line 378 of file ForwardColRow.h.

Referenced by convertRownr().

Define the various engine column objects.

Reimplemented from casa::ForwardColumnEngine.

Definition at line 376 of file ForwardColRow.h.

Definition at line 374 of file ForwardColRow.h.

Referenced by convertRownr().

Define the column with the row numbers (must have data type uInt).

Definition at line 373 of file ForwardColRow.h.

Definition at line 379 of file ForwardColRow.h.

Referenced by convertRownr().


The documentation for this class was generated from the following file: