ArrColDesc.h
Classes
- ArrayColumnDesc -- Templated class for description of table array columns (full description)
template<class T> class ArrayColumnDesc : public BaseColumnDesc
Interface
- Public Members
- ArrayColumnDesc (const String& name, Int ndim = -1, int options = 0)
- ArrayColumnDesc (const String& name, const String& comment, Int ndim = -1, int options = 0)
- ArrayColumnDesc (const String& name, const String& comment, const String& dataManName, const String& dataManGroup, Int ndim = -1, int options = 0)
- ArrayColumnDesc (const String& name, const String& comment, const IPosition& shape, int options = 0)
- ArrayColumnDesc (const String& name, const String& comment, const String& dataManName, const String& dataManGroup, const IPosition& shape, int options = 0)
- ArrayColumnDesc (const ArrayColumnDesc<T>&)
- ~ArrayColumnDesc()
- ArrayColumnDesc<T>& operator= (const ArrayColumnDesc<T>&)
- BaseColumnDesc* clone() const
- Bool isArray() const
- String className() const
- IPosition shape() const
- void setDefault (const Array<T>& defaultValue)
- const Array<T>* defaultValue() const
- PlainColumn* makeColumn (ColumnSet*)
- void show() const
- Protected Members
- ArrayColumnDesc (SimpleOrderedMap<String, BaseColumnDesc* (*)(const String&, AipsIO&)>&)
- static BaseColumnDesc* makeDesc(const String& name, AipsIO&)
- ArrayColumnDesc (AipsIO&)
- void putDesc (AipsIO&) const
Review Status
- Reviewed By:
- Gareth Hunt
- Date Reviewed:
- 94Nov17
Prerequisite
- BaseColumnDesc (and its prerequisites)
- TableDesc
Etymology
This class builds descriptions of table columns where each cell (which
may also be called a row) will hold an array.
Synopsis
ArrayColumnDesc is a templated class for defining a table column
containing arrays.
The table values are handled by a data manager. This can be
a storage manager to store the values in a file or it can be
a virtual column engine to calculate them on-the-fly.
Only the basic data types are allowed when storing in a file. These are:
Bool, uChar, Int, uInt, float, double, Complex, DComplex and String.
At table creation time (when a table gets created from a table
description), each column needs to be bound to a data manager.
If not done explicitly, the table system will bind a column to the
default manager defined in the column description.
An array column description consists of the following attributes:
- Name, which has to be unique and must also be different
from possible table keyword names.
- Data type, which is determined by the template parameter
(e.g. ArrayColumnDesc).
- Comment, which defaults to the empty string.
This serves purely as an informational string for the user.
- Dimensionality. If given, all arrays in the column need
to have that dimensionality.
- Shape. If given, all arrays in the column need to have
that shape.
- Optional default value (can only be given if shape is defined).
When a row gets added to a table, it is possible to
initialize the column cell in that row with this default value.
- Default data manager, which will be used if a column
for a newly created table is not explicitly bound to a
datamanager.
- Data manager group, which serves 2 purposes.
Firstly it can be used in class SetupNewTable to bind a group
of columns.
Secondly, when the default data managers are used, it
allows, for example, to have 2 AipsIO storage managers.
One for one group of columns and one for another group of columns.
- Options. These are defined in ColumnDesc.h and can be combined
by logical or-ing them.
The only ColumnDesc option important for a scalar column is
ColumnDesc::Direct. This option determines if an array is directly
stored in the table or if it is stored indirectly in a separate
file.
Direct arrays have the same shape in all cells in the column,
which must be set while creating a table (if not already defined in
the description).
Indirect arrays can have a different shape or dimensionality
in each cell of a column. It can even be the case that a cell
does not contain an array, thus is undefined.
- Default keyword set, which defaults to an empty set.
When a table column gets created from the description, it gets
a copy of this keyword set as its initial keyword set.
There are several constructors, which allow the definition of most
of the above mentioned attributes. Others, like the default keyword
set, have to be defined explicitly.
This class is derived from BaseColumnDesc, thus the functions
in there also apply to this class.
Once a column description is set up satisfactorily, it must be added
to a table description before it can be used by the table system.
Example
TableDesc tabDesc("tTableDesc", "1", TableDesc::New);
// Now define array columns.
// This one is indirect and has no dimensionality mentioned yet.
// Define the keyword UNIT in it.
ArrayColumnDesc<Complex> arr1Column("Arr1", "comment for Arr1");
arr1Column.keywordSet().keysString()("UNIT") = "Jy";
tabDesc.addColumn (arr1Column);
// This one is indirect and has 3-dim arrays.
tabDesc.addColumn (ArrayColumnDesc<Int>("Arr2",
"comment for Arr2",
3));
// This one is direct and has 2-dim arrays with axis lengths 4 and 7.
tabDesc.addColumn (ArrayColumnDesc<uInt>("Arr3",
"comment for Arr1",
IPosition(2,4,7),
ColumnDesc::Direct));
Motivation
Several column description classes are needed to allow the user
to define attributes which are special for each column type.
For scalars the special attribute is the default value.
They all have to be templated to support arbitrary data types.
To Do
- Maybe the default value should be a single value instead
of a full array (not very important).
Member Description
ArrayColumnDesc (const String& name, Int ndim = -1, int options = 0)
Construct the column with the given name and dimensionality.
The data manager type defaults to the StManAipsIO storage manager.
The data manager group defaults to the data manager type.
Ndim <=0 means that the number of dimensions is free and will
be defined when creating the table (rows). Ndim>0 means that
the arrays in this column must have the given dimensionality.
The possible options are defined in ColumnDesc.h.
ArrayColumnDesc (const String& name, const String& comment, Int ndim = -1, int options = 0)
Construct the column with the given name, dimensionality, and comment.
The data manager type defaults to the StManAipsIO storage manager.
The data manager group defaults to the data manager type.
Ndim <=0 means that the number of dimensions is free and will
be defined when creating the table (rows). Ndim>0 means that
the arrays in this column must have the given dimensionality.
The possible options are defined in ColumnDesc.h.
ArrayColumnDesc (const String& name, const String& comment, const String& dataManName, const String& dataManGroup, Int ndim = -1, int options = 0)
Construct the column with the given name, dimensionality, comment,
and default data manager type and group.
A blank data manager group defaults to the data manager type.
Ndim <=0 means that the number of dimensions is free and will
be defined when creating the table (rows). Ndim>0 means that
the arrays in this column must have the given dimensionality.
The possible options are defined in ColumnDesc.h.
ArrayColumnDesc (const String& name, const String& comment, const IPosition& shape, int options = 0)
Construct the column with the given name, shape, and comment.
The data manager type defaults to the StManAipsIO storage manager.
The data manager group defaults to the data manager type.
The possible options are defined in ColumnDesc.h.
This constructor can only be used for direct arrays, because the
shape of indirect arrays can only be set per row.
ArrayColumnDesc (const String& name, const String& comment, const String& dataManName, const String& dataManGroup, const IPosition& shape, int options = 0)
Construct the column with the given name, shape, comment,
and default data manager type and group.
A blank data manager group defaults to the data manager type.
The possible options are defined in ColumnDesc.h.
This constructor can only be used for direct arrays, because the
shape of indirect arrays can only be set per row.
Copy constructor (copy semantics);
ArrayColumnDesc<T>& operator= (const ArrayColumnDesc<T>&)
Assignment (copy semantics);
BaseColumnDesc* clone() const
Clone this column description to another.
The column is an array.
Get the name of this class. It is used by the registration process.
The template argument gets part of the name.
IPosition shape() const
Get the shape.
If no shape has been defined, a zero-length IPosition is returned.
void setDefault (const Array<T>& defaultValue)
Set the default value.
This can only be done if the shape of the arrays in the column has
defined, thus it can only be done for direct arrays.
The shape of the default value array must match that shape.
Get the default value.
If no default value was defined, a zero pointer is returned.
PlainColumn* makeColumn (ColumnSet*)
Create a Column object out of this.
This is used by class ColumnSet to construct a table column object.
void show() const
Show the column.
ArrayColumnDesc (SimpleOrderedMap<String, BaseColumnDesc* (*)(const String&, AipsIO&)>&)
default value
Construct the object to register its class.
static BaseColumnDesc* makeDesc(const String& name, AipsIO&)
Create the object from AipsIO (this function is registered).
Construct object from AipsIO (used by makeDesc).
void putDesc (AipsIO&) const
Put the object.
Copyright © 1995 Associated Universities Inc., Washington, D.C.