- Direct = 1
- direct table or array
- Undefined = 2
- undefined values are possible
- FixedShape = 4
- fixed array/table shape
Since there are several types of columns, the class ColumnDesc
cannot handle all details of those column types. Therefore,
to create a column description, an instance of the specialized
classes ArrayColumnDesc
This class also enumerates the possible options which can be used
when defining a column via classes like ScalarColumnDesc
Copy constructor (copy semantics).
Default constructor (needed for ColumnDescSet).
Assignment (copy semantics).
Comparison.
Two descriptions are equal when their data types, value types
(scalar, array or table) and possible dimensionalities are equal.
Get access to the set of keywords.
Get the name of the column.
Get the data type of the column.
This always returns the type of a scalar, even when the column
contains arrays.
Get the true data type of the column.
Unlike dataType, it returns an array data type (e.g. TpArrayInt)
when the column contains arrays.
Get the type id for non-standard data types (i.e. for TpOther).
For standard data types the returned string is empty.
Get the type name of the default data manager.
Get the type name of the default data manager
(allowing it to be changed).
Get the data manager group.
Get the data manager group.
(allowing it to be changed).
If always==True they are always set, otherwise only if empty.
Get comment string.
Get comment string (allowing it to be changed).
Get the options. The possible options are defined by the enum Option.
E.g.
Check if the column is defined with a fixed shape.
This is always true for scalars. For arrays it is true when
the FixedShape flag was set when the column was defined.
Test if column is a scalar.
Test if column is an array.
Test if column is a table.
Get the number of dimensions.
Get the predefined shape.
If not defined, a zero shape will be returned.
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.
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.
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.
Get the maximum value length.
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.
Get table description (in case column contains subtables).
Show the column on cout.
Show the column.
Write into AipsIO.
Read from AipsIO.
Show on ostream.
Serve as default function for registerMap (see below), which catches
all unknown xxxColumnDesc class names.
Check if a column can be handled by ColumnDescSet.
It is called before the column gets actually added, etc..
Check if the column can be added to the table description.
It is implemented for a virtual column to check if the columns
it uses really exist.
Check if a column can be handled by ColumnDescSet.
It is called before the column gets actually added, etc..
Check when a column gets renamed in a table description.
It is not used.
Take action after a column has been handled by ColumnDescSet.
It is called after the column has been actually added, etc..
This gives, for instance, the virtual column class the opportunity
to update the virtual column list.
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.
It is called after handleRename has been called.
Create a PlainColumn column object out of this column description.
Create a RefColumn column object out of this column description.
Set the name of the column.
Store the object in AipsIO.
Get the object from AipsIO.
Register all column types. In this way the getFile function
can construct the correct xxxColumnDesc object.
Example
TableDesc tableDesc("theTableDesc", TableDesc::New);
// Add a float scalar column.
tableDesc.addColumn (ScalarColumnDesc<float> ("NAME");
// Get the description of a column and change the comments.
// In order to change the comments, a reference must be used
// (because the ColumnDesc copy constructor and assign have copy
// semantics).
ColumnDesc& myColDesc = tableDesc.columnDesc ("aName");
myColDesc.comment() += "some more comments";
Motivation
When getting the description of an arbitrary column, a pointer to
that description is needed to allow proper execution of virtual
functions.
An envelope class is needed to hide this from the user.
To Do
Member Description
enum Option
Enumerate the possible column options.
They can be combined by adding (logical or-ing) them.
ColumnDesc (const BaseColumnDesc&)
Construct from a column description.
This constructor is merely for the purpose of the automatic
conversion of an object like ScalarColumnDescColumnDesc (const ColumnDesc& that)
ColumnDesc()
~ColumnDesc()
ColumnDesc& operator= (const ColumnDesc& that)
Bool operator== (const ColumnDesc&) const
Bool operator!= (const ColumnDesc&) const
TableRecord& rwKeywordSet()
const TableRecord& keywordSet() const
const String& name() const
DataType dataType() const
DataType trueDataType() const
const String& dataTypeId() const
const String& dataManagerType() const
String& dataManagerType()
const String& dataManagerGroup() const
String& dataManagerGroup()
void setDefaultDataManager (Bool always=True)
const String& comment() const
String& comment()
int options() const
const ColumnDesc& coldesc = tableDesc.getColumn ("column_name");
if (coldesc.option() & ColumnDesc::Direct == ColumnDesc::Direct) {
// the column has the Direct flag set
}
Bool isFixedShape() 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)
The first version leaves the Direct option as is.
The second version sets the Direct option as given.
void setOptions (int options)
uInt maxLength() const
void setMaxLength (uInt maxLength)
const TableDesc* tableDesc() const
TableDesc* tableDesc()
void show() const
void show (ostream& os) const
friend AipsIO& operator<< (AipsIO& ios, const ColumnDesc& cd)
friend AipsIO& operator>> (AipsIO& ios, ColumnDesc& cd)
friend ostream& operator<< (ostream& ios, const ColumnDesc& cd)
static BaseColumnDesc* unknownColumnDesc (const String& name)
Thrown Exceptions
ColumnDesc (BaseColumnDesc*)
Construct from a pointer (for class BaseColumn).
void checkAdd (const ColumnDescSet& cds) const
void checkRename (const ColumnDescSet& cds, const String& newName) const
void handleAdd (ColumnDescSet& cds)
void handleRename (ColumnDescSet& cds, const String& oldName)
void handleRemove (ColumnDescSet& cds)
void renameAction (const String& newName, const String& oldName)
PlainColumn* makeColumn (ColumnSet* csp) const
RefColumn* makeRefColumn (RefTable* rtp, BaseColumn* bcp) const
void setName (const String& name)
void putFile (AipsIO& ios, const TableAttr&) const
void getFile (AipsIO&, const TableAttr&)
void registerColumnDesc()