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

Abstract base class for virtual column handling. More...

#include <VirtColEng.h>

Inheritance diagram for casa::VirtualColumnEngine:
casa::DataManager casa::BaseMappedArrayEngine< Bool, StoredType > casa::BaseMappedArrayEngine< Complex, Int > casa::BaseMappedArrayEngine< Float, Short > casa::BaseMappedArrayEngine< VirtualType, StoredType > casa::ForwardColumnEngine casa::VirtualTaQLColumn casa::VSCEngine< T > casa::BitFlagsEngine< StoredType > casa::CompressComplex casa::CompressFloat casa::MappedArrayEngine< VirtualType, StoredType > casa::RetypedArrayEngine< VirtualType, StoredType > casa::ScaledArrayEngine< VirtualType, StoredType > casa::ScaledComplexData< VirtualType, StoredType > casa::ForwardColumnIndexedRowEngine

List of all members.

Public Member Functions

 VirtualColumnEngine ()
 Create the object.
virtual ~VirtualColumnEngine ()

Private Member Functions

 VirtualColumnEngine (const VirtualColumnEngine &that)
 The copy constructor cannot be used for this base class.
VirtualColumnEngineoperator= (const VirtualColumnEngine &)
 Assignment cannot be used for this base class.
virtual Bool isStorageManager () const
 The data manager is not a storage manager?
virtual Bool canAddRow () const
 Does the data manager allow to add rows? (default no)
virtual Bool canRemoveRow () const
 Does the data manager allow to delete rows? (default no)
virtual void addRow (uInt nrrow)
 Add rows to all columns.
virtual void removeRow (uInt rownr)
 Delete a row from all columns.
virtual Bool flush (AipsIO &, Bool fsync)
 Flush the data in the engine object.
virtual void resync (uInt nrrow)
 Resync the storage manager with the new file contents.
virtual void create (uInt initialNrrow)
 Initialize the object for a new table containing initially nrrow rows.
virtual void open (uInt nrrow, AipsIO &mainTableFile)
 Initialize the object for an existing table containing nrrow rows.
virtual void prepare ()
 Let the data manager initialize itself further.
virtual void deleteManager ()
 The data manager will be deleted (because all its columns are requested to be deleted).
virtual DataManagerColumnmakeScalarColumn (const String &columnName, int dataType, const String &dataTypeId)
 Make a column object in the engine on behalf of a table column.
virtual DataManagerColumnmakeDirArrColumn (const String &columnName, int dataType, const String &dataTypeId)
 Create a direct array column.
virtual DataManagerColumnmakeIndArrColumn (const String &columnName, int dataType, const String &dataTypeId)
 Create an indirect array column.

Detailed Description

Abstract base class for virtual column handling.

Intended use:

Internal

Review Status

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

Prerequisite

Etymology

VirtualColumnEngine is the abstract data manager class for specialized classes (engines) handling a group of virtual columns.

Synopsis

VirtualColumnEngine is the data manager for classes handling a group of virtual columns in tables. It is an abstract base class for the specialized virtual column engines. Each virtual column as such is represented by a class which has to be derived from the abstract base classes VirtualScalarColumn or VirtualArrayColumn. The engine has to create the various column objects via the functions makeXXXColumn.

Initialization of the virtual column engine is done by the functions create (for new tables), open (for existing tables) and prepare. The engine can be flushed by the function flush, which allows to write some data. The function open can read these data back. VirtualColumnEngine is closely related with the table system.

A number of (pure) virtual functions have been defined. The pure virtual functions must be implemented in the derived class. The non-pure virtual functions have a default implementation throwing a "not possible" exception. They need to be implemented if they are used for this engine (e.g. makeIndArrColumn does not need to be implemented if the engine does not handle arrays). Furthermore the pure virtual function dataManagerType (defined in DataManager.h) has to be implemented. This should return the name of the data manager, which is usually its class name. This name has to be unique; so if the engine is templated, the template parameter has to be part of the data manager name.

The engine has to be registered before it can be used by the table system. This means that a special makeObject function has to be made known to the table system, which allows the table system to reconstruct the engine using its name.

