casa
$Rev:20696$
|
Templated class to define columns of scalars in tables. More...
#include <ScaColDesc.h>
Public Member Functions | |
ScalarColumnDesc (const String &name, int options=0) | |
Construct the column with the given name. | |
ScalarColumnDesc (const String &name, const String &comment, int options=0) | |
Construct the column with the given name and comment. | |
ScalarColumnDesc (const String &name, const String &comment, const String &dataManName, const String &dataManGroup, int options=0) | |
Construct the column with the given name, comment, and default data manager type and group. | |
ScalarColumnDesc (const String &name, const String &comment, const String &dataManName, const String &dataManGroup, const T &defaultValue, int options=0) | |
Construct the column with the given name, comment, default data manager type and group, and default value. | |
ScalarColumnDesc (const ScalarColumnDesc< T > &) | |
Copy constructor (copy semantics);. | |
~ScalarColumnDesc () | |
ScalarColumnDesc< T > & | operator= (const ScalarColumnDesc< T > &) |
Assignment (copy semantics);. | |
BaseColumnDesc * | clone () const |
Clone this column description. | |
String | className () const |
Get the name of this class. | |
void | setDefault (const T &defaultValue) |
Set the default value. | |
const T & | defaultValue () const |
Get the default value. | |
virtual PlainColumn * | makeColumn (ColumnSet *) const |
Create a Column object out of this. | |
virtual ConcatColumn * | makeConcatColumn (ConcatTable *) const |
Make a ConcatColumn object out of the description. | |
void | show (ostream &os) const |
Show the column. | |
void | registerClass () const |
Register the construction function of this class. | |
Static Public Member Functions | |
static BaseColumnDesc * | makeDesc (const String &name) |
Create the object from AipsIO (this function is registered). | |
Private Member Functions | |
virtual void | putDesc (AipsIO &) const |
Put the object. | |
virtual void | getDesc (AipsIO &) |
Get the object. | |
Private Attributes | |
T | defaultVal_p |
Friends | |
class | ColumnDesc |
Templated class to define columns of scalars in tables.
Public interface
This class builds descriptions of table columns where each cell (which may also be called a row) will hold a scalar value.
ScalarColumnDesc is a templated class for defining a table column containing scalar values. Note that class ScalarRecordColumnDesc has to be used to define the description of a column containing records.
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, Short, uShort, 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 data manager defined in the column description.
A scalar column description consists of the following attributes:
There are several constructors, which allow to define 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 setup satisfactorily, it must be added to a table description before it can be used by the table system.
TableDesc tabDesc("tTableDesc", "1", TableDesc::New); // Add a scalar integer column ac, define keywords for it // and define a default value 0. ScalarColumnDesc<Int> acColumn("ac"); acColumn.rwKeywordSet().define ("scale", Complex(0)); acColumn.rwKeywordSet().define ("unit", ""); acColumn.setDefault (0); tabDesc.addColumn (acColumn); // Add another column, now with data type String.\. // This can be added directly, because no special things like // keywords or default values have to be set. tabDesc.addColumn (ScalarColumnDesc<String>("name", "comments"));
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.
static String dataTypeId(); // (not needed for builtin types)
This should return the unique "name" of the class. Definition at line 164 of file ScaColDesc.h.
casa::ScalarColumnDesc< T >::ScalarColumnDesc | ( | const String & | name, |
int | options = 0 |
||
) | [explicit] |
Construct the column with the given name.
The data manager type defaults to the StandardStMan storage manager. The data manager group defaults to the data manager type. The possible options are defined in ColumnDesc.h.
casa::ScalarColumnDesc< T >::ScalarColumnDesc | ( | const String & | name, |
const String & | comment, | ||
int | options = 0 |
||
) |
Construct the column with the given name and comment.
The data manager type defaults to the StandardStMan storage manager. The data manager group defaults to the data manager type. The possible options are defined in ColumnDesc.h.
casa::ScalarColumnDesc< T >::ScalarColumnDesc | ( | const String & | name, |
const String & | comment, | ||
const String & | dataManName, | ||
const String & | dataManGroup, | ||
int | options = 0 |
||
) |
Construct the column with the given name, 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.
casa::ScalarColumnDesc< T >::ScalarColumnDesc | ( | const String & | name, |
const String & | comment, | ||
const String & | dataManName, | ||
const String & | dataManGroup, | ||
const T & | defaultValue, | ||
int | options = 0 |
||
) |
Construct the column with the given name, comment, default data manager type and group, and default value.
A blank data manager group defaults to the data manager type. The possible options are defined in ColumnDesc.h.
casa::ScalarColumnDesc< T >::ScalarColumnDesc | ( | const ScalarColumnDesc< T > & | ) |
Copy constructor (copy semantics);.
casa::ScalarColumnDesc< T >::~ScalarColumnDesc | ( | ) |
String casa::ScalarColumnDesc< T >::className | ( | ) | const [virtual] |
Get the name of this class.
It is used by the registration process. The template argument gets part of the name.
Implements casa::BaseColumnDesc.
BaseColumnDesc* casa::ScalarColumnDesc< T >::clone | ( | ) | const [virtual] |
Clone this column description.
Implements casa::BaseColumnDesc.
const T& casa::ScalarColumnDesc< T >::defaultValue | ( | ) | const [inline] |
Get the default value.
Definition at line 218 of file ScaColDesc.h.
References casa::ScalarColumnDesc< T >::defaultVal_p.
Referenced by casa::ScalarColumnDesc< T >::setDefault().
virtual void casa::ScalarColumnDesc< T >::getDesc | ( | AipsIO & | ) | [private, virtual] |
Get the object.
Implements casa::BaseColumnDesc.
virtual PlainColumn* casa::ScalarColumnDesc< T >::makeColumn | ( | ColumnSet * | ) | const [virtual] |
Create a Column object out of this.
This is used by class ColumnSet to construct a table column object.
Implements casa::BaseColumnDesc.
virtual ConcatColumn* casa::ScalarColumnDesc< T >::makeConcatColumn | ( | ConcatTable * | ) | const [virtual] |
Make a ConcatColumn object out of the description.
Reimplemented from casa::BaseColumnDesc.
static BaseColumnDesc* casa::ScalarColumnDesc< T >::makeDesc | ( | const String & | name | ) | [static] |
Create the object from AipsIO (this function is registered).
ScalarColumnDesc<T>& casa::ScalarColumnDesc< T >::operator= | ( | const ScalarColumnDesc< T > & | ) |
Assignment (copy semantics);.
virtual void casa::ScalarColumnDesc< T >::putDesc | ( | AipsIO & | ) | const [private, virtual] |
Put the object.
Implements casa::BaseColumnDesc.
void casa::ScalarColumnDesc< T >::registerClass | ( | ) | const |
Register the construction function of this class.
void casa::ScalarColumnDesc< T >::setDefault | ( | const T & | defaultValue | ) | [inline] |
Set the default value.
Definition at line 214 of file ScaColDesc.h.
References casa::ScalarColumnDesc< T >::defaultVal_p, and casa::ScalarColumnDesc< T >::defaultValue().
void casa::ScalarColumnDesc< T >::show | ( | ostream & | os | ) | const [virtual] |
Show the column.
Implements casa::BaseColumnDesc.
friend class ColumnDesc [friend] |
Reimplemented from casa::BaseColumnDesc.
Definition at line 166 of file ScaColDesc.h.
T casa::ScalarColumnDesc< T >::defaultVal_p [private] |
Definition at line 238 of file ScaColDesc.h.
Referenced by casa::ScalarColumnDesc< T >::defaultValue(), and casa::ScalarColumnDesc< T >::setDefault().