casa
$Rev:20696$
|
Abstract base class for virtual column handling. More...
#include <VirtColEng.h>
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. | |
VirtualColumnEngine & | operator= (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 DataManagerColumn * | makeScalarColumn (const String &columnName, int dataType, const String &dataTypeId) |
Make a column object in the engine on behalf of a table column. | |
virtual DataManagerColumn * | makeDirArrColumn (const String &columnName, int dataType, const String &dataTypeId) |
Create a direct array column. | |
virtual DataManagerColumn * | makeIndArrColumn (const String &columnName, int dataType, const String &dataTypeId) |
Create an indirect array column. |
Abstract base class for virtual column handling.
Internal
VirtualColumnEngine is the abstract data manager class for specialized classes (engines) handling a group of virtual columns.
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.
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.
casa::VirtualColumnEngine::VirtualColumnEngine | ( | ) | [inline] |
Create the object.
Definition at line 116 of file VirtColEng.h.
virtual casa::VirtualColumnEngine::~VirtualColumnEngine | ( | ) | [virtual] |
casa::VirtualColumnEngine::VirtualColumnEngine | ( | const VirtualColumnEngine & | that | ) | [private] |
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.
virtual void casa::VirtualColumnEngine::addRow | ( | uInt | nrrow | ) | [private, virtual] |
Add rows to all columns.
The default implementation does nothing.
Reimplemented from casa::DataManager.
Reimplemented in casa::ForwardColumnEngine, casa::BaseMappedArrayEngine< VirtualType, StoredType >, casa::BaseMappedArrayEngine< Complex, Int >, casa::BaseMappedArrayEngine< Float, Short >, and casa::BaseMappedArrayEngine< Bool, StoredType >.
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] |
Initialize the object for a new table containing initially nrrow rows.
It can be used to initialize variables (possibly using data from other columns in the table). The default implementation does nothing.
Implements casa::DataManager.
Reimplemented in casa::ForwardColumnEngine, casa::RetypedArrayEngine< VirtualType, StoredType >, casa::CompressComplexSD, casa::ForwardColumnIndexedRowEngine, casa::BaseMappedArrayEngine< VirtualType, StoredType >, casa::BaseMappedArrayEngine< Complex, Int >, casa::BaseMappedArrayEngine< Float, Short >, casa::BaseMappedArrayEngine< Bool, StoredType >, casa::BitFlagsEngine< StoredType >, casa::ScaledComplexData< VirtualType, StoredType >, casa::ScaledArrayEngine< VirtualType, StoredType >, casa::CompressComplex, casa::CompressFloat, and casa::VirtualTaQLColumn.
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:
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] |
Create an indirect array 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::BaseMappedArrayEngine< VirtualType, StoredType >, casa::BaseMappedArrayEngine< Complex, Int >, casa::BaseMappedArrayEngine< Float, Short >, casa::BaseMappedArrayEngine< Bool, StoredType >, and casa::VirtualTaQLColumn.
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] |
Let the data manager initialize itself further.
Prepare is called after create/open has been called for all columns. In this way one can be sure that referenced columns are read back and partly initialized. The default implementation does nothing.
Reimplemented from casa::DataManager.
Reimplemented in casa::ForwardColumnEngine, casa::RetypedArrayEngine< VirtualType, StoredType >, casa::ForwardColumnIndexedRowEngine, casa::BaseMappedArrayEngine< VirtualType, StoredType >, casa::BaseMappedArrayEngine< Complex, Int >, casa::BaseMappedArrayEngine< Float, Short >, casa::BaseMappedArrayEngine< Bool, StoredType >, casa::BitFlagsEngine< StoredType >, casa::ScaledComplexData< VirtualType, StoredType >, casa::ScaledArrayEngine< VirtualType, StoredType >, casa::CompressComplex, casa::CompressFloat, and casa::VirtualTaQLColumn.
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.