casa
$Rev:20696$
|
00001 //# TableMeasType.h: Encapsulates the Measures type in the TableMeasDesc. 00002 //# Copyright (C) 1999,2000 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id: TableMeasType.h 18093 2004-11-30 17:51:10Z ddebonis $ 00027 00028 #ifndef MEASURES_TABLEMEASTYPE_H 00029 #define MEASURES_TABLEMEASTYPE_H 00030 00031 00032 //# Includes 00033 #include <casa/aips.h> 00034 #include <measures/Measures/MeasureHolder.h> 00035 00036 namespace casa { //# NAMESPACE CASA - BEGIN 00037 00038 //# Forward Declarations 00039 class String; 00040 class Table; 00041 class RecordInterface; 00042 00043 // <summary> 00044 // Definition of a Measure column in a Table. 00045 // </summary> 00046 00047 // <use visibility=local> 00048 00049 // <reviewed reviewer="Bob Garwood" date="1999/12/23" tests="tTableMeasures.cc"> 00050 // </reviewed> 00051 00052 // <prerequisite> 00053 //# Classes you should understand before using this one. 00054 // <li> <linkto module=Measures>Measures</linkto> 00055 // <li> <linkto module=Tables>Tables</linkto> 00056 // </prerequisite> 00057 00058 // <synopsis> 00059 // This class is a helper class for 00060 // <linkto class=TableMeasDescBase>TableMeasDescBase</linkto> 00061 // to know the type of measure it is dealing with. 00062 // <br>It eases the process of converting reference codes to their strings 00063 // and vice-versa. It also writes the measure type to a record to assist 00064 // in making table measure definitions persistent. 00065 // </synopsis> 00066 00067 // <example> 00068 // Create the object for an epoch measure. 00069 // TableMeasType mtype (MEpoch()); 00070 // // Get the code for the given string. 00071 // uInt code = mtype.refCode ("UTC"); 00072 // </example> 00073 00074 // <motivation> 00075 // Creating the required keyword for the definition of a Measure 00076 // in a Table is somewhat complicated. This class assists in that 00077 // process. 00078 // </motivation> 00079 // 00080 //# <todo asof="$DATE:$"> 00081 //# A List of bugs, limitations, extensions or planned refinements. 00082 //# </todo> 00083 00084 00085 class TableMeasType 00086 { 00087 public: 00088 TableMeasType(); 00089 00090 // Construct from the given type of measure. 00091 explicit TableMeasType (const Measure&); 00092 00093 // Copy constructor (copy semantics). 00094 TableMeasType (const TableMeasType& that); 00095 00096 ~TableMeasType(); 00097 00098 // Assignment operator (copy semantics) 00099 TableMeasType& operator= (const TableMeasType& that); 00100 00101 // Returns the descriptor's measure type as a String. 00102 const String& type() const; 00103 00104 // Translates the refCode for the descriptors measure type. 00105 const String& refType (uInt refCode) const; 00106 00107 // Returns the reference code for this object given a string. Throws 00108 // an exception if the refString is invalid for this object. 00109 uInt refCode (const String& refString) const; 00110 00111 // Creates a record from the MeasureHolder. 00112 void toRecord (RecordInterface& rec); 00113 00114 private: 00115 Int itsNtypes; //# number of refcodes/strings 00116 const String* itsStypes; //# refcode strings 00117 const uInt* itsTyps; //# refcodes 00118 MeasureHolder itsMeasHolder; //# Holds the measure 00119 }; 00120 00121 00122 00123 } //# NAMESPACE CASA - END 00124 00125 #endif