casacore
|
Abstract base class for virtual column handling. More...
#include <VirtColEng.h>
Public Member Functions | |
VirtualColumnEngine () | |
Create the object. More... | |
virtual | ~VirtualColumnEngine () |
Public Member Functions inherited from casacore::DataManager | |
DataManager () | |
Default constructor. More... | |
virtual | ~DataManager () |
virtual DataManager * | clone () const =0 |
Make a clone of the derived object. More... | |
virtual String | dataManagerName () const |
Return the name of the data manager. More... | |
virtual String | dataManagerType () const =0 |
Return the type name of the data manager (in fact its class name). More... | |
void | dataManagerInfo (Record &info) const |
Add SEQNR and SPEC (the DataManagerSpec subrecord) to the info. More... | |
virtual Record | dataManagerSpec () const |
Return a record containing data manager specifications. 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 DataManagerColumn * | reallocateColumn (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 TSMOption & | tsmOption () const |
Get the TSM option. More... | |
MultiFileBase * | multiFile () |
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... | |
Table & | table () const |
Get the table this object is associated with. More... | |
virtual void | reopenRW () |
Reopen the data manager for read/write access. More... | |
virtual Bool | canAddColumn () const |
Does the data manager allow to add columns? (default no) More... | |
virtual Bool | canRemoveColumn () const |
Does the data manager allow to delete columns? (default no) More... | |
virtual Bool | canRenameColumn () const |
Does the data manager allow to rename columns? (default yes) More... | |
virtual void | setMaximumCacheSize (uInt nMiB) |
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... | |
DataManagerColumn * | createScalarColumn (const String &columnName, int dataType, const String &dataTypeId) |
Create a column in the data manager on behalf of a table column. More... | |
DataManagerColumn * | createDirArrColumn (const String &columnName, int dataType, const String &dataTypeId) |
Create a direct array column. More... | |
DataManagerColumn * | createIndArrColumn (const String &columnName, int dataType, const String &dataTypeId) |
Create an indirect array column. More... | |
DataManager * | getClone () const |
Has the object already been cloned? More... | |
void | setClone (DataManager *clone) const |
Set the pointer to the clone. More... | |
Private Member Functions | |
VirtualColumnEngine (const VirtualColumnEngine &that) | |
The copy constructor cannot be used for this base class. More... | |
VirtualColumnEngine & | operator= (const VirtualColumnEngine &) |
Assignment cannot be used for this base class. More... | |
virtual Bool | isStorageManager () const |
The data manager is not a storage manager? More... | |
virtual Bool | canAddRow () const |
Does the data manager allow to add rows? (default no) More... | |
virtual Bool | canRemoveRow () const |
Does the data manager allow to delete rows? (default no) More... | |
virtual void | addRow64 (rownr_t nrrow) |
Add rows to all columns. More... | |
virtual void | removeRow64 (rownr_t rownr) |
Delete a row from all columns. More... | |
virtual Bool | flush (AipsIO &, Bool fsync) |
Flush the data in the engine object. More... | |
virtual rownr_t | resync64 (rownr_t nrrow) |
Resync the storage manager with the new file contents. More... | |
virtual void | create64 (rownr_t initialNrrow) |
Initialize the object for a new table containing initially nrrow rows. More... | |
virtual rownr_t | open64 (rownr_t nrrow, AipsIO &mainTableFile) |
Initialize the object for an existing table containing nrrow rows. More... | |
virtual void | prepare () |
Let the data manager initialize itself further. More... | |
virtual void | deleteManager () |
The data manager will be deleted (because all its columns are requested to be deleted). More... | |
virtual DataManagerColumn * | makeScalarColumn (const String &columnName, int dataType, const String &dataTypeId) |
Make a column object in the engine on behalf of a table column. More... | |
virtual DataManagerColumn * | makeDirArrColumn (const String &columnName, int dataType, const String &dataTypeId) |
Create a direct array column. More... | |
virtual DataManagerColumn * | makeIndArrColumn (const String &columnName, int dataType, const String &dataTypeId) |
Create an indirect array column. More... | |
Additional Inherited Members | |
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 DataManager * | unknownDataManager (const String &dataManagerType, const Record &spec) |
Serve as default function for theirRegisterMap, which catches all unknown data manager types. More... | |
Static Public Attributes inherited from casacore::DataManager | |
static rownr_t | MAXROWNR32 |
Define the highest row number that can be represented as signed 32-bit. 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... | |
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 ScaledComplexData.
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.
|
inline |
Create the object.
Definition at line 116 of file VirtColEng.h.
|
virtual |
|
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.
|
privatevirtual |
Add rows to all columns.
The default implementation does nothing.
Reimplemented from casacore::DataManager.
Reimplemented in casacore::ForwardColumnEngine, casacore::BaseMappedArrayEngine< VirtualType, StoredType >, casacore::BaseMappedArrayEngine< Complex, Int >, casacore::BaseMappedArrayEngine< Float, Short >, and casacore::BaseMappedArrayEngine< Bool, StoredType >.
|
privatevirtual |
Does the data manager allow to add rows? (default no)
Reimplemented from casacore::DataManager.
Reimplemented in casacore::ForwardColumnEngine.
|
privatevirtual |
Does the data manager allow to delete rows? (default no)
Reimplemented from casacore::DataManager.
Reimplemented in casacore::ForwardColumnEngine.
|
privatevirtual |
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.
Reimplemented from casacore::DataManager.
Reimplemented in casacore::RetypedArrayEngine< VirtualType, StoredType >, casacore::ForwardColumnEngine, casacore::CompressComplexSD, casacore::ForwardColumnIndexedRowEngine, casacore::BaseMappedArrayEngine< VirtualType, StoredType >, casacore::BaseMappedArrayEngine< Complex, Int >, casacore::BaseMappedArrayEngine< Float, Short >, casacore::BaseMappedArrayEngine< Bool, StoredType >, casacore::BitFlagsEngine< StoredType >, casacore::ScaledComplexData< VirtualType, StoredType >, casacore::ScaledArrayEngine< VirtualType, StoredType >, casacore::CompressComplex, casacore::CompressFloat, and casacore::VirtualTaQLColumn.
|
privatevirtual |
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 casacore::DataManager.
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 casacore::DataManager.
|
privatevirtual |
The data manager is not a storage manager?
Reimplemented from casacore::DataManager.
|
privatevirtual |
Create a direct array column.
The default implementation calls makeIndArrColumn (when reading the user sees no difference between direct and indirect).
Implements casacore::DataManager.
Reimplemented in casacore::VACEngine< T >.
|
privatevirtual |
Create an indirect array column.
The default implementation throws an exception that it cannot do it for this column.
Implements casacore::DataManager.
Reimplemented in casacore::ForwardColumnEngine, casacore::ForwardColumnIndexedRowEngine, casacore::VACEngine< T >, casacore::BaseMappedArrayEngine< VirtualType, StoredType >, casacore::BaseMappedArrayEngine< Complex, Int >, casacore::BaseMappedArrayEngine< Float, Short >, casacore::BaseMappedArrayEngine< Bool, StoredType >, casacore::DerivedMSCal, and casacore::VirtualTaQLColumn.
|
privatevirtual |
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 casacore::DataManager.
Reimplemented in casacore::ForwardColumnEngine, casacore::ForwardColumnIndexedRowEngine, casacore::VSCEngine< T >, casacore::DerivedMSCal, and casacore::VirtualTaQLColumn.
|
privatevirtual |
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.
Reimplemented from casacore::DataManager.
|
private |
Assignment cannot be used for this base class.
The private declaration of this operator makes it unusable.
|
privatevirtual |
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 casacore::DataManager.
Reimplemented in casacore::RetypedArrayEngine< VirtualType, StoredType >, casacore::ForwardColumnEngine, casacore::ForwardColumnIndexedRowEngine, casacore::BaseMappedArrayEngine< VirtualType, StoredType >, casacore::BaseMappedArrayEngine< Complex, Int >, casacore::BaseMappedArrayEngine< Float, Short >, casacore::BaseMappedArrayEngine< Bool, StoredType >, casacore::BitFlagsEngine< StoredType >, casacore::ScaledComplexData< VirtualType, StoredType >, casacore::ScaledArrayEngine< VirtualType, StoredType >, casacore::CompressComplex, casacore::CompressFloat, casacore::VirtualTaQLColumn, and casacore::DerivedMSCal.
|
privatevirtual |
Delete a row from all columns.
The default implementation does nothing.
Reimplemented from casacore::DataManager.
Reimplemented in casacore::ForwardColumnEngine.
Resync the storage manager with the new file contents.
This is done by clearing the cache. The default implementation does nothing.
Reimplemented from casacore::DataManager.