casacore
ScaRecordColDesc.h
Go to the documentation of this file.
1 //# ScaRecordColDesc.h: Class for description of table scalar record columns
2 //# Copyright (C) 1998,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 TABLES_SCARECORDCOLDESC_H
29 #define TABLES_SCARECORDCOLDESC_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
34 #include <casacore/tables/Tables/BaseColDesc.h>
35 #include <casacore/casa/Containers/SimOrdMap.h>
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 //# Forward Declarations
40 class PlainColumn;
41 class ColumnSet;
42 
43 
44 // <summary>
45 // Class to define columns of scalar records in tables
46 // </summary>
47 
48 // <reviewed reviewer="Wim Brouw" date="1998/12/09" tests="tTableDesc">
49 // </reviewed>
50 
51 // <use visibility=export>
52 
53 // <prerequisite>
54 // <li> <linkto class=ColumnDesc>ColumnDesc</linkto>
55 // <li> <linkto class=TableDesc>TableDesc</linkto>
56 // <li> <linkto class=TableRecord>TableRecord</linkto>
57 // </prerequisite>
58 
59 // <etymology>
60 // This class builds descriptions of table columns where each cell (which
61 // may also be called a row) will hold a scalar record value.
62 // </etymology>
63 
64 // <synopsis>
65 // ScalarRecordColumnDesc is the class for defining a
66 // table column containing scalar record values. The only record class
67 // supported is <linkto class=TableRecord>TableRecord</linkto>.
68 // <br>
69 // This class is similar to the templated class
70 // <linkto class=ScalarColumnDesc>ScalarColumnDesc</linkto> used
71 // to define column descriptions for scalars with a standard data type.
72 // <p>
73 // The data managers handle a record as an indirect Vector of uChar,
74 // because class
75 // <linkto class=ScalarRecordColumnData>ScalarRecordColumnData</linkto>
76 // converts a record to such a vector before passing it to the data manager.
77 // <p>
78 // This class is derived from
79 // <linkto class=BaseColumnDesc>BaseColumnDesc</linkto>, thus the functions
80 // in there also apply to this class.
81 // <br>
82 // Once a column description is setup satisfactorily, it must be added
83 // to a table description before it can be used by the table system.
84 // </synopsis>
85 
86 // <example>
87 // <srcblock>
88 // TableDesc tabDesc("tTableDesc", "1", TableDesc::New);
89 //
90 // // Add a scalar integer column ac, define keywords for it
91 // // and define a default value 0.
92 // ScalarRecordColumnDesc<Int> acColumn("ac");
93 // acColumn.rwKeywordSet().define ("scale", Complex(0));
94 // acColumn.rwKeywordSet().define ("unit", "");
95 // acColumn.setDefault (0);
96 // tabDesc.addColumn (acColumn);
97 //
98 // // Add another column, now with data type String..
99 // // This can be added directly, because no special things like
100 // // keywords or default values have to be set.
101 // tabDesc.addColumn (ScalarRecordColumnDesc<String>("name", "comments"));
102 // </srcblock>
103 // </example>
104 
105 // <motivation>
106 // This class resembles the templated class
107 // <linkto class=ScalarColumnDesc>ScalarColumnDesc</linkto>
108 // a lot, but is different enough to make that templated class not usable
109 // for records.
110 // <br>In principle it could have been a template specialization,
111 // but not all compilers support specializations so well.
112 // </motivation>
113 
114 // <todo asof="$DATE:$">
115 //# A List of bugs, limitations, extensions or planned refinements.
116 // <li> Introduce a class ArrayRecordColumnDesc to support arrays of records.
117 // </todo>
118 
119 
121 {
122 friend class ColumnDesc;
123 
124 public:
125  // Construct the column with the given name.
126  // The data manager type defaults to the StandardStMan storage manager.
127  // The data manager group defaults to the data manager type.
128  explicit ScalarRecordColumnDesc (const String& name);
129 
130  // Construct the column with the given name and comment.
131  // The data manager type defaults to the StandardStMan storage manager.
132  // The data manager group defaults to the data manager type.
134 
135  // Construct the column with the given name, comment, and
136  // default data manager type and group.
137  // A blank data manager group defaults to the data manager type.
139  const String& dataManName,
140  const String& dataManGroup);
141 
142  // Copy constructor (copy semantics);
144 
146 
147  // Assignment (copy semantics);
149 
150  // Clone this column description.
151  virtual BaseColumnDesc* clone() const;
152 
153  // Get the name of this class. It is used by the registration process.
154  virtual String className() const;
155 
156  // Create a Column object out of this.
157  // This is used by class ColumnSet to construct a table column object.
158  virtual PlainColumn* makeColumn (ColumnSet*) const;
159 
160  // Show the column.
161  virtual void show (ostream& os) const;
162 
163  // Create the object from AipsIO (this function is registered
164  // by ColumnDesc.cc).
165  static BaseColumnDesc* makeDesc (const String& name);
166 
167 private:
168  // Put the object.
169  virtual void putDesc (AipsIO&) const;
170 
171  // Get the object.
172  virtual void getDesc (AipsIO&);
173 };
174 
175 
176 
177 } //# NAMESPACE CASACORE - END
178 
179 #endif
AipsIO is the object persistency mechanism of Casacore.
Definition: AipsIO.h:168
An abstract base class for table column descriptions.
Definition: BaseColDesc.h:107
Envelope class for the description of a table column.
Definition: ColumnDesc.h:131
virtual void getDesc(AipsIO &)
Get the object.
static BaseColumnDesc * makeDesc(const String &name)
Create the object from AipsIO (this function is registered by ColumnDesc.cc).
Class to manage a set of table columns.
Definition: ColumnSet.h:93
const String & comment() const
Get comment string.
Definition: BaseColDesc.h:173
ScalarRecordColumnDesc & operator=(const ScalarRecordColumnDesc &)
Assignment (copy semantics);.
virtual void show(ostream &os) const
Show the column.
virtual String className() const
Get the name of this class.
Class to define columns of scalar records in tables.
Base class for a column in a plain table.
Definition: PlainColumn.h:84
virtual void putDesc(AipsIO &) const
Put the object.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
virtual PlainColumn * makeColumn(ColumnSet *) const
Create a Column object out of this.
const String & name() const
Get the name of the column.
Definition: BaseColDesc.h:138
virtual BaseColumnDesc * clone() const
Clone this column description.
this file contains all the compiler specific defines
Definition: mainpage.dox:28
ScalarRecordColumnDesc(const String &name)
Construct the column with the given name.