ColumnSet.h

Classes

ColumnSet -- Class to manage a set of table columns (full description)

class ColumnSet

Interface

Public Members
ColumnSet (TableDesc*)
~ColumnSet()
void reopenRW()
void renameTables (const String& newName, const String& oldName)
Bool areTablesMultiUsed() const
PlainColumn* getColumn (const String& columnName) const
PlainColumn* getColumn (uInt columnIndex) const
void addDataManager (DataManager*)
void initDataManagers (uInt nrrow, Bool bigEndian, Table& tab)
void linkToTable (BaseTable* baseTableObject)
void linkToLockObject (TableLockData* lockObject)
void checkReadLock (Bool wait)
void checkWriteLock (Bool wait)
void autoReleaseLock()
Bool userLock (FileLocker::LockType, Bool wait)
void userUnlock (Bool releaseFlag)
Bool canAddRow() const
Bool canRemoveRow() const
Bool canRemoveColumn (const Vector<String>& columnNames) const
Bool canRenameColumn (const String& columnName) const
void addRow (uInt nrrow)
void removeRow (uInt rownr)
void removeColumn (const Vector<String>& columnNames)
void renameColumn (const String& newName, const String& oldName)
void addColumn (const ColumnDesc& columnDesc, Bool bigEndian, Table& tab)
void addColumn (const ColumnDesc& columnDesc, const String& dataManager, Bool byName, Bool bigEndian, Table& tab)
void addColumn (const ColumnDesc& columnDesc, const DataManager& dataManager, Bool bigEndian, Table& tab)
void addColumn (const TableDesc& tableDesc, const DataManager& dataManager, Bool bigEndian, Table& tab)
uInt nrow() const
TableDesc actualTableDesc() const
Record dataManagerInfo (Bool virtualOnly=False) const
void initialize (uInt startRownr, uInt endRownr)
Bool putFile (Bool writeTable, AipsIO&, const TableAttr&, Bool fsync)
void getFile (AipsIO&, Table& tab, uInt nrrow, Bool bigEndian)
void setTableChanged()
Block<Bool>& dataManChanged()
void resync (uInt nrrow)
void invalidateColumnCaches()
DataManager* getDataManager (uInt seqnr) const
void checkDataManagerNames() const
DataManager* findDataManager (const String& dataManagerName) const
String uniqueDataManagerName (const String& name) const
void syncColumns (const ColumnSet& other, const TableAttr& defaultAttr)
Private Members
void removeLastDataManager()
void initSomeDataManagers (uInt from, Table& tab)
void prepareSomeDataManagers (uInt from)
Bool checkDataManagerName (const String& name, uInt from, Bool doTthrow=True) const
void doAddColumn (const ColumnDesc& columnDesc, DataManager* dataManPtr, Bool bigEndian)
SimpleOrderedMap<void*,Int> checkRemoveColumn (const Vector<String>& columnNames)
void doLock (FileLocker::LockType, Bool wait)

Description

Review Status

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

Prerequisite

Etymology

ColumnSet represent the set of columns in a table.

Synopsis

ColumnSet contains all columns in a plain table (thus not in a RefTable). Furthermore it contains the set of data managers used by the columns in the table.

The main purpose of the class is to deal with constructing, writing and reading the column objects. It is used by classes SetupNewTable and Table.

To Do

Member Description

ColumnSet (TableDesc*)

Construct from the table description. This creates all underlying filled and virtual column objects.

~ColumnSet()

void reopenRW()

Reopen the data managers for read/write.

void renameTables (const String& newName, const String& oldName)

Rename the necessary subtables in the column keywords.

Bool areTablesMultiUsed() const

Are subtables used in other processes.

PlainColumn* getColumn (const String& columnName) const

Get a column by name.

PlainColumn* getColumn (uInt columnIndex) const

Get a column by index.

void addDataManager (DataManager*)

Add a data manager. It increments seqCount_p and returns that as a unique sequence number. This can, for instance, be used to create a unique file name.

void initDataManagers (uInt nrrow, Bool bigEndian, Table& tab)

Initialize the data managers for a new table. It creates the data manager column objects for each column and it allows the data managers to link themselves to the Table object and to initialize themselves.

void linkToTable (BaseTable* baseTableObject)

Link the ColumnSet object to the BaseTable object.

void linkToLockObject (TableLockData* lockObject)

Link the ColumnSet object to the TableLockData object.

void checkReadLock (Bool wait)
void checkWriteLock (Bool wait)

Check if the table is locked for read or write. If manual or permanent locking is in effect, it checks if the table is properly locked. If autolocking is in effect, it locks the table when needed.

