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
42// <summary>
43// Definition of a Measure Value in a Table.
44// </summary>
45
46// <use visibility=export>
47
48// <reviewed reviewer="Bob Garwood" date="1999/12/23" tests="tTableMeasures.cc">
49// </reviewed>
50
51// <prerequisite>
52//# Classes you should understand before using this one.
53// <li> <linkto module=Measures>Measures</linkto>
54// <li> <linkto module=Tables>Tables</linkto>
55// <li> <linkto class=TableMeasDesc>TableMeasDesc</linkto>
56// </prerequisite>
57
58// <synopsis>
59// TableMeasValueDesc is a class for setting up the Measure value
60// component of the TableMeasDesc in the TableMeasures system. Its purpose
61// it to specify the Table column to be used as a Measure column through
62// which Measures are subsequently written to and read from via
63// either an <linkto class="ArrayMeasColumn">ArrayMeasColumn</linkto>
64// or <linkto class="ScalarMeasColumn">ScalarMeasColumn</linkto> object.
65//
66// The column used as the Measure column is always an ArrayColumn<Double>
67// irrespective of whether it is to store scalars or arrays of Measures and
68// irrespective of the type of Measure.
69// </synopsis>
70
71// <example>
72//<ol>
73// <li>
74// <srcblock>
75// // Add a column to the table. This column is to be used to store
76// // MPositions. Measure columns are alway ArrayColumn<Double>
77// ArrayColumnDesc<Double> cdPosCol("MPosColumn", "MPosition column");
78// td.addColumn(cdPosCol);
79// ...
80// // create the TableMeasValueDesc object
81// TableMeasValueDesc valueDesc(td, "MPosColumn");
82// </srcblock>
83//</ol>
84// For an example of the use of the TableMeasValueDesc class in the context
85// of a full TableMeasDesc declaration see class
86// <linkto class="TableMeasDesc">TableMeasDesc</linkto>.
87// </example>
88
89// <motivation>
90// Creating the required keyword for the definition of a Measure
91// in a Table is somewhat complicated. This class assists in that
92// process.
93// </motivation>
94//
95// <thrown>
96// <li>AipsError if the specified column doesn't exist or it isn't
97// an ArrayColumn or its type is not Double.
98// </thrown>
99//
100//# <todo asof="$DATE:$">
101//# A List of bugs, limitations, extensions or planned refinements.
102//# </todo>
103
104
106{
107public:
108 // Null constructor
110
111 // Construct the MeasValue column descriptor for the given column.
112 // The column must be a column of type Double and should exist in
113 // the TableDesc.
115
116 // Construct the MeasValue column descriptor for the given column.
117 // Checking if the column exists is done in the write function.
118 // <group>
123 // </group>
124
125 // Copy constructor.
127
129
130 // Assignment operator.
132
133 // Write the type, unit, and MEASINFO record into the column keywords.
134 // It checks if the column exists in the given table description.
135 // <group>
136 void write (TableDesc&, const TableRecord& measInfo);
137 void write (Table&, const TableRecord& measInfo);
138 // </group>
139
140 // Get the name of the underlying column.
141 const String& columnName() const
142 { return itsColumn; }
143
144private:
145 String itsColumn; //# MeasValue column name.
146
147
148 // Write the actual keywords.
149 void writeKeys (TableRecord& columnKeyset,
150 const TableRecord& measInfo);
151
152 // Throw an exception if the quantum column doesn't exist or is of the
153 // wrong type.
154 void checkColumn (const TableDesc& td) const;
155};
156
157
158
159} //# NAMESPACE CASACORE - END
160
161#endif
String: the storage and methods of handling collections of characters.
Definition String.h:223
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.
this file contains all the compiler specific defines
Definition mainpage.dox:28
char Char
Definition aipstype.h:44