casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::ForwardColumnIndexedRowEngine Class Reference

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

#include <ForwardColRow.h>

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

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. More...
 
 ForwardColumnIndexedRowEngine (const Table &referencedTable, const String &rowColumnName, const String &dataManagerName)
 Create the engine. More...
 
 ForwardColumnIndexedRowEngine (const Table &referencedTable, const String &rowColumnName)
 Create the engine. More...
 
 ~ForwardColumnIndexedRowEngine ()
 Destructor is mandatory. More...
 
DataManagerclone () const
 Clone the engine object. More...
 
String dataManagerType () const
 Return the type name of the engine (i.e. More...
 
virtual Record dataManagerSpec () const
 Record a record containing data manager specifications. More...
 
uInt convertRownr (uInt rownr)
 Convert the rownr to the rownr in the underlying table. More...
 
- Public Member Functions inherited from casacore::ForwardColumnEngine
 ForwardColumnEngine (const String &dataManagerName, const Record &spec)
 The default constructor is required for reconstruction of the engine when a table is read back. More...
 
 ForwardColumnEngine (const Table &referencedTable, const String &dataManagerName)
 Create the engine. More...
 
 ForwardColumnEngine (const Table &referencedTable)
 Create the engine. More...
 
 ~ForwardColumnEngine ()
 Destructor is mandatory. More...
 
DataManagerclone () const
 Clone the engine object. More...
 
String dataManagerName () const
 Return the name of the data manager. More...
 
String dataManagerType () const
 Return the type of the engine (i.e. More...
 
const Stringsuffix () const
 Get the suffix to be used for names. More...
 
void setRefTable (const Table &refTable)
 Set RefTable_p if not set yet. More...
 
- Public Member Functions inherited from casacore::VirtualColumnEngine
 VirtualColumnEngine ()
 Create the object. More...
 
virtual ~VirtualColumnEngine ()
 
- Public Member Functions inherited from casacore::DataManager
 DataManager ()
 Default constructor. More...
 
virtual ~DataManager ()
 
void dataManagerInfo (Record &info) const
 Add SEQNR and SPEC (the DataManagerSpec subrecord) to the info. More...
 
virtual Record getProperties () const
 Get data manager properties that can be modified. More...
 
virtual void setProperties (const Record &spec)
 Modify data manager properties given in record fields. More...
 
virtual Bool canReallocateColumns () const
 Tell if the data manager wants to reallocate the data manager column objects. More...
 
virtual DataManagerColumnreallocateColumn (DataManagerColumn *column)
 Reallocate the column object if it is part of this data manager. More...
 
uInt sequenceNr () const
 Get the (unique) sequence nr of this data manager. More...
 
uInt ncolumn () const
 Get the nr of columns in this data manager (can be zero). More...
 
Bool asBigEndian () const
 Have the data to be stored in big or little endian canonical format? More...
 
const TSMOptiontsmOption () const
 Get the TSM option. More...
 
MultiFileBasemultiFile ()
 Get the MultiFile pointer (can be 0). More...
 
String keywordName (const String &keyword) const
 Compose a keyword name from the given keyword appended with the sequence number (e.g. More...
 
String fileName () const
 Compose a unique filename from the table name and sequence number. More...
 
ByteIO::OpenOption fileOption () const
 Get the AipsIO option of the underlying file. More...
 
virtual Bool isRegular () const
 Is this a regular storage manager? It is regular if it allows addition of rows and writing data in them. More...
 
Tabletable () const
 Get the table this object is associated with. More...
 
virtual Bool canRenameColumn () const
 Does the data manager allow to rename columns? (default yes) More...
 
virtual void setMaximumCacheSize (uInt nbytes)
 Set the maximum cache size (in bytes) to be used by a storage manager. More...
 
virtual void showCacheStatistics (std::ostream &) const
 Show the data manager's IO statistics. More...
 
DataManagerColumncreateScalarColumn (const String &columnName, int dataType, const String &dataTypeId)
 Create a column in the data manager on behalf of a table column. More...
 
DataManagerColumncreateDirArrColumn (const String &columnName, int dataType, const String &dataTypeId)
 Create a direct array column. More...
 
DataManagerColumncreateIndArrColumn (const String &columnName, int dataType, const String &dataTypeId)
 Create an indirect array column. More...
 
DataManagergetClone () const
 Has the object already been cloned? More...
 
void setClone (DataManager *clone) const
 Set the pointer to the clone. More...
 

Static Public Member Functions

static String className ()
 Return the name of the class. More...
 
static void registerClass ()
 Register the class name and the static makeObject "constructor". More...
 
static DataManagermakeObject (const String &dataManagerName, const Record &spec)
 Define the "constructor" to construct this engine when a table is read back. More...
 
- Static Public Member Functions inherited from casacore::ForwardColumnEngine
static String className ()
 Return the name of the class. More...
 
static void registerClass ()
 Register the class name and the static makeObject "constructor". More...
 
static DataManagermakeObject (const String &dataManagerType, const Record &spec)
 Define the "constructor" to construct this engine when a table is read back. More...
 
- Static Public Member Functions inherited from casacore::DataManager
static void registerCtor (const String &type, DataManagerCtor func)
 Register a mapping of a data manager type to its static construction function. More...
 
static DataManagerCtor getCtor (const String &dataManagerType)
 Get the "constructor" of a data manager (thread-safe). More...
 
static Bool isRegistered (const String &dataManagerType)
 Test if a data manager is registered (thread-safe). More...
 
static DataManagerunknownDataManager (const String &dataManagerType, const Record &spec)
 Serve as default function for theirRegisterMap, which catches all unknown data manager types. More...
 

Private Member Functions

 ForwardColumnIndexedRowEngine (const ForwardColumnIndexedRowEngine &)
 The copy constructor is forbidden (so it is private). More...
 
ForwardColumnIndexedRowEngineoperator= (const ForwardColumnIndexedRowEngine &)
 Assignment is forbidden (so it is private). More...
 
DataManagerColumnmakeScalarColumn (const String &columnName, int dataType, const String &dataTypeId)
 Create the column object for the scalar column in this engine. More...
 
DataManagerColumnmakeIndArrColumn (const String &columnName, int dataType, const String &dataTypeId)
 Create the column object for the indirect array column in this engine. More...
 
void create (uInt initialNrrow)
 Initialize the object for a new table. More...
 
void prepare ()
 Initialize the engine. More...
 
void reopenRW ()
 Reopen the engine for read/write access. More...
 

Private Attributes

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

Additional Inherited Members

- Protected Member Functions inherited from casacore::ForwardColumnEngine
void setSuffix (const String &suffix)
 Set the suffix. More...
 
void addForwardColumn (ForwardColumn *colp)
 Add a ForwardColumn object to the block. More...
 
const TablerefTable () const
 Get access to the refTable_p data member. More...
 
void baseCreate ()
 Do the creation (i.e. More...
 
void basePrepare ()
 Do the preparation of the engine by preparing all columns. More...
 
- Protected Member Functions inherited from casacore::DataManager
void decrementNcolumn ()
 Decrement number of columns (in case a column is deleted). More...
 
void setEndian (Bool bigEndian)
 Tell the data manager if big or little endian format is needed. More...
 
void setTsmOption (const TSMOption &tsmOption)
 Tell the data manager which TSM option to use. More...
 
void setMultiFile (MultiFileBase *mfile)
 Tell the data manager that MultiFile can be used. More...
 
virtual Bool hasMultiFileSupport () const
 Does the data manager support use of MultiFile? A derived class has to return True if it can use the MultiFile. More...
 
void throwDataTypeOther (const String &columnName, int dataType) const
 Throw an exception in case data type is TpOther, because the storage managers (and maybe other data managers) do not support such columns. More...
 

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 291 of file ForwardColRow.h.

Constructor & Destructor Documentation

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

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

casacore::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.

casacore::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.

casacore::ForwardColumnIndexedRowEngine::~ForwardColumnIndexedRowEngine ( )

Destructor is mandatory.

casacore::ForwardColumnIndexedRowEngine::ForwardColumnIndexedRowEngine ( const ForwardColumnIndexedRowEngine )
private

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

Member Function Documentation

static String casacore::ForwardColumnIndexedRowEngine::className ( )
static

Return the name of the class.

DataManager* casacore::ForwardColumnIndexedRowEngine::clone ( ) const
virtual

Clone the engine object.

Implements casacore::DataManager.

uInt casacore::ForwardColumnIndexedRowEngine::convertRownr ( uInt  rownr)
inline

Convert the rownr to the rownr in the underlying table.

Definition at line 400 of file ForwardColRow.h.

References lastRow_p, rowColumn_p, and rowNumber_p.

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

void casacore::ForwardColumnIndexedRowEngine::create ( uInt  initialNrrow)
privatevirtual

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 casacore::VirtualColumnEngine.

virtual Record casacore::ForwardColumnIndexedRowEngine::dataManagerSpec ( ) const
virtual

Record a record containing data manager specifications.

Reimplemented from casacore::ForwardColumnEngine.

String casacore::ForwardColumnIndexedRowEngine::dataManagerType ( ) const
virtual

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

its class name ForwardColumnIndexedRowEngine).

Implements casacore::DataManager.

DataManagerColumn* casacore::ForwardColumnIndexedRowEngine::makeIndArrColumn ( const String columnName,
int  dataType,
const String dataTypeId 
)
privatevirtual

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

Reimplemented from casacore::VirtualColumnEngine.

static DataManager* casacore::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.

DataManagerColumn* casacore::ForwardColumnIndexedRowEngine::makeScalarColumn ( const String columnName,
int  dataType,
const String dataTypeId 
)
privatevirtual

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

Reimplemented from casacore::VirtualColumnEngine.

ForwardColumnIndexedRowEngine& casacore::ForwardColumnIndexedRowEngine::operator= ( const ForwardColumnIndexedRowEngine )
private

Assignment is forbidden (so it is private).

void casacore::ForwardColumnIndexedRowEngine::prepare ( )
privatevirtual

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 casacore::VirtualColumnEngine.

static void casacore::ForwardColumnIndexedRowEngine::registerClass ( )
static

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

This will make the engine known to the table system.

void casacore::ForwardColumnIndexedRowEngine::reopenRW ( )
privatevirtual

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 casacore::DataManager.

Member Data Documentation

Int casacore::ForwardColumnIndexedRowEngine::lastRow_p
private

Cache of last row used to get row number.

Definition at line 381 of file ForwardColRow.h.

Referenced by convertRownr().

PtrBlock<ForwardColumnIndexedRow*> casacore::ForwardColumnIndexedRowEngine::refColumns_p
private

Define the various engine column objects.

Definition at line 379 of file ForwardColRow.h.

ScalarColumn<uInt> casacore::ForwardColumnIndexedRowEngine::rowColumn_p
private

Definition at line 377 of file ForwardColRow.h.

Referenced by convertRownr().

String casacore::ForwardColumnIndexedRowEngine::rowColumnName_p
private

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

Definition at line 376 of file ForwardColRow.h.

uInt casacore::ForwardColumnIndexedRowEngine::rowNumber_p
private

Definition at line 382 of file ForwardColRow.h.

Referenced by convertRownr().


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