BaseColDesc.h

Classes

BaseColumnDesc -- An abstract base class for table column descriptions (full description)

class BaseColumnDesc

Interface

Public Members
BaseColumnDesc (const String& name, const String& comment, const String& dataManagerType, const String& dataManagerGroup, DataType, const String& dataTypeId, int options, uInt ndim, const IPosition& shape, Bool isScalar, Bool isArray, Bool isTable)
BaseColumnDesc (const BaseColumnDesc&)
virtual ~BaseColumnDesc ()
TableRecord& rwKeywordSet()
const TableRecord& keywordSet() const
virtual void show (ostream& os) const = 0
const String& name() const
DataType dataType() const
const String& dataTypeId() const
const String& dataManagerType() const
String& dataManagerType()
const String& dataManagerGroup() const
String& dataManagerGroup()
void setDefaultDataManager (Bool always)
const String& comment() const
String& comment()
int options() const
Bool isScalar() const
Bool isArray() const
Bool isTable() const
Int ndim() const
const IPosition& shape() const
void setNdim (uInt ndim)
void setShape (const IPosition& shape)
void setShape (const IPosition& shape, Bool directOption)
void setOptions (int options)
uInt maxLength() const
void setMaxLength (uInt maxLength)
const TableDesc* tableDesc() const
virtual TableDesc* tableDesc()
Protected Members
BaseColumnDesc& operator= (const BaseColumnDesc&)
void putFile (AipsIO&, const TableAttr&) const
void getFile (AipsIO&, const TableAttr&)
virtual void putDesc (AipsIO&) const = 0
virtual void getDesc (AipsIO&) = 0
virtual PlainColumn* makeColumn (ColumnSet*) const = 0
RefColumn* makeRefColumn (RefTable*, BaseColumn*) const
Private Members
virtual void checkAdd (const ColumnDescSet& cds) const
virtual void checkRename (const ColumnDescSet& cds, const String& newName) const
virtual void handleAdd (ColumnDescSet& cds)
virtual void handleRename (ColumnDescSet& cds, const String& oldName)
virtual void handleRemove (ColumnDescSet& cds)
virtual void renameAction (const String& newName, const String& oldName)
Public Members
virtual BaseColumnDesc* clone() const = 0
virtual String className() const = 0
void setName (const String& name)

Description

Review Status

Reviewed By:
Paul Shannon
Date Reviewed:
1994/08/11
Programs:
Tests:

Prerequisite

Etymology

"Base" indicates that this is a base class for the specialized column description classes.

Synopsis

BaseColumnDesc is an abstract class describing a column in a table. Various XXXXColumnDesc classes are derived from it to describe the various types of columns, among them ArrayColumnDesc and ScalarcolumnDesc. These derived classes are used to construct a column description which can be added to the TableDesc.

BaseColumnDesc contains functions common to all kinds of column descriptions. It contains a TableRecord to attach simple keywords to the column description (e.g. to define a scale-factor). This keyword set serves as the initial keyword set for the column when a table gets instantiated from a table description.

The ColumnDesc class is an envelope around BaseColumnDesc, which can be used to get information about existing column descriptions.

Motivation

This abstract base class defines the common features required of all concrete column description classes. It also provides the hook (for letter objects) required by ColumnDesc, the envelope class.

To Do

Member Description

BaseColumnDesc (const String& name, const String& comment, const String& dataManagerType, const String& dataManagerGroup, DataType, const String& dataTypeId, int options, uInt ndim, const IPosition& shape, Bool isScalar, Bool isArray, Bool isTable)

Construct the column base object.

Thrown Exceptions

BaseColumnDesc (const BaseColumnDesc&)

Copy constructor (copy semantics).

virtual ~BaseColumnDesc ()

TableRecord& rwKeywordSet()
const TableRecord& keywordSet() const

Get access to the set of keywords.

virtual void show (ostream& os) const = 0

Show the column.

const String& name() const

Get the name of the column.

DataType dataType() const

Get the data type of the column.

const String& dataTypeId() const

Get the type id for non-standard data types (i.e. for TpOther). For standard data types the returned string is empty.

const String& dataManagerType() const

Get the type name of the default data manager.

String& dataManagerType()

Get the type name of the default data manager. (allowing it to be changed)

const String& dataManagerGroup() const

Get the data manager group.

String& dataManagerGroup()

Get the data manager group. (allowing it to be changed)

void setDefaultDataManager (Bool always)

Set the data manager type and group to the default. If always==True they are always set, otherwise only if empty.

const String& comment() const

Get comment string.

String& comment()

Get comment string (allowing it to be changed).

int options() const

Get the options.

Bool isScalar() const
Bool isArray() const
Bool isTable() const

Test if column is scalar, array or table.

Int ndim() const

Get the number of dimensions.

const IPosition& shape() const

Get the predefined shape. If not defined, a zero shape will be returned.

void setNdim (uInt ndim)

Set the number of dimensions. This is only allowed for arrays. ndim can be zero to clear the number of dimensions and the shape. Otherwise it can only be used if the dimensionality has not been defined yet.

void setShape (const IPosition& shape)
void setShape (const IPosition& shape, Bool directOption)

Set the predefined shape. This is only allowed for arrays, for which the shape has not been defined yet. If the dimensionality has already been defined, it must match. It will set the option FixedShape if not set yet.
The first version leaves the Direct option as is. The second version sets the Direct option as given.

void setOptions (int options)

Set the options to the given value. Option ColumnDesc::Direct forces FixedShape. If FixedShape is not given (implicitly or explicitly), the column can have no shape, so its shape is cleared.

uInt maxLength() const

Get the maximum value length.

void setMaxLength (uInt maxLength)

Set the maximum value length. So far, this is only possible for columns containing String values. An exception is thrown if the column data type is not TpString. Some storage managers support fixed length strings and can store them more efficiently than variable length strings.

const TableDesc* tableDesc() const

Get table description (in case column contains subtables).

virtual TableDesc* tableDesc()

Get table description (in case column contains subtables).

BaseColumnDesc& operator= (const BaseColumnDesc&)

Assignment (copy semantics).

void putFile (AipsIO&, const TableAttr&) const

Put the object. It uses putDesc to put the derived object.

void getFile (AipsIO&, const TableAttr&)

Get the object. It uses getDesc to get the derived object.

virtual void putDesc (AipsIO&) const = 0

Put the derived object.

virtual void getDesc (AipsIO&) = 0

Get the derived object.

virtual PlainColumn* makeColumn (ColumnSet*) const = 0

Make a PlainColumn object out of the description.

RefColumn* makeRefColumn (RefTable*, BaseColumn*) const

Make a RefColumn object out of the description.

virtual void checkAdd (const ColumnDescSet& cds) const
virtual void checkRename (const ColumnDescSet& cds, const String& newName) const

Check if a column can be handled by ColumnDescSet. This gives, for instance, the virtual column class the opportunity to check if the used columns exist.

virtual void handleAdd (ColumnDescSet& cds)
virtual void handleRename (ColumnDescSet& cds, const String& oldName)
virtual void handleRemove (ColumnDescSet& cds)

Take action after a column has been handled by ColumnDescSet. This gives, for instance, the virtual column class the opportunity to update the virtual column list.

virtual void renameAction (const String& newName, const String& oldName)

This function allows each column to act upon a rename of another column. If the old name is used internally, the column can update itself.

virtual BaseColumnDesc* clone() const = 0

Clone a column description (creating a new column description object).

virtual String className() const = 0

Get the underlying class name.

void setName (const String& name)

Set the name of the column (for a rename).