Loading...
Searching...
No Matches
casacore::ScalarColumnDesc< T > Class Template Reference
tables package (libcasa_tables) » Tables_module

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.
Public Member Functions inherited from casacore::BaseColumnDesc
| 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.
| BaseColumnDesc (const BaseColumnDesc &)
| Copy constructor (copy semantics).
virtual | ~BaseColumnDesc ()
TableRecord & | rwKeywordSet ()
| Get access to the set of keywords.
const TableRecord & | keywordSet () const
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.
const String & | dataManagerType () const
| Get the type name of the default data manager.
String & | dataManagerType ()
| Get the type name of the default data manager.
const String & | dataManagerGroup () const
| Get the data manager group.
String & | dataManagerGroup ()
| Get the data manager group.
void | setDefaultDataManager (Bool always)
| Set the data manager type and group to the default.
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
| Test if column is scalar, array or table.
Bool | isArray () const
Bool | isTable () const
Int | ndim () const
| Get the number of dimensions.
const IPosition & | shape () const
| Get the predefined shape.
void | setNdim (uInt ndim)
| Set the number of dimensions.
void | setShape (const IPosition &shape)
| Set the predefined shape.
void | setShape (const IPosition &shape, Bool directOption)
void | setOptions (Int options)
| Set the options to the given value.
uInt | maxLength () const
| Get the maximum value length.
void | setMaxLength (uInt maxLength)
| Set the maximum value length.
const TableDesc * | tableDesc () const
| Get table description (in case column contains subtables).
virtual TableDesc * | tableDesc ()
void | setName (const String &name)
| Set the name of the column (for a rename).

## 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

## Additional Inherited Members

Protected Member Functions inherited from casacore::BaseColumnDesc
BaseColumnDesc & | operator= (const BaseColumnDesc &)
| Assignment (copy semantics).
void | putFile (AipsIO &, const TableAttr &) const
| Put the object.
void | getFile (AipsIO &, const TableAttr &)
| Get the object.
RefColumn * | makeRefColumn (RefTable *, BaseColumn *) const
| Make a RefColumn object out of the description.
Protected Attributes inherited from casacore::BaseColumnDesc
String | colName_p
String | comment_p
String | dataManType_p
String | dataManGroup_p
DataType | dtype_p
String | dtypeId_p
Int | option_p
Int | nrdim_p
IPosition | shape_p
uInt | maxLength_p
TableRecord * | keySetPtr_p
Bool | isScalar_p
Bool | isArray_p
Bool | isTable_p

## Detailed Description

template<class T>
class casacore::ScalarColumnDesc< T >

Templated class to define columns of scalars in tables

### Review Status

Reviewed By:
  Gareth Hunt
Date Reviewed:
  94Nov17

### Intended use:

Public interface

### Prerequisite

- BaseColumnDesc
- TableDesc

### Etymology

This class builds descriptions of table columns where each cell (which may also be called a row) will hold a scalar value.

### Synopsis

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, Int64, 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:

- 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<Int>).
- A data type id, which tells the unique name of non-standard data types (i.e. for data type == TpOther).
- Comment, which defaults to an empty string. This serves purely as an informational string for the user.
- Default value, which is only possible for the standard data types. It defaults to the undefined value defined in ValType.h. When a row gets added to a table, it is possible to initialize the column fields in the 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 data manager.
- 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 StandardStMan 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 or-ing them. Currently only the Undefined flag applies to scalars.
- 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 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.

### Example

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"));
casacore::ScalarColumnDesc::ScalarColumnDesc
ScalarColumnDesc(const String &name, int options=0)
Construct the column with the given name.
casacore::TableDesc
Definition TableDesc.h:189
casacore::TableDesc::New
@ New
Definition TableDesc.h:193

### 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.

### Template Type Argument Requirements (T)

- Default constructor
- Copy constructor
- Assignment operator
- static String dataTypeId(); // (not needed for builtin types) This should return the unique "name" of the class.

Definition at line 161 of file ScaColDesc.h.

## Constructor & Destructor Documentation

## ScalarColumnDesc() [1/5]

template<class T>

casacore::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.

References casacore::BaseColumnDesc::name(), and casacore::BaseColumnDesc::options().

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

## ScalarColumnDesc() [2/5]

