casacore
Public Member Functions | Private Member Functions | Private Attributes | List of all members

More...

#include <MemoryTable.h>

Public Member Functions

 MemoryTable (SetupNewTable &, rownr_t nrrow, Bool initialize)
 Create the table in memory using the definitions in the SetupNewTable object. More...
 
virtual ~MemoryTable ()
 The destructor deletes all data. More...
 
virtual void reopenRW ()
 Try to reopen the table (the underlying one) for read/write access. More...
 
virtual Bool asBigEndian () const
 Is the table stored in big or little endian format? It returns the endian format of the machine. More...
 
virtual const StorageOptionstorageOption () const
 Get the storage option used for the table. More...
 
virtual Bool isMultiUsed (Bool checkSubTable) const
 Is the table in use (i.e. More...
 
virtual const TableLocklockOptions () const
 Get the locking info. More...
 
virtual void mergeLock (const TableLock &lockOptions)
 Merge the given lock info with the existing one. More...
 
virtual Bool hasLock (FileLocker::LockType) const
 Has this process the read or write lock, thus can the table be read or written safely? It always returns True. More...
 
virtual Bool lock (FileLocker::LockType, uInt nattempts)
 Locking the table is a no-op. More...
 
virtual void unlock ()
 Unlocking the table is a no-op. More...
 
virtual void flush (Bool fsync, Bool recursive)
 Flushing the table is a no-op. More...
 
virtual void resync ()
 Resyncing the Table is a no-op. More...
 
virtual uInt getModifyCounter () const
 Get the modify counter. More...
 
virtual Bool isWritable () const
 Test if the table is opened as writable. More...
 
virtual void copy (const String &newName, int tableOption) const
 Copy the table and all its subtables. More...
 
virtual void deepCopy (const String &newName, const Record &dataManagerInfo, const StorageOption &, int tableOption, Bool, int endianFormat, Bool noRows) const
 
virtual void rename (const String &newName, int tableOption)
 Rename the table. More...
 
virtual int tableType () const
 Get the table type (Table::Memory). More...
 
virtual TableDesc actualTableDesc () const
 Get the actual table description. More...
 
virtual Record dataManagerInfo () const
 Get the data manager info. More...
 
virtual TableRecordkeywordSet ()
 Get readonly access to the table keyword set. More...
 
virtual TableRecordrwKeywordSet ()
 Get read/write access to the table keyword set. More...
 
virtual void flushTableInfo ()
 Write the TableInfo object. More...
 
virtual BaseColumngetColumn (uInt columnIndex) const
 Get a column object using its index. More...
 
virtual BaseColumngetColumn (const String &columnName) const
 Get a column object using its name. More...
 
virtual Bool canAddRow () const
 Test if it is possible to add a row to this table (yes). More...
 
virtual void addRow (rownr_t nrrow=1, Bool initialize=True)
 Add one or more rows and possibly initialize them. More...
 
virtual Bool canRemoveRow () const
 Test if it is possible to remove a row from this table (yes). More...
 
virtual void removeRow (rownr_t rownr)
 Remove the given row. More...
 
virtual void addColumn (const ColumnDesc &columnDesc, Bool addToParent)
 Add a column to the table. More...
 
virtual void addColumn (const ColumnDesc &columnDesc, const String &dataManager, Bool byName, Bool addToParent)
 
virtual void addColumn (const ColumnDesc &columnDesc, const DataManager &dataManager, Bool addToParent)
 
virtual void addColumn (const TableDesc &tableDesc, const DataManager &dataManager, Bool addToParent)
 
virtual Bool canRemoveColumn (const Vector< String > &columnNames) const
 Test if columns can be removed (yes). More...
 
virtual void removeColumn (const Vector< String > &columnNames)
 Remove columns. More...
 
virtual Bool canRenameColumn (const String &columnName) const
 Test if a column can be renamed (yes). More...
 
virtual void renameColumn (const String &newName, const String &oldName)
 Rename a column. More...
 
virtual void renameHypercolumn (const String &newName, const String &oldName)
 Rename a hypercolumn. More...
 
virtual DataManagerfindDataManager (const String &name, Bool byColumn) const
 Find the data manager with the given name or for the given column. More...
 
- Public Member Functions inherited from casacore::BaseTable
 BaseTable (const String &tableName, int tableOption, rownr_t nrrow)
 Initialize the object. More...
 
 BaseTable (MPI_Comm mpiComm, const String &tableName, int tableOption, rownr_t nrrow)
 MPI version of the constructor. More...
 
void BaseTableCommon (const String &tableName, int tableOption, rownr_t nrrow)
 Common code shared by the MPI constructor and non-MPI constructor. More...
 
virtual ~BaseTable ()
 
void link ()
 Link to this BaseTable object (i.e. More...
 
virtual Bool isNull () const
 Is the table a null table? By default it is not. More...
 
virtual void setTableChanged ()
 Set the table to being changed. More...
 
void doNotWrite ()
 Do not write the table (used in in case of exceptions). More...
 
Bool isColumnWritable (const String &columnName) const
 Test if the given column is writable. More...
 
Bool isColumnWritable (uInt columnIndex) const
 
Bool isColumnStored (const String &columnName) const
 Test if the given column is stored (otherwise it is virtual). More...
 
Bool isColumnStored (uInt columnIndex) const
 
const StringtableName () const
 Get the table name. More...
 
virtual void getPartNames (Block< String > &names, Bool recursive) const
 Get the names of the tables this table consists of. More...
 
int tableOption () const
 Get the table option. More...
 
void markForDelete (Bool callback, const String &oldName)
 Mark the table for delete. More...
 
void unmarkForDelete (Bool callback, const String &oldName)
 Unmark the table for delete. More...
 
Bool isMarkedForDelete () const
 Test if the table is marked for delete. More...
 
const TableDesctableDesc () const
 Get the table description. More...
 
void showStructure (std::ostream &, Bool showDataMan, Bool showColumns, Bool showSubTables, Bool sortColumns, Bool cOrder)
 Show the table structure (implementation of Table::showStructure). More...
 
TableInfotableInfo ()
 Get access to the TableInfo object. More...
 
rownr_t nrow () const
 Get number of rows. More...
 
void removeRow (const Vector< rownr_t > &rownrs)
 
void removeRow (const Vector< uInt > &rownrs)
 
BaseTableselect (const TableExprNode &, rownr_t maxRow, rownr_t offset)
 Select rows using the given expression (which can be null). More...
 
BaseTableselect (rownr_t maxRow, rownr_t offset)
 Select maxRow rows and skip first offset rows. More...
 
BaseTableselect (const Vector< rownr_t > &rownrs)
 Select rows using a vector of row numbers. More...
 
BaseTableselect (const Block< Bool > &mask)
 Select rows using a mask block. More...
 
BaseTableproject (const Block< String > &columnNames)
 Project the given columns (i.e. More...
 
BaseTabletabAnd (BaseTable *)
 Do logical operations on a table. More...
 
BaseTabletabOr (BaseTable *)
 union with another table More...
 
BaseTabletabSub (BaseTable *)
 subtract another table More...
 
BaseTabletabXor (BaseTable *)
 xor with another table More...
 
BaseTabletabNot ()
 take complement More...
 
BaseTablesort (const Block< String > &columnNames, const Block< CountedPtr< BaseCompare > > &compareObjects, const Block< Int > &sortOrder, int sortOption, std::shared_ptr< Vector< rownr_t >> sortIterBoundaries=nullptr, std::shared_ptr< Vector< size_t >> sortIterKeyIdxChange=nullptr)
 Sort a table on one or more columns of scalars. More...
 
BaseTableIteratormakeIterator (const Block< String > &columnNames, const Block< CountedPtr< BaseCompare > > &, const Block< Int > &orders, int option, bool cacheIterationBoundaries=false)
 Create an iterator. More...
 
void addColumns (const TableDesc &tableDesc, const Record &dmInfo, Bool addToParent)
 Add one or more columns to the table. More...
 
Bool checkRemoveColumn (const Vector< String > &columnNames, Bool throwException) const
 Check if the set of columns can be removed. More...
 
virtual Vector< rownr_trowNumbers () const
 Get a vector of row numbers. More...
 
virtual BaseTableroot ()
 Get pointer to root table (i.e. More...
 
virtual Bool rowOrder () const
 Tell if the table is in row order. More...
 
virtual Vector< rownr_t > * rowStorage ()
 By the default the table cannot return the storage of rownrs. More...
 
virtual Bool adjustRownrs (rownr_t nrrow, Vector< rownr_t > &rownrs, Bool determineOrder) const
 Adjust the row numbers to be the actual row numbers in the root table. More...
 
virtual BaseTabledoSort (PtrBlock< BaseColumn * > &, const Block< CountedPtr< BaseCompare > > &, const Block< Int > &sortOrder, int sortOption, std::shared_ptr< Vector< rownr_t >> sortIterBoundaries, std::shared_ptr< Vector< size_t >> sortIterKeyIdxChange)
 Do the actual sort. More...
 
RefTablemakeRefTable (Bool rowOrder, rownr_t initialNrrow)
 Create a RefTable object. More...
 
void checkRowNumber (rownr_t rownr) const
 Check if the row number is valid. More...
 
int traceId () const
 Get the table's trace-id. More...
 

Private Member Functions

 MemoryTable (const MemoryTable &)
 Copy constructor is forbidden, because copying a table requires some more knowledge (like table name of result). More...
 
MemoryTableoperator= (const MemoryTable &)
 Assignment is forbidden, because copying a table requires some more knowledge (like table name of result). More...
 
void setup (BaseTable *btp)
 Setup the main parts of the object. More...
 

Private Attributes

CountedPtr< ColumnSetcolSetPtr_p
 
TableLockDatalockPtr_p
 

Additional Inherited Members

- Static Public Member Functions inherited from casacore::BaseTable
static void unlink (BaseTable *)
 Unlink from a BaseTable. More...
 
static TableInfo tableInfo (const String &tableName)
 Get the table info of the table with the given name. More...
 
- Protected Member Functions inherited from casacore::BaseTable
void scratchCallback (Bool isScratch, const String &oldName) const
 Do the callback for scratch tables (if callback is set). More...
 
Bool makeTableDir ()
 Create the table directory when needed (and possible). More...
 
void trueDeepCopy (const String &newName, const Record &dataManagerInfo, const StorageOption &, int tableOption, int endianFormat, Bool noRows) const
 Make a true deep copy of the table. More...
 
void prepareCopyRename (const String &newName, int tableOption) const
 Prepare for copying or renaming a table. More...
 
virtual void renameSubTables (const String &newName, const String &oldName)
 Rename the subtables (used by rename function). More...
 
void throwIfTableExists ()
 Check if the table already exists. More...
 
Bool openedForWrite () const
 Test if the table is opened for write. More...
 
void writeStart (AipsIO &, Bool bigEndian)
 Start writing a table. More...
 
void writeEnd (AipsIO &)
 End writing a table. More...
 
Bool shouldNotWrite () const
 Should the table be written. More...
 
void getTableInfo ()
 Read the TableInfo object. More...
 
- Protected Attributes inherited from casacore::BaseTable
uInt nrlink_p
 
rownr_t nrrow_p
 
rownr_t nrrowToAdd_p
 
CountedPtr< TableDesctdescPtr_p
 
String name_p
 
int option_p
 
Bool noWrite_p
 
Bool delete_p
 
TableInfo info_p
 
Bool madeDir_p
 
int itsTraceId
 

Detailed Description

Class for a table held in memory

Intended use:

Internal

Review Status

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

Prerequisite

Synopsis

MemoryTable holds all its data in memory. It means that the data is not persistent. However, it can be copied to another table to make the data persistent. Furthermore it is a table as all other tables, so all table functions can be applied to it. Some functions (e.g. lock) won't do anything. Also all table operations like sorting, selecting, and iterating can be used.

The constructor accepts a SetupNewTable object which can contain bindings of columns to any data manager. All bindings to storage managers will be replaced by a binding to the memory based storage manager MemoryStMan. Also all unbound columns will be bound to MemoryStMan. Thus it is still possible that a column is bound to a virtual column engine like CompressComplex.

Definition at line 82 of file MemoryTable.h.

Constructor & Destructor Documentation

◆ MemoryTable() [1/2]

casacore::MemoryTable::MemoryTable ( SetupNewTable ,
rownr_t  nrrow,
Bool  initialize 
)

Create the table in memory using the definitions in the SetupNewTable object.

◆ ~MemoryTable()

virtual casacore::MemoryTable::~MemoryTable ( )
virtual

The destructor deletes all data.

◆ MemoryTable() [2/2]

casacore::MemoryTable::MemoryTable ( const MemoryTable )
private

Copy constructor is forbidden, because copying a table requires some more knowledge (like table name of result).

Declaring it private, makes it unusable.

Member Function Documentation

◆ actualTableDesc()

virtual TableDesc casacore::MemoryTable::actualTableDesc ( ) const
virtual

Get the actual table description.

Implements casacore::BaseTable.

◆ addColumn() [1/4]

virtual void casacore::MemoryTable::addColumn ( const ColumnDesc columnDesc,
Bool  addToParent 
)
virtual

Add a column to the table.

If the DataManager is not a virtual engine, MemoryStMan will be used. The last Bool argument is not used in MemoryTable, but can be used in other classes derived from BaseTable.

Reimplemented from casacore::BaseTable.

◆ addColumn() [2/4]

virtual void casacore::MemoryTable::addColumn ( const ColumnDesc columnDesc,
const DataManager dataManager,
Bool  addToParent 
)
virtual

Reimplemented from casacore::BaseTable.

◆ addColumn() [3/4]

virtual void casacore::MemoryTable::addColumn ( const ColumnDesc columnDesc,
const String dataManager,
Bool  byName,
Bool  addToParent 
)
virtual

Reimplemented from casacore::BaseTable.

◆ addColumn() [4/4]

virtual void casacore::MemoryTable::addColumn ( const TableDesc tableDesc,
const DataManager dataManager,
Bool  addToParent 
)
virtual

Reimplemented from casacore::BaseTable.

◆ addRow()

virtual void casacore::MemoryTable::addRow ( rownr_t  nrrow = 1,
Bool  initialize = True 
)
virtual

Add one or more rows and possibly initialize them.

This will fail for tables not supporting addition of rows.

Reimplemented from casacore::BaseTable.

◆ asBigEndian()

virtual Bool casacore::MemoryTable::asBigEndian ( ) const
virtual

Is the table stored in big or little endian format? It returns the endian format of the machine.

Implements casacore::BaseTable.

◆ canAddRow()

virtual Bool casacore::MemoryTable::canAddRow ( ) const
virtual

Test if it is possible to add a row to this table (yes).

Reimplemented from casacore::BaseTable.

◆ canRemoveColumn()

virtual Bool casacore::MemoryTable::canRemoveColumn ( const Vector< String > &  columnNames) const
virtual

Test if columns can be removed (yes).

Implements casacore::BaseTable.

◆ canRemoveRow()

virtual Bool casacore::MemoryTable::canRemoveRow ( ) const
virtual

Test if it is possible to remove a row from this table (yes).

Reimplemented from casacore::BaseTable.

◆ canRenameColumn()

virtual Bool casacore::MemoryTable::canRenameColumn ( const String columnName) const
virtual

Test if a column can be renamed (yes).

Implements casacore::BaseTable.

◆ copy()

virtual void casacore::MemoryTable::copy ( const String newName,
int  tableOption 
) const
virtual

Copy the table and all its subtables.

It copies the contents of each row to get a real copy.

Reimplemented from casacore::BaseTable.

◆ dataManagerInfo()

virtual Record casacore::MemoryTable::dataManagerInfo ( ) const
virtual

Get the data manager info.

Implements casacore::BaseTable.

◆ deepCopy()

virtual void casacore::MemoryTable::deepCopy ( const String newName,
const Record dataManagerInfo,
const StorageOption ,
int  tableOption,
Bool  ,
int  endianFormat,
Bool  noRows 
) const
virtual

Reimplemented from casacore::BaseTable.

◆ findDataManager()

virtual DataManager* casacore::MemoryTable::findDataManager ( const String name,
Bool  byColumn 
) const
virtual

Find the data manager with the given name or for the given column.

There is only one storage manager (MemoryStMan) with name MSM.

Implements casacore::BaseTable.

◆ flush()

virtual void casacore::MemoryTable::flush ( Bool  fsync,
Bool  recursive 
)
virtual

Flushing the table is a no-op.

Implements casacore::BaseTable.

◆ flushTableInfo()

virtual void casacore::MemoryTable::flushTableInfo ( )
virtual

Write the TableInfo object.

It does not do anything.

Reimplemented from casacore::BaseTable.

◆ getColumn() [1/2]

virtual BaseColumn* casacore::MemoryTable::getColumn ( const String columnName) const
virtual

Get a column object using its name.

Implements casacore::BaseTable.

◆ getColumn() [2/2]

virtual BaseColumn* casacore::MemoryTable::getColumn ( uInt  columnIndex) const
virtual

Get a column object using its index.

Implements casacore::BaseTable.

◆ getModifyCounter()

virtual uInt casacore::MemoryTable::getModifyCounter ( ) const
virtual

Get the modify counter.

It always returns 0.

Implements casacore::BaseTable.

◆ hasLock()

virtual Bool casacore::MemoryTable::hasLock ( FileLocker::LockType  ) const
virtual

Has this process the read or write lock, thus can the table be read or written safely? It always returns True.

Implements casacore::BaseTable.

◆ isMultiUsed()

virtual Bool casacore::MemoryTable::isMultiUsed ( Bool  checkSubTable) const
virtual

Is the table in use (i.e.

open) in another process? It always returns False.

Implements casacore::BaseTable.

◆ isWritable()

virtual Bool casacore::MemoryTable::isWritable ( ) const
virtual

Test if the table is opened as writable.

It always returns True.

Implements casacore::BaseTable.

◆ keywordSet()

virtual TableRecord& casacore::MemoryTable::keywordSet ( )
virtual

Get readonly access to the table keyword set.

Implements casacore::BaseTable.

◆ lock()

virtual Bool casacore::MemoryTable::lock ( FileLocker::LockType  ,
uInt  nattempts 
)
virtual

Locking the table is a no-op.

Implements casacore::BaseTable.

◆ lockOptions()

virtual const TableLock& casacore::MemoryTable::lockOptions ( ) const
virtual

Get the locking info.

It returns PermanentLocking.

Implements casacore::BaseTable.

◆ mergeLock()

virtual void casacore::MemoryTable::mergeLock ( const TableLock lockOptions)
virtual

Merge the given lock info with the existing one.

It does nothing.

Implements casacore::BaseTable.

◆ operator=()

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

Assignment is forbidden, because copying a table requires some more knowledge (like table name of result).

Declaring it private, makes it unusable.

◆ removeColumn()

virtual void casacore::MemoryTable::removeColumn ( const Vector< String > &  columnNames)
virtual

Remove columns.

Implements casacore::BaseTable.

◆ removeRow()

virtual void casacore::MemoryTable::removeRow ( rownr_t  rownr)
virtual

Remove the given row.

Reimplemented from casacore::BaseTable.

◆ rename()

virtual void casacore::MemoryTable::rename ( const String newName,
int  tableOption 
)
virtual

Rename the table.

The tableOption is ignored.

Reimplemented from casacore::BaseTable.

◆ renameColumn()

virtual void casacore::MemoryTable::renameColumn ( const String newName,
const String oldName 
)
virtual

Rename a column.

Implements casacore::BaseTable.

◆ renameHypercolumn()

virtual void casacore::MemoryTable::renameHypercolumn ( const String newName,
const String oldName 
)
virtual

Rename a hypercolumn.

Implements casacore::BaseTable.

◆ reopenRW()

virtual void casacore::MemoryTable::reopenRW ( )
virtual

Try to reopen the table (the underlying one) for read/write access.

It does nothing.

Implements casacore::BaseTable.

◆ resync()

virtual void casacore::MemoryTable::resync ( )
virtual

Resyncing the Table is a no-op.

Implements casacore::BaseTable.

◆ rwKeywordSet()

virtual TableRecord& casacore::MemoryTable::rwKeywordSet ( )
virtual

Get read/write access to the table keyword set.

Implements casacore::BaseTable.

◆ setup()

void casacore::MemoryTable::setup ( BaseTable btp)
private

Setup the main parts of the object.


Create the initial name map from the table description. This map maps a name to the name in the original table. A rename might change the map.
Create the RefColumn objects.
Create the initial TableInfo as a copy of the original BaseTable.

◆ storageOption()

virtual const StorageOption& casacore::MemoryTable::storageOption ( ) const
virtual

Get the storage option used for the table.

Implements casacore::BaseTable.

◆ tableType()

virtual int casacore::MemoryTable::tableType ( ) const
virtual

Get the table type (Table::Memory).

Reimplemented from casacore::BaseTable.

◆ unlock()

virtual void casacore::MemoryTable::unlock ( )
virtual

Unlocking the table is a no-op.

Implements casacore::BaseTable.

Member Data Documentation

◆ colSetPtr_p

CountedPtr<ColumnSet> casacore::MemoryTable::colSetPtr_p
private

Definition at line 228 of file MemoryTable.h.

◆ lockPtr_p

TableLockData* casacore::MemoryTable::lockPtr_p
private

Definition at line 229 of file MemoryTable.h.


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