An example of a virtual column engine can be found in dVirtColEng.{h,cc} in the test directory of the Tables module. Another exanple is class ScaledArray.

Motivation

It is nice if a table column can be expressed as a function of other columns (maybe even in other tables). A virtual column provides this functionality in a very flexible way. A specialized class can calculate the data of a virtual column, but a common base class is required to interface it to the table system.

Definition at line 111 of file VirtColEng.h.


Constructor & Destructor Documentation

Create the object.

Definition at line 116 of file VirtColEng.h.

The copy constructor cannot be used for this base class.

The clone function should be used instead. The private declaration of this constructor makes it unusable.


Member Function Documentation

virtual void casa::VirtualColumnEngine::addRow ( uInt  nrrow) [private, virtual]
virtual Bool casa::VirtualColumnEngine::canAddRow ( ) const [private, virtual]

Does the data manager allow to add rows? (default no)

Reimplemented from casa::DataManager.

Reimplemented in casa::ForwardColumnEngine.

virtual Bool casa::VirtualColumnEngine::canRemoveRow ( ) const [private, virtual]

Does the data manager allow to delete rows? (default no)

Reimplemented from casa::DataManager.

Reimplemented in casa::ForwardColumnEngine.

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

The data manager will be deleted (because all its columns are requested to be deleted).

So clean up the things needed (e.g. delete files). By default it assumes that nothing has to be done.

Implements casa::DataManager.

virtual Bool casa::VirtualColumnEngine::flush ( AipsIO ,
Bool  fsync 
) [private, virtual]

Flush the data in the engine object.

If the object contains persistent data, this is the place to write them. This can be done in two ways:

  • They can be written in the main table file (using the AipsIO argument). This should preferably be used if the object contains only little data.
  • They can be written in a file of its own. A unique filename can be acquired using DataManager::fileName(). This way is preferred when the object contains a lot of data. Possibly this file could already be created in function create and only be flushed and closed in this function. This allows getting and putting of data as needed.

Another way of storing information is by storing it as a keyword in the table. In this case it is important to know that close is called AFTER the keywords are written. Thus, in this way the information has to be stored and read back in create, open and/or prepare. It returns a True status if it had to flush (i.e. if data have changed).
The default implementation does nothing and returns False.

Implements casa::DataManager.

virtual Bool casa::VirtualColumnEngine::isStorageManager ( ) const [private, virtual]

The data manager is not a storage manager?

Reimplemented from casa::DataManager.

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

Create a direct array column.

The default implementation calls makeIndArrColumn (when reading the user sees no difference between direct and indirect).

Implements casa::DataManager.

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

Make a column object in the engine on behalf of a table column.

This column object class is derived from VirtualScalarColumn or VirtualArrayColumn. It handles the gets and puts of data.

Create a scalar column. The default implementation throws an exception that it cannot do it for this column.

Implements casa::DataManager.

Reimplemented in casa::ForwardColumnEngine, casa::ForwardColumnIndexedRowEngine, casa::VSCEngine< T >, and casa::VirtualTaQLColumn.

virtual void casa::VirtualColumnEngine::open ( uInt  nrrow,
AipsIO mainTableFile 
) [private, virtual]

Initialize the object for an existing table containing nrrow rows.

It can be used to read values back (written by close) and/or to initialize variables (possibly using data from other columns in the table). The default implementation does nothing.

Implements casa::DataManager.

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

Assignment cannot be used for this base class.

The private declaration of this operator makes it unusable.

virtual void casa::VirtualColumnEngine::prepare ( ) [private, virtual]
virtual void casa::VirtualColumnEngine::removeRow ( uInt  rownr) [private, virtual]

Delete a row from all columns.

The default implementation does nothing.

Reimplemented from casa::DataManager.

Reimplemented in casa::ForwardColumnEngine.

virtual void casa::VirtualColumnEngine::resync ( uInt  nrrow) [private, virtual]

Resync the storage manager with the new file contents.

This is done by clearing the cache. The default implementation does nothing.

Implements casa::DataManager.


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