casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
ScaRecordColDesc.h
Go to the documentation of this file.
00001 //# ScaRecordColDesc.h: Class for description of table scalar record columns
00002 //# Copyright (C) 1998,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: ScaRecordColDesc.h 21051 2011-04-20 11:46:29Z gervandiepen $
00027 
00028 #ifndef TABLES_SCARECORDCOLDESC_H
00029 #define TABLES_SCARECORDCOLDESC_H
00030 
00031 
00032 //# Includes
00033 #include <casa/aips.h>
00034 #include <tables/Tables/BaseColDesc.h>
00035 #include <casa/Containers/SimOrdMap.h>
00036 
00037 namespace casa { //# NAMESPACE CASA - BEGIN
00038 
00039 //# Forward Declarations
00040 class PlainColumn;
00041 class ColumnSet;
00042 
00043 
00044 // <summary>
00045 // Class to define columns of scalar records in tables
00046 // </summary>
00047 
00048 // <reviewed reviewer="Wim Brouw" date="1998/12/09" tests="tTableDesc">
00049 // </reviewed>
00050 
00051 // <use visibility=export>
00052 
00053 // <prerequisite>
00054 //   <li> <linkto class=ColumnDesc>ColumnDesc</linkto>
00055 //   <li> <linkto class=TableDesc>TableDesc</linkto>
00056 //   <li> <linkto class=TableRecord>TableRecord</linkto>
00057 // </prerequisite>
00058 
00059 // <etymology>
00060 //  This class builds descriptions of table columns where each cell (which
00061 //  may also be called a row) will hold a scalar record value.
00062 // </etymology>
00063 
00064 // <synopsis> 
00065 // ScalarRecordColumnDesc is the class for defining a
00066 // table column containing scalar record values. The only record class
00067 // supported is <linkto class=TableRecord>TableRecord</linkto>.
00068 // <br>
00069 // This class is similar to the templated class
00070 // <linkto class=ScalarColumnDesc>ScalarColumnDesc</linkto> used
00071 // to define column descriptions for scalars with a standard data type.
00072 // <p>
00073 // The data managers handle a record as an indirect Vector of uChar,
00074 // because class
00075 // <linkto class=ScalarRecordColumnData>ScalarRecordColumnData</linkto>
00076 // converts a record to such a vector before passing it to the data manager.
00077 // <p>
00078 // This class is derived from
00079 // <linkto class=BaseColumnDesc>BaseColumnDesc</linkto>, thus the functions
00080 // in there also apply to this class.
00081 // <br>
00082 // Once a column description is setup satisfactorily, it must be added
00083 // to a table description before it can be used by the table system.
00084 // </synopsis>
00085 
00086 // <example>
00087 // <srcblock>
00088 //     TableDesc tabDesc("tTableDesc", "1", TableDesc::New);
00089 //
00090 //     // Add a scalar integer column ac, define keywords for it
00091 //     // and define a default value 0.
00092 //     ScalarRecordColumnDesc<Int> acColumn("ac");
00093 //     acColumn.rwKeywordSet().define ("scale", Complex(0));
00094 //     acColumn.rwKeywordSet().define ("unit", "");
00095 //     acColumn.setDefault (0);
00096 //     tabDesc.addColumn (acColumn);
00097 //
00098 //     // Add another column, now with data type String..
00099 //     // This can be added directly, because no special things like
00100 //     // keywords or default values have to be set.
00101 //     tabDesc.addColumn (ScalarRecordColumnDesc<String>("name", "comments"));
00102 // </srcblock>
00103 // </example>
00104 
00105 // <motivation>
00106 // This class resembles the templated class
00107 // <linkto class=ScalarColumnDesc>ScalarColumnDesc</linkto>
00108 // a lot, but is different enough to make that templated class not usable
00109 // for records.
00110 // <br>In principle it could have been a template specialization,
00111 // but not all compilers support specializations so well.
00112 // </motivation>
00113 
00114 // <todo asof="$DATE:$">
00115 //# A List of bugs, limitations, extensions or planned refinements.
00116 //  <li> Introduce a class ArrayRecordColumnDesc to support arrays of records.
00117 // </todo>
00118 
00119 
00120 class ScalarRecordColumnDesc : public BaseColumnDesc
00121 {
00122 friend class ColumnDesc;
00123 
00124 public:
00125     // Construct the column with the given name.
00126     // The data manager type defaults to the StandardStMan storage manager.
00127     // The data manager group defaults to the data manager type.
00128     explicit ScalarRecordColumnDesc (const String& name);
00129 
00130     // Construct the column with the given name and comment.
00131     // The data manager type defaults to the StandardStMan storage manager.
00132     // The data manager group defaults to the data manager type.
00133     ScalarRecordColumnDesc (const String& name, const String& comment);
00134 
00135     // Construct the column with the given name, comment, and
00136     // default data manager type and group.
00137     // A blank data manager group defaults to the data manager type.
00138     ScalarRecordColumnDesc (const String& name, const String& comment,
00139                             const String& dataManName,
00140                             const String& dataManGroup);
00141 
00142     // Copy constructor (copy semantics);
00143     ScalarRecordColumnDesc (const ScalarRecordColumnDesc&);
00144 
00145     ~ScalarRecordColumnDesc();
00146 
00147     // Assignment (copy semantics);
00148     ScalarRecordColumnDesc& operator= (const ScalarRecordColumnDesc&);
00149 
00150     // Clone this column description.
00151     virtual BaseColumnDesc* clone() const;
00152 
00153     // Get the name of this class. It is used by the registration process.
00154     virtual String className() const;
00155 
00156     // Create a Column object out of this.
00157     // This is used by class ColumnSet to construct a table column object.
00158     virtual PlainColumn* makeColumn (ColumnSet*) const;
00159 
00160     // Show the column.
00161     virtual void show (ostream& os) const;
00162 
00163     // Create the object from AipsIO (this function is registered
00164     // by ColumnDesc.cc).
00165     static BaseColumnDesc* makeDesc (const String& name);
00166 
00167 private:
00168     // Put the object.
00169     virtual void putDesc (AipsIO&) const;
00170 
00171     // Get the object.
00172     virtual void getDesc (AipsIO&);
00173 };
00174 
00175 
00176 
00177 } //# NAMESPACE CASA - END
00178 
00179 #endif