Loading...
Searching...
No Matches
casacore::TableKeyword Class Reference
tables package (libcasa_tables) » Tables_module » Tables_module_internal_classes

More...

`#include <TableKeyword.h>`

## Public Member Functions

| TableKeyword (const String &tableDescName)
| Construct a TableKeyword with the given tableDescName.
| TableKeyword (const Table &table, const String &tableDescName)
| Construct a TableKeyword from a Table.
| TableKeyword (const TableKeyword &that)
| Copy constructor (full copy semantics).
TableKeyword & | operator= (const TableKeyword &that)
| Assignment (leaves tableDescName_p untouched).
TableKeyword & | operator= (const Table &table)
| ~TableKeyword ()
void | set (const String &name, const TableAttr &parentAttr)
| Set the name of the table and the writable switch.
void | setRW ()
| Set the keyword to read/write access.
Bool | isMultiUsed (Bool checkSubTables) const
| Is the table in use in another process?
const String & | tableName () const
| Get the name of the table.
String | tableName (const String &parentName) const
| Get the name of the table relative to parent table.
String | tableName (const TableAttr &parentAttr) const
Table | table (const TableLock *lockOptions=0) const
| Get the table.
const TableAttr & | tableAttributes () const
| Get the table attributes.
void | setTableAttributes (const TableAttr &attr)
| Set the table attributes.
void | close () const
| Close the table.
void | flush (Bool fsync) const
| Flush and optionally fsync the table.
void | renameTable (const String &newParentName, const String &oldParentName)
| Rename the table if its path contains the old parent table name.
Bool | conform (const TableKeyword &that) const
| Test if the table in other conforms this table keyword.
Bool | conform (const Table &that) const
Bool | isFixed () const
| Has the table a fixed description name?

## Private Attributes

Table * | table_p
TableAttr | attr_p
String | tableDescName_p

## Detailed Description

Keyword value representing a table

### Intended use:

Internal

### Review Status

Reviewed By:
  Mark Wieringa
Date Reviewed:
  1996/04/15
Test programs:
  tTableRecord

### Prerequisite

- TableRecord
- Table

### Synopsis

TableKeyword represents a record keyword field containing a table. It is used by class TableRecord, which in its turn is meant to be used by the Table class. It serves the following purposes:

- A table is only opened on demand, i.e. when the keyword is accessed for the first time. When opened, the function closeTable makes it possible to close a table when not needed anymore (provided the table is not used elsewhere). It will automatically be reopened when used again.
- A switch is maintained which indicates if the table should be opened as readonly or read/write. A table is opened as read/write when the switch is read/write and when the table is writable. Otherwise it is opened as readonly. When a parent table is read back, its TableKeyword's will be read back and the switch will be set to the access-mode (readonly or read/write) of the parent table. When a new table is inserted, the access-mode is taken from the table.
- When the parent table is reopened as read/write, the table in this object will also be reopened as read/write (if the table is writable).
- When a TableKeyword gets written, only the table name will be written. Reading it back will set the correct access-mode, while the table will not be opened until necessary. However, when reading a parent table back it is possible that it is done from a different directory than where it was created. Therefore the directory of the parent table is prepended to the TableKeyword subtable name. Similarly, when written it is stripped off.
  E.g. parent table XX and subtable SUB are created in the working directory WD. Reading back is done from another directory by specifying WD/XX. WD will be prepended to SUB.

### Motivation

This class provides the extra functionality for keywords containing tables. This is needed because tables are much more complex entities than scalars or arrays.

### Example

// Store a table in the keyword set.
void someFunc (const Table& subTable)
{
// Open the table and get access to the table keyword set.
Table table("table.data", Table::Update);
TableRecord& keyset = table.rwKeywordSet();
keyset.defineTable ("KeyTab", subTable);
}
// Open the table and get the table from keyword KeyTab.
// It shows that this can be done in one statement.
Table table("table.data");
Table subTab = table.keywordSet().asTable ("KeyTab");
casacore::TableKeyword::table
Table table(const TableLock *lockOptions=0) const
Get the table.
casacore::TableRecord
Definition TableRecord.h:183
casacore::TableRecord::asTable
Table asTable(const RecordFieldId &) const
Get the table from the given field.
casacore::TableRecord::defineTable
void defineTable(const RecordFieldId &, const Table &value, RecordType type=Variable)
casacore::Table
Definition Table.h:157
casacore::Table::Update
@ Update
update existing table
Definition Table.h:181
casacore::Table::keywordSet
const TableRecord & keywordSet() const
Get readonly access to the table keyword set.
Definition Table.h:1193

Definition at line 119 of file TableKeyword.h.

## Constructor & Destructor Documentation

## TableKeyword() [1/3]