void autoReleaseLock()

Inspect the auto lock when the inspection interval has expired and release it when another process needs the lock.

Bool userLock (FileLocker::LockType, Bool wait)

If needed, get a temporary user lock. It returns False if the lock was already there.

void userUnlock (Bool releaseFlag)

Release a temporary user lock if the given release flag is True.

Bool canAddRow() const

Do all data managers and engines allow to add rows?

Bool canRemoveRow() const

Do all data managers and engines allow to remove rows?

Bool canRemoveColumn (const Vector<String>& columnNames) const

Can the given columns be removed from the data manager?

Bool canRenameColumn (const String& columnName) const

Can a column be renamed in the data manager?

void addRow (uInt nrrow)

Add rows to all data managers.

void removeRow (uInt rownr)

Remove a row from all data managers. It will throw an exception if not possible.

void removeColumn (const Vector<String>& columnNames)

Remove the columns from the map and the data manager.

void renameColumn (const String& newName, const String& oldName)

Rename the column in the map.

void addColumn (const ColumnDesc& columnDesc, Bool bigEndian, Table& tab)
void addColumn (const ColumnDesc& columnDesc, const String& dataManager, Bool byName, Bool bigEndian, Table& tab)
void addColumn (const ColumnDesc& columnDesc, const DataManager& dataManager, Bool bigEndian, Table& tab)
void addColumn (const TableDesc& tableDesc, const DataManager& dataManager, Bool bigEndian, Table& tab)

Add a column to the table. The default implementation throws an "invalid operation" exception.

uInt nrow() const

Get nr of rows.

TableDesc actualTableDesc() const

Get the actual table description.

Record dataManagerInfo (Bool virtualOnly=False) const

Get the data manager info. Optionally only the virtual engines are retrieved.

void initialize (uInt startRownr, uInt endRownr)

Initialize rows startRownr till endRownr (inclusive).

Bool putFile (Bool writeTable, AipsIO&, const TableAttr&, Bool fsync)

Write all the data and let the data managers flush their data. This function is called when a table gets written (i.e. flushed). It returns True if any data manager wrote something.

void getFile (AipsIO&, Table& tab, uInt nrrow, Bool bigEndian)

Read the data, reconstruct the data managers, and link those to the table object. This function gets called when an existing table is read back.

void setTableChanged()

Set the table to being changed.

Block<Bool>& dataManChanged()

Get the data manager change flags (used by PlainTable).

void resync (uInt nrrow)

Synchronize the data managers when data in them have changed.

void invalidateColumnCaches()

Invalidate the column caches for all columns.

DataManager* getDataManager (uInt seqnr) const

Get the correct data manager. This is used by the column objects to link themselves to the correct datamanagers when they are read back.

void checkDataManagerNames() const

Check if no double data manager names have been given.

DataManager* findDataManager (const String& dataManagerName) const

Find the data manager with the given name. When the data manager is unknown, an exception is thrown. A blank name means the data manager is unknown.

String uniqueDataManagerName (const String& name) const

Make a unique data manager name by appending a suffix _n if needed where n is a number that makes the name unique.

void syncColumns (const ColumnSet& other, const TableAttr& defaultAttr)

Synchronize the columns after it appeared that data in the main table file have changed. It cannot deal with changes in number of columns, so it throws an exception when they have changed. Keywords in all columns are updated. The other ColumnSet gives the new data.

void removeLastDataManager()

Remove the last data manager (used by addColumn after an exception). It does the opposite of addDataManager.

void initSomeDataManagers (uInt from, Table& tab)

Let the data managers (from the given index on) initialize themselves.

void prepareSomeDataManagers (uInt from)

Let the data managers (from the given index on) prepare themselves.

Bool checkDataManagerName (const String& name, uInt from, Bool doTthrow=True) const

Check if a data manager name has not already been used. Start checking at the given index in the array. It returns False if the name has already been used. By default an exception is thrown if the name has already been used.

void doAddColumn (const ColumnDesc& columnDesc, DataManager* dataManPtr, Bool bigEndian)

Do the actual addition of a column.

SimpleOrderedMap<void*,Int> checkRemoveColumn (const Vector<String>& columnNames)

Check if columns to be removed can be removed. It returns a map of DataManager* telling how many columns for a data manager have to be removed. A count of -1 means that all columns have to be removed. For such columns the flag in the returned Block is False, otherwise True.

void doLock (FileLocker::LockType, Bool wait)

Check if the table is locked for read or write. If manual or permanent locking is in effect, it checks if the table is properly locked. If autolocking is in effect, it locks the table when needed.