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