PlainTable.h
Classes
- PlainTable -- Class defining a plain regular table (full description)
Interface
- Public Members
- PlainTable (SetupNewTable&, uInt nrrow, Bool initialize, const TableLock& lockOptions, int endianFormat)
- PlainTable (AipsIO&, uInt version, const String& name, const String& type, uInt nrrow, int option, const TableLock& lockOptions, Bool addToCache, uInt locknr)
- virtual ~PlainTable()
- static void getLayout (TableDesc& desc, AipsIO& ios)
- virtual void reopenRW()
- virtual Bool asBigEndian() const
- virtual Bool isMultiUsed (Bool checkSubTables) const
- virtual const TableLock& lockOptions() const
- virtual void mergeLock (const TableLock& lockOptions)
- virtual Bool hasLock (FileLocker::LockType) const
- virtual Bool lock (FileLocker::LockType, uInt nattempts)
- virtual void unlock()
- void autoReleaseLock (Bool always = False)
- virtual void flush (Bool fsync)
- virtual void resync()
- virtual uInt getModifyCounter() const
- virtual void setTableChanged()
- static ByteIO::OpenOption toAipsIOFoption (int tableOption)
- virtual Bool isWritable() const
- virtual TableDesc actualTableDesc() const
- virtual Record dataManagerInfo() const
- virtual TableRecord& keywordSet()
- virtual TableRecord& rwKeywordSet()
- virtual BaseColumn* getColumn (uInt columnIndex) const
- virtual BaseColumn* getColumn (const String& columnName) const
- virtual Bool canAddRow() const
- virtual void addRow (uInt nrrow, Bool initialize)
- virtual Bool canRemoveRow() const
- virtual void removeRow (uInt rownr)
- virtual void addColumn (const ColumnDesc& columnDesc)
- virtual void addColumn (const ColumnDesc& columnDesc, const String& dataManager, Bool byName)
- virtual void addColumn (const ColumnDesc& columnDesc, const DataManager& dataManager)
- virtual void addColumn (const TableDesc& tableDesc, const DataManager& dataManager)
- virtual Bool canRemoveColumn (const Vector<String>& columnNames) const
- virtual void removeColumn (const Vector<String>& columnNames)
- virtual Bool canRenameColumn (const String& columnName) const
- virtual void renameColumn (const String& newName, const String& oldName)
- virtual DataManager* findDataManager (const String& dataManagerName) const
- Private Members
- PlainTable (const PlainTable&)
- PlainTable& operator= (const PlainTable&)
- virtual void renameSubTables (const String& newName, const String& oldName)
- static MemoryIO* releaseCallBack (void* plainTableObject, Bool always)
- MemoryIO* doReleaseCallBack (Bool always)
- Bool putFile (Bool always)
- void syncTable()
- void setEndian (int endianFormat)
Prerequisite
Etymology
PlainTable represents a plain regular table. This is opposed to a
RefTable, which is a view on a PlainTable.
Synopsis
PlainTable is a table consisting of a keyword set and a number of
filled and virtual columns. The table control information and the
keyword set is stored in an AipsIO file. The data in the filled columns
are stored separately by storage managers.
To Do
- notify RefTable's when deleting rows
Member Description
PlainTable (SetupNewTable&, uInt nrrow, Bool initialize, const TableLock& lockOptions, int endianFormat)
Construct the object for a new table.
It creates storage manager(s) for unbound columns and initializes
all storage managers. The given number of rows is stored in
the table and initialized if the flag is set.
PlainTable (AipsIO&, uInt version, const String& name, const String& type, uInt nrrow, int option, const TableLock& lockOptions, Bool addToCache, uInt locknr)
Construct the object for an existing table.
It opens the table file, reads the table control information
and creates and initializes the required storage managers.
The destructor flushes (i.e. writes) the table if it is opened
for output and not marked for delete.
Return the layout of a table (i.e. description and #rows).
This function has the advantage that only the minimal amount of
information required is read from the table, thus it is much
faster than a normal table open.
The number of rows is returned. The description of the table
is stored in desc (its contents will be overwritten).
Try to reopen the table for read/write access.
An exception is thrown if the table is not writable.
Nothing is done if the table is already open for read/write.
Is the table stored in big or little endian format?
virtual Bool isMultiUsed (Bool checkSubTables) const
Is the table in use (i.e. open) in another process?
If checkSubTables is set, it is also checked if
a subtable is used in another process.
Get the locking info.
Merge the given lock info with the existing one.
Has this process the read or write lock, thus can the table
be read or written safely?
virtual Bool lock (FileLocker::LockType, uInt nattempts)
Try to lock the table for read or write access.
virtual void unlock()
Unlock the table. This will also synchronize the table data,
thus force the data to be written to disk.
Do a release of an AutoLock when the inspection interval has expired.
always=True means that the inspection is always done,
thus not every 25th call or so.
virtual void flush (Bool fsync)
Flush the table, i.e. write it to disk.
Nothing will be done if the table is not writable.
A flush can be executed at any time.
When a table is marked for delete, the destructor will remove
files written by intermediate flushes.
Note that if necessary the destructor will do an implicit flush,
unless it is executed due to an exception.
virtual void resync()
Resync the Table object with the table file.
Get the modify counter.
Set the table to being changed.
Convert a Table option to an AipsIO file option.
This is used by storage managers.
virtual Bool isWritable() const
Test if the table is opened as writable.
Get the actual table description.
Get the data manager info.
Get readonly access to the table keyword set.
Get read/write access to the table keyword set.
This requires that the table is locked (or it gets locked
when using AutoLocking mode).
Get a column object using its index.
Get a column object using its name.
virtual Bool canAddRow() const
Test if it is possible to add a row to this table.
virtual void addRow (uInt nrrow, Bool initialize)
Add one or more rows and possibly initialize them.
This will fail for tables not supporting addition of rows.
Test if it is possible to remove a row from this table.
virtual void removeRow (uInt rownr)
Remove the given row.
This will fail for tables not supporting removal of rows.
virtual void addColumn (const ColumnDesc& columnDesc)
virtual void addColumn (const ColumnDesc& columnDesc, const String& dataManager, Bool byName)
virtual void addColumn (const ColumnDesc& columnDesc, const DataManager& dataManager)
virtual void addColumn (const TableDesc& tableDesc, const DataManager& dataManager)
Add a column to the table.
The default implementation throws an "invalid operation" exception.
Test if columns can be removed.
Remove columns.
Test if a column can be renamed (yes).
Rename a column.
Find the data manager with the given name.
Copy constructor is forbidden, because copying a table requires
some more knowledge (like table name of result).
Declaring it private, makes it unusable.
PlainTable& operator= (const PlainTable&)
Assignment is forbidden, because copying a table requires
some more knowledge (like table name of result).
Declaring it private, makes it unusable.
Rename the subtables (used by rename function).
The callback function when a lock is released.
This flushes the table data, writes the synchronization data
into the MemoryIO object, and returns a pointer to it.
Bool putFile (Bool always)
When needed, write the table control information in an AipsIO file.
Tell the storage managers to flush and close their files.
It returns a switch to tell if the table control information has
been written.
Synchronize the table after having acquired a lock which says
that main table data has changed.
It check if the columns did not change.
It updates the table and column keywords.
void setEndian (int endianFormat)
Determine and set the endian format (big or little).