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

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

#include <VirtColEng.h>

Inheritance diagram for casacore::VirtualColumnEngine:
casacore::DataManager casacore::BaseMappedArrayEngine< Bool, StoredType > casacore::BaseMappedArrayEngine< Complex, Int > casacore::BaseMappedArrayEngine< Float, Short > casacore::BaseMappedArrayEngine< VirtualType, StoredType > casacore::DerivedMSCal casacore::ForwardColumnEngine casacore::VirtualTaQLColumn casacore::VSCEngine< T >

Public Member Functions

 VirtualColumnEngine ()
 Create the object. More...
 
virtual ~VirtualColumnEngine ()
 
- Public Member Functions inherited from casacore::DataManager
 DataManager ()
 Default constructor. More...
 
virtual ~DataManager ()
 
virtual DataManagerclone () 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 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 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 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...
 

Private Member Functions

 VirtualColumnEngine (const VirtualColumnEngine &that)
 The copy constructor cannot be used for this base class. More...
 
VirtualColumnEngineoperator= (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 addRow (uInt nrrow)
 Add rows to all columns. More...
 
virtual void removeRow (uInt rownr)
 Delete a row from all columns. More...
 
virtual Bool flush (AipsIO &, Bool fsync)
 Flush the data in the engine object. More...
 
virtual void resync (uInt nrrow)
 Resync the storage manager with the new file contents. More...
 
virtual void create (uInt initialNrrow)
 Initialize the object for a new table containing initially nrrow rows. More...
 
virtual void open (uInt 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 DataManagerColumnmakeScalarColumn (const String &columnName, int dataType, const String &dataTypeId)
 Make a column object in the engine on behalf of a table column. More...
 
virtual DataManagerColumnmakeDirArrColumn (const String &columnName, int dataType, const String &dataTypeId)
 Create a direct array column. More...
 
virtual DataManagerColumnmakeIndArrColumn (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 DataManagerunknownDataManager (const String &dataManagerType, const Record &spec)
 Serve as default function for theirRegisterMap, which catches all unknown data manager types. 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

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

casacore::VirtualColumnEngine::VirtualColumnEngine ( )
inline

Create the object.

Definition at line 116 of file VirtColEng.h.

virtual casacore::VirtualColumnEngine::~VirtualColumnEngine ( )
virtual
casacore::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.

Member Function Documentation

virtual void casacore::VirtualColumnEngine::addRow ( uInt  nrrow)
privatevirtual
virtual Bool casacore::VirtualColumnEngine::canAddRow ( ) const
privatevirtual

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

Reimplemented from casacore::DataManager.

Reimplemented in casacore::ForwardColumnEngine.

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

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

Reimplemented from casacore::DataManager.

Reimplemented in casacore::ForwardColumnEngine.

virtual void casacore::VirtualColumnEngine::create ( uInt  initialNrrow)
privatevirtual
virtual void casacore::VirtualColumnEngine::deleteManager ( )
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.

virtual Bool casacore::VirtualColumnEngine::flush ( AipsIO ,
Bool  fsync 
)
privatevirtual

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.

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

The data manager is not a storage manager?

Reimplemented from casacore::DataManager.

virtual DataManagerColumn* casacore::VirtualColumnEngine::makeDirArrColumn ( const String columnName,
int  dataType,
const String dataTypeId 
)
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.

virtual DataManagerColumn* casacore::VirtualColumnEngine::makeIndArrColumn ( const String columnName,
int  dataType,
const String dataTypeId 
)
privatevirtual
virtual DataManagerColumn* casacore::VirtualColumnEngine::makeScalarColumn ( const String columnName,
int  dataType,
const String dataTypeId 
)
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.

virtual void casacore::VirtualColumnEngine::open ( uInt  nrrow,
AipsIO mainTableFile 
)
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.

Implements casacore::DataManager.

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

Assignment cannot be used for this base class.

The private declaration of this operator makes it unusable.

virtual void casacore::VirtualColumnEngine::prepare ( )
privatevirtual
virtual void casacore::VirtualColumnEngine::removeRow ( uInt  rownr)
privatevirtual

Delete a row from all columns.

The default implementation does nothing.

Reimplemented from casacore::DataManager.

Reimplemented in casacore::ForwardColumnEngine.

virtual void casacore::VirtualColumnEngine::resync ( uInt  nrrow)
privatevirtual

Resync the storage manager with the new file contents.

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

Implements casacore::DataManager.


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