casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TableMeasType.h
Go to the documentation of this file.
1 //# TableMeasType.h: Encapsulates the Measures type in the TableMeasDesc.
2 //# Copyright (C) 1999,2000
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: aips2-request@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 //# $Id$
27 
28 #ifndef MEASURES_TABLEMEASTYPE_H
29 #define MEASURES_TABLEMEASTYPE_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 //# Forward Declarations
39 class String;
40 class Table;
41 class RecordInterface;
42 
43 // <summary>
44 // Definition of a Measure column in a Table.
45 // </summary>
46 
47 // <use visibility=local>
48 
49 // <reviewed reviewer="Bob Garwood" date="1999/12/23" tests="tTableMeasures.cc">
50 // </reviewed>
51 
52 // <prerequisite>
53 //# Classes you should understand before using this one.
54 // <li> <linkto module=Measures>Measures</linkto>
55 // <li> <linkto module=Tables>Tables</linkto>
56 // </prerequisite>
57 
58 // <synopsis>
59 // This class is a helper class for
60 // <linkto class=TableMeasDescBase>TableMeasDescBase</linkto>
61 // to know the type of measure it is dealing with.
62 // <br>It eases the process of converting reference codes to their strings
63 // and vice-versa. It also writes the measure type to a record to assist
64 // in making table measure definitions persistent.
65 // </synopsis>
66 
67 // <example>
68 // Create the object for an epoch measure.
69 // TableMeasType mtype (MEpoch());
70 // // Get the code for the given string.
71 // uInt code = mtype.refCode ("UTC");
72 // </example>
73 
74 // <motivation>
75 // Creating the required keyword for the definition of a Measure
76 // in a Table is somewhat complicated. This class assists in that
77 // process.
78 // </motivation>
79 //
80 //# <todo asof="$DATE:$">
81 //# A List of bugs, limitations, extensions or planned refinements.
82 //# </todo>
83 
84 
86 {
87 public:
88  TableMeasType();
89 
90  // Construct from the given type of measure.
91  explicit TableMeasType (const Measure&);
92 
93  // Copy constructor (copy semantics).
94  TableMeasType (const TableMeasType& that);
95 
97 
98  // Assignment operator (copy semantics)
100 
101  // Returns the descriptor's measure type as a String.
102  const String& type() const;
103 
104  // Translates the refCode for the descriptors measure type.
105  const String& refType (uInt refCode) const;
106 
107  // Returns the reference code for this object given a string. Throws
108  // an exception if the refString is invalid for this object.
109  uInt refCode (const String& refString) const;
110 
111  // Creates a record from the MeasureHolder.
112  void toRecord (RecordInterface& rec);
113 
114 private:
115  Int itsNtypes; //# number of refcodes/strings
116  const String* itsStypes; //# refcode strings
117  const uInt* itsTyps; //# refcodes
118  MeasureHolder itsMeasHolder; //# Holds the measure
119 };
120 
121 
122 
123 } //# NAMESPACE CASACORE - END
124 
125 #endif
MeasureHolder itsMeasHolder
int Int
Definition: aipstype.h:50
const String & type() const
Returns the descriptor&#39;s measure type as a String.
uInt refCode(const String &refString) const
Returns the reference code for this object given a string.
const String * itsStypes
Physical quantities within reference frame.
Definition: Measure.h:235
void toRecord(RecordInterface &rec)
Creates a record from the MeasureHolder.
A holder for Measures to enable record conversions.
TableMeasType & operator=(const TableMeasType &that)
Assignment operator (copy semantics)
Definition of a Measure column in a Table.
Definition: TableMeasType.h:85
String: the storage and methods of handling collections of characters.
Definition: String.h:223
Abstract base class for Record classes.
unsigned int uInt
Definition: aipstype.h:51
const String & refType(uInt refCode) const
Translates the refCode for the descriptors measure type.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42