casacore
Loading...
Searching...
No Matches
TableMeasValueDesc.h
Go to the documentation of this file.
1// # TableMeasValueDesc.h: Definition of a MeasValue in a Table.
2// # Copyright (C) 1997,1999,2000,2001
3// # Associated Universities, Inc. Washington DC, USA.
4// #
5// # This library is free software; you can redistribute it and/or modify it
6// # under the terms of the GNU Library General Public License as published by
7// # the Free Software Foundation; either version 2 of the License, or (at your
8// # option) any later version.
9// #
10// # This library is distributed in the hope that it will be useful, but WITHOUT
11// # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12// # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13// # License for more details.
14// #
15// # You should have received a copy of the GNU Library General Public License
16// # along with this library; if not, write to the Free Software Foundation,
17// # Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18// #
19// # Correspondence concerning AIPS++ should be addressed as follows:
20// # Internet email: casa-feedback@nrao.edu.
21// # Postal address: AIPS++ Project Office
22// # National Radio Astronomy Observatory
23// # 520 Edgemont Road
24// # Charlottesville, VA 22903-2475 USA
25
26#ifndef MEASURES_TABLEMEASVALUEDESC_H
27#define MEASURES_TABLEMEASVALUEDESC_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/BasicSL/String.h>
32
33namespace casacore { // # NAMESPACE CASACORE - BEGIN
34
35// # Forward Declarations
36class ColumnDesc;
37class Table;
38class TableDesc;
39class TableRecord;
40
41// <summary>
42// Definition of a Measure Value in a Table.
43// </summary>
44
45// <use visibility=export>
46
47// <reviewed reviewer="Bob Garwood" date="1999/12/23" tests="tTableMeasures.cc">
48// </reviewed>
49
50// <prerequisite>
51// # Classes you should understand before using this one.
52// <li> <linkto module=Measures>Measures</linkto>
53// <li> <linkto module=Tables>Tables</linkto>
54// <li> <linkto class=TableMeasDesc>TableMeasDesc</linkto>
55// </prerequisite>
56
57// <synopsis>
58// TableMeasValueDesc is a class for setting up the Measure value
59// component of the TableMeasDesc in the TableMeasures system. Its purpose
60// it to specify the Table column to be used as a Measure column through
61// which Measures are subsequently written to and read from via
62// either an <linkto class="ArrayMeasColumn">ArrayMeasColumn</linkto>
63// or <linkto class="ScalarMeasColumn">ScalarMeasColumn</linkto> object.
64//
65// The column used as the Measure column is always an ArrayColumn<Double>
66// irrespective of whether it is to store scalars or arrays of Measures and
67// irrespective of the type of Measure.
68// </synopsis>
69
70// <example>
71//<ol>
72// <li>
73// <srcblock>
74// // Add a column to the table. This column is to be used to store
75// // MPositions. Measure columns are alway ArrayColumn<Double>
76// ArrayColumnDesc<Double> cdPosCol("MPosColumn", "MPosition column");
77// td.addColumn(cdPosCol);
78// ...
79// // create the TableMeasValueDesc object
80// TableMeasValueDesc valueDesc(td, "MPosColumn");
81// </srcblock>
82//</ol>
83// For an example of the use of the TableMeasValueDesc class in the context
84// of a full TableMeasDesc declaration see class
85// <linkto class="TableMeasDesc">TableMeasDesc</linkto>.
86// </example>
87
88// <motivation>
89// Creating the required keyword for the definition of a Measure
90// in a Table is somewhat complicated. This class assists in that
91// process.
92// </motivation>
93//
94// <thrown>
95// <li>AipsError if the specified column doesn't exist or it isn't
96// an ArrayColumn or its type is not Double.
97// </thrown>
98//
99// # <todo asof="$DATE:$">
100// # A List of bugs, limitations, extensions or planned refinements.
101// # </todo>
102
104 public:
105 // Null constructor
107
108 // Construct the MeasValue column descriptor for the given column.
109 // The column must be a column of type Double and should exist in
110 // the TableDesc.
112
113 // Construct the MeasValue column descriptor for the given column.
114 // Checking if the column exists is done in the write function.
115 // <group>
118 // </group>
119
120 // Copy constructor.
122
124
125 // Assignment operator.
127
128 // Write the type, unit, and MEASINFO record into the column keywords.
129 // It checks if the column exists in the given table description.
130 // <group>
131 void write(TableDesc&, const TableRecord& measInfo);
132 void write(Table&, const TableRecord& measInfo);
133 // </group>
134
135 // Get the name of the underlying column.
136 const String& columnName() const { return itsColumn; }
137
138 private:
139 String itsColumn; // # MeasValue column name.
140
141 // Write the actual keywords.
142 void writeKeys(TableRecord& columnKeyset, const TableRecord& measInfo);
143
144 // Throw an exception if the quantum column doesn't exist or is of the
145 // wrong type.
146 void checkColumn(const TableDesc& td) const;
147};
148
149} // namespace casacore
150
151#endif
String: the storage and methods of handling collections of characters.
Definition String.h:355
void writeKeys(TableRecord &columnKeyset, const TableRecord &measInfo)
Write the actual keywords.
TableMeasValueDesc(const TableDesc &, const String &columnName)
Construct the MeasValue column descriptor for the given column.
void write(TableDesc &, const TableRecord &measInfo)
Write the type, unit, and MEASINFO record into the column keywords.
TableMeasValueDesc & operator=(const TableMeasValueDesc &that)
Assignment operator.
TableMeasValueDesc(const Char *columnName)
TableMeasValueDesc()
Null constructor.
void write(Table &, const TableRecord &measInfo)
TableMeasValueDesc(const TableMeasValueDesc &that)
Copy constructor.
void checkColumn(const TableDesc &td) const
Throw an exception if the quantum column doesn't exist or is of the wrong type.
TableMeasValueDesc(const String &columnName)
Construct the MeasValue column descriptor for the given column.
const String & columnName() const
Get the name of the underlying column.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
char Char
Definition aipstype.h:44