casacore::TableKeyword::TableKeyword | ( | const String & | tableDescName | ) |

Construct a TableKeyword with the given tableDescName.

When the tableDescName is empty the keyword is variable structured. Otherwise it is fixed structured, meaning that only tables with a description of that name can be assigned to this keyword.

Referenced by conform(), operator=(), operator=(), and TableKeyword().

## TableKeyword() [2/3]

casacore::TableKeyword::TableKeyword | ( | const Table & | table,
|  | const String & | tableDescName )

Construct a TableKeyword from a Table.

When the tableDescName is empty the keyword is variable structured. Otherwise it is fixed structured, meaning that only tables with a description of that name can be assigned to this keyword.

References table().

## TableKeyword() [3/3]

casacore::TableKeyword::TableKeyword | ( | const TableKeyword & | that | ) |

Copy constructor (full copy semantics).

References TableKeyword().

## ~TableKeyword()

casacore::TableKeyword::~TableKeyword | ( |  | ) |

## Member Function Documentation

## close()

void casacore::TableKeyword::close | ( |  | ) | const

Close the table.

## conform() [1/2]

Bool casacore::TableKeyword::conform | ( | const Table & | that | ) | const

## conform() [2/2]

Bool casacore::TableKeyword::conform | ( | const TableKeyword & | that | ) | const

Test if the table in other conforms this table keyword.

It conforms when this description name is blank or matches the table description name of the other.

References TableKeyword().

## flush()

void casacore::TableKeyword::flush | ( | Bool | fsync | ) | const

Flush and optionally fsync the table.

## isFixed()

Bool casacore::TableKeyword::isFixed | ( |  | ) | const

inline

Has the table a fixed description name?

It has when its description name is not empty.

Definition at line 220 of file TableKeyword.h.

References tableDescName_p.

## isMultiUsed()

Bool casacore::TableKeyword::isMultiUsed | ( | Bool | checkSubTables | ) | const

Is the table in use in another process?

If checkSubTables is set, it is also checked if a subtable is used in another process.

## operator=() [1/2]

TableKeyword & casacore::TableKeyword::operator= | ( | const Table & | table | ) |

References table(), and TableKeyword().

## operator=() [2/2]

TableKeyword & casacore::TableKeyword::operator= | ( | const TableKeyword & | that | ) |

Assignment (leaves tableDescName_p untouched).

This is only possible when both objects conform.

References TableKeyword().

## renameTable()

void casacore::TableKeyword::renameTable | ( | const String & | newParentName,
|  | const String & | oldParentName )

Rename the table if its path contains the old parent table name.

## set()

void casacore::TableKeyword::set | ( | const String & | name,
|  | const TableAttr & | parentAttr )

Set the name of the table and the writable switch.

This is used when reading back a keyword.

References casacore::name().

## setRW()

void casacore::TableKeyword::setRW | ( |  | ) |

Set the keyword to read/write access.

If the table is already open, it will be reopened with read/write access if the table is writable.

## setTableAttributes()

void casacore::TableKeyword::setTableAttributes | ( | const TableAttr & | attr | ) |

inline

Set the table attributes.

Definition at line 182 of file TableKeyword.h.

References attr_p.

## table()

Table casacore::TableKeyword::table | ( | const TableLock * | lockOptions = 0 | ) | const

Get the table.

It will be opened when necessary. If given, the lockOptions will be used instead of the ones in the table attributes.

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

## tableAttributes()

const TableAttr & casacore::TableKeyword::tableAttributes | ( |  | ) | const

inline

Get the table attributes.

Definition at line 178 of file TableKeyword.h.

References attr_p.

## tableName() [1/3]

const String & casacore::TableKeyword::tableName | ( |  | ) | const

inline

Get the name of the table.

Definition at line 215 of file TableKeyword.h.

References attr_p.

Referenced by tableName().

## tableName() [2/3]

String casacore::TableKeyword::tableName | ( | const String & | parentName | ) | const

Get the name of the table relative to parent table.

## tableName() [3/3]

String casacore::TableKeyword::tableName | ( | const TableAttr & | parentAttr | ) | const

inline

Definition at line 167 of file TableKeyword.h.

References casacore::TableAttr::name(), and tableName().

## Member Data Documentation

## attr_p

TableAttr casacore::TableKeyword::attr_p

private

Definition at line 209 of file TableKeyword.h.

Referenced by setTableAttributes(), tableAttributes(), and tableName().

## table_p

Table* casacore::TableKeyword::table_p

private

Definition at line 208 of file TableKeyword.h.

## tableDescName_p

String casacore::TableKeyword::tableDescName_p

private

Definition at line 210 of file TableKeyword.h.

Referenced by isFixed().

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

- tables/Tables/TableKeyword.h