template<class T>

casacore::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.

References casacore::BaseColumnDesc::comment(), casacore::BaseColumnDesc::name(), and casacore::BaseColumnDesc::options().

## ScalarColumnDesc() [3/5]

template<class T>

casacore::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.

References casacore::BaseColumnDesc::comment(), casacore::BaseColumnDesc::name(), and casacore::BaseColumnDesc::options().

## ScalarColumnDesc() [4/5]

template<class T>

casacore::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.

References casacore::BaseColumnDesc::comment(), defaultValue(), casacore::BaseColumnDesc::name(), and casacore::BaseColumnDesc::options().

## ScalarColumnDesc() [5/5]

template<class T>

casacore::ScalarColumnDesc< T >::ScalarColumnDesc | ( | const ScalarColumnDesc< T > & |  | ) |

Copy constructor (copy semantics);.

References ScalarColumnDesc().

## ~ScalarColumnDesc()

template<class T>

casacore::ScalarColumnDesc< T >::~ScalarColumnDesc | ( |  | ) |

## Member Function Documentation

## className()

template<class T>

String casacore::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 casacore::BaseColumnDesc.

## clone()

template<class T>

BaseColumnDesc * casacore::ScalarColumnDesc< T >::clone | ( |  | ) | const

virtual

Clone this column description.

Implements casacore::BaseColumnDesc.

References casacore::BaseColumnDesc::BaseColumnDesc().

## defaultValue()

template<class T>

const T & casacore::ScalarColumnDesc< T >::defaultValue | ( |  | ) | const

inline

Get the default value.

Definition at line 215 of file ScaColDesc.h.

References defaultVal_p.

Referenced by ScalarColumnDesc(), and setDefault().

## getDesc()

template<class T>

virtual void casacore::ScalarColumnDesc< T >::getDesc | ( | AipsIO & |  | ) |

private virtual

Get the object.

Implements casacore::BaseColumnDesc.

## makeColumn()

template<class T>

virtual PlainColumn * casacore::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 casacore::BaseColumnDesc.

## makeConcatColumn()

template<class T>

virtual ConcatColumn * casacore::ScalarColumnDesc< T >::makeConcatColumn | ( | ConcatTable * |  | ) | const

virtual

Make a ConcatColumn object out of the description.

Reimplemented from casacore::BaseColumnDesc.

## makeDesc()

template<class T>

BaseColumnDesc * casacore::ScalarColumnDesc< T >::makeDesc | ( | const String & | name | ) |

static

Create the object from AipsIO (this function is registered).

References casacore::BaseColumnDesc::BaseColumnDesc(), and casacore::BaseColumnDesc::name().

## operator=()

template<class T>

ScalarColumnDesc< T > & casacore::ScalarColumnDesc< T >::operator= | ( | const ScalarColumnDesc< T > & |  | ) |

Assignment (copy semantics);.

References ScalarColumnDesc().

## putDesc()

template<class T>

virtual void casacore::ScalarColumnDesc< T >::putDesc | ( | AipsIO & |  | ) | const

private virtual

Put the object.

Implements casacore::BaseColumnDesc.

## registerClass()

template<class T>

void casacore::ScalarColumnDesc< T >::registerClass | ( |  | ) | const

Register the construction function of this class.

## setDefault()

template<class T>

void casacore::ScalarColumnDesc< T >::setDefault | ( | const T & | defaultValue | ) |

inline

Set the default value.

Definition at line 211 of file ScaColDesc.h.

References defaultVal_p, and defaultValue().

## show()

template<class T>

void casacore::ScalarColumnDesc< T >::show | ( | ostream & | os | ) | const

virtual

Show the column.

Implements casacore::BaseColumnDesc.

## Friends And Related Symbol Documentation

## ColumnDesc

template<class T>

friend class ColumnDesc

friend

Definition at line 163 of file ScaColDesc.h.

References ColumnDesc.

Referenced by ColumnDesc.

## Member Data Documentation

## defaultVal_p

template<class T>

T casacore::ScalarColumnDesc< T >::defaultVal_p

private

Definition at line 235 of file ScaColDesc.h.

Referenced by defaultValue(), and setDefault().

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

- tables/Tables/ScaColData.h
- tables/Tables/ScaColDesc.h