Loading...
Searching...
No Matches
casacore::VirtualColumnEngine Class Reference
tables package (libcasa_tables) » DataMan_module » DataMan_module_internal_classes

More...

`#include <VirtColEng.h>`

## Public Member Functions

| VirtualColumnEngine ()
| Create the object.
virtual | ~VirtualColumnEngine ()
| VirtualColumnEngine (const VirtualColumnEngine &)=delete
| The copy constructor cannot be used for this base class.
VirtualColumnEngine & | operator= (const VirtualColumnEngine &)=delete
| Assignment cannot be used for this base class.
Public Member Functions inherited from casacore::DataManager
| DataManager ()
| Default constructor.
virtual | ~DataManager ()
| DataManager (const DataManager &)=delete
| The copy constructor cannot be used for this base class.
DataManager & | operator= (const DataManager &)=delete
| Assignment cannot be used for this base class.
virtual DataManager * | clone () const =0
| Make a clone of the derived object.
virtual String | dataManagerName () const
| Return the name of the data manager.
virtual String | dataManagerType () const =0
| Return the type name of the data manager (in fact its class name).
void | dataManagerInfo (Record &info) const
| Add SEQNR and SPEC (the DataManagerSpec subrecord) to the info.
virtual Record | dataManagerSpec () const
| Return a record containing data manager specifications.
virtual Record | getProperties () const
| Get data manager properties that can be modified.
virtual void | setProperties (const Record &spec)
| Modify data manager properties given in record fields.
virtual Bool | canReallocateColumns () const
| Tell if the data manager wants to reallocate the data manager column objects.
virtual DataManagerColumn * | reallocateColumn (DataManagerColumn *column)
| Reallocate the column object if it is part of this data manager.
uInt | sequenceNr () const
| Get the (unique) sequence nr of this data manager.
uInt | ncolumn () const
| Get the nr of columns in this data manager (can be zero).
Bool | asBigEndian () const
| Have the data to be stored in big or little endian canonical format?
const TSMOption & | tsmOption () const
| Get the TSM option.
std::shared_ptr< MultiFileBase > | multiFile ()
| Get the MultiFile pointer (can be 0).
String | keywordName (const String &keyword) const
| Compose a keyword name from the given keyword appended with the sequence number (e.g.
String | fileName () const
| Compose a unique filename from the table name and sequence number.
ByteIO::OpenOption | fileOption () const
| Get the AipsIO option of the underlying file.
virtual Bool | isRegular () const
| Is this a regular storage manager?
Table & | table () const
| Get the table this object is associated with.
virtual void | reopenRW ()
| Reopen the data manager for read/write access.
virtual Bool | canAddColumn () const
| Does the data manager allow to add columns?
virtual Bool | canRemoveColumn () const
| Does the data manager allow to delete columns?
virtual Bool | canRenameColumn () const
| Does the data manager allow to rename columns?
virtual void | setMaximumCacheSize (uInt nMiB)
| Set the maximum cache size (in bytes) to be used by a storage manager.
virtual void | showCacheStatistics (std::ostream &) const
| Show the data manager's IO statistics.
DataManagerColumn * | createScalarColumn (const String &columnName, int dataType, const String &dataTypeId)
| Create a column in the data manager on behalf of a table column.
DataManagerColumn * | createDirArrColumn (const String &columnName, int dataType, const String &dataTypeId)
| Create a direct array column.
DataManagerColumn * | createIndArrColumn (const String &columnName, int dataType, const String &dataTypeId)
| Create an indirect array column.
DataManager * | getClone () const
| Has the object already been cloned?
void | setClone (DataManager *clone) const
| Set the pointer to the clone.

## Private Member Functions

virtual Bool | isStorageManager () const
| The data manager is not a storage manager?
virtual Bool | canAddRow () const
| Does the data manager allow to add rows?
virtual Bool | canRemoveRow () const
| Does the data manager allow to delete rows?
virtual void | addRow64 (rownr_t nrrow)
| Add rows to all columns.
virtual void | removeRow64 (rownr_t rownr)
| Delete a row from all columns.
virtual Bool | flush (AipsIO &, Bool fsync)
| Flush the data in the engine object.
virtual rownr_t | resync64 (rownr_t nrrow)
| Resync the storage manager with the new file contents.
virtual void | create64 (rownr_t initialNrrow)
| Initialize the object for a new table containing initially nrrow rows.
virtual rownr_t | open64 (rownr_t 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.

## 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.
static DataManagerCtor | getCtor (const String &dataManagerType)
| Get the "constructor" of a data manager (thread-safe).
static Bool | isRegistered (const String &dataManagerType)
| Test if a data manager is registered (thread-safe).
static DataManager * | unknownDataManager (const String &dataManagerType, const Record &spec)
| Serve as default function for theirRegisterMap, which catches all unknown data manager types.
Static Public Attributes inherited from casacore::DataManager
static rownr_t | MAXROWNR32
| Define the highest row number that can be represented as signed 32-bit.
Protected Member Functions inherited from casacore::DataManager
void | decrementNcolumn ()
| Decrement number of columns (in case a column is deleted).
void | setEndian (Bool bigEndian)
| Tell the data manager if big or little endian format is needed.
void | setTsmOption (const TSMOption &tsmOption)
| Tell the data manager which TSM option to use.
void | setMultiFile (const std::shared_ptr< MultiFileBase > &mfile)
| Tell the data manager that MultiFile can be used.
virtual Bool | hasMultiFileSupport () const
| Does the data manager support use of MultiFile?
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.

## Detailed Description

Abstract base class for virtual column handling

### Intended use:

Internal

### Review Status

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

### Prerequisite

- DataManager
- Table

### 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 ScaledComplexData.

### 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 109 of file VirtColEng.h.

## Constructor & Destructor Documentation

## VirtualColumnEngine() [1/2]

casacore::VirtualColumnEngine::VirtualColumnEngine | ( |  | ) |

inline

Create the object.

Definition at line 114 of file VirtColEng.h.

Referenced by operator=(), and VirtualColumnEngine().

## ~VirtualColumnEngine()

virtual casacore::VirtualColumnEngine::~VirtualColumnEngine | ( |  | ) |

virtual

## VirtualColumnEngine() [2/2]

casacore::VirtualColumnEngine::VirtualColumnEngine | ( | const VirtualColumnEngine & |  | ) |

delete

The copy constructor cannot be used for this base class.

The clone function should be used instead.

References VirtualColumnEngine().

## Member Function Documentation

## addRow64()

virtual void casacore::VirtualColumnEngine::addRow64 | ( | rownr_t | nrrow | ) |

private virtual

Add rows to all columns.

The default implementation does nothing.

Reimplemented from casacore::DataManager.

Reimplemented in casacore::BaseMappedArrayEngine< VirtualType, StoredType >, casacore::BaseMappedArrayEngine< Bool, StoredType >, casacore::BaseMappedArrayEngine< Complex, Int >, casacore::BaseMappedArrayEngine< Float, Short >, and casacore::ForwardColumnEngine.

## canAddRow()

virtual Bool casacore::VirtualColumnEngine::canAddRow | ( |  | ) | const

private virtual

Does the data manager allow to add rows?

(default no)

Reimplemented from casacore::DataManager.

Reimplemented in casacore::ForwardColumnEngine.

## canRemoveRow()

virtual Bool casacore::VirtualColumnEngine::canRemoveRow | ( |  | ) | const

private virtual

Does the data manager allow to delete rows?

(default no)

Reimplemented from casacore::DataManager.

Reimplemented in casacore::ForwardColumnEngine.

## create64()

virtual void casacore::VirtualColumnEngine::create64 | ( | rownr_t | 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.

Reimplemented from casacore::DataManager.

Reimplemented in casacore::BaseMappedArrayEngine< VirtualType, StoredType >, casacore::BaseMappedArrayEngine< Bool, StoredType >, casacore::BaseMappedArrayEngine< Complex, Int >, casacore::BaseMappedArrayEngine< Float, Short >, casacore::BitFlagsEngine< StoredType >, casacore::CompressComplex, casacore::CompressComplexSD, casacore::CompressFloat, casacore::ForwardColumnEngine, casacore::ForwardColumnIndexedRowEngine, casacore::RetypedArrayEngine< VirtualType, StoredType >, casacore::ScaledArrayEngine< VirtualType, StoredType >, casacore::ScaledComplexData< VirtualType, StoredType >, and casacore::VirtualTaQLColumn.

## deleteManager()

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

## flush()

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

## isStorageManager()

virtual Bool casacore::VirtualColumnEngine::isStorageManager | ( |  | ) | const

private virtual

The data manager is not a storage manager?

Reimplemented from casacore::DataManager.

## makeDirArrColumn()

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

Reimplemented in casacore::VACEngine< T >.

References casacore::dataType().

## makeIndArrColumn()

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

Reimplemented in casacore::BaseMappedArrayEngine< VirtualType, StoredType >, casacore::BaseMappedArrayEngine< Bool, StoredType >, casacore::BaseMappedArrayEngine< Complex, Int >, casacore::BaseMappedArrayEngine< Float, Short >, casacore::DerivedMSCal, casacore::ForwardColumnEngine, casacore::ForwardColumnIndexedRowEngine, casacore::VACEngine< T >, and casacore::VirtualTaQLColumn.

References casacore::dataType().

## makeScalarColumn()

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

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

References casacore::dataType().

## open64()

virtual rownr_t casacore::VirtualColumnEngine::open64 | ( | rownr_t | 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.

Reimplemented from casacore::DataManager.

## operator=()

VirtualColumnEngine & casacore::VirtualColumnEngine::operator= | ( | const VirtualColumnEngine & |  | ) |

delete

Assignment cannot be used for this base class.

References VirtualColumnEngine().

## prepare()

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

Reimplemented in casacore::BaseMappedArrayEngine< VirtualType, StoredType >, casacore::BaseMappedArrayEngine< Bool, StoredType >, casacore::BaseMappedArrayEngine< Complex, Int >, casacore::BaseMappedArrayEngine< Float, Short >, casacore::BitFlagsEngine< StoredType >, casacore::CompressComplex, casacore::CompressFloat, casacore::DerivedMSCal, casacore::ForwardColumnEngine, casacore::ForwardColumnIndexedRowEngine, casacore::RetypedArrayEngine< VirtualType, StoredType >, casacore::ScaledArrayEngine< VirtualType, StoredType >, casacore::ScaledComplexData< VirtualType, StoredType >, and casacore::VirtualTaQLColumn.

## removeRow64()

virtual void casacore::VirtualColumnEngine::removeRow64 | ( | rownr_t | rownr | ) |

private virtual

Delete a row from all columns.

The default implementation does nothing.

Reimplemented from casacore::DataManager.

Reimplemented in casacore::ForwardColumnEngine.

## resync64()

virtual rownr_t casacore::VirtualColumnEngine::resync64 | ( | rownr_t | nrrow | ) |

private virtual

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.

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

- tables/DataMan/VirtColEng.h