casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CopyRecord.h
Go to the documentation of this file.
1 //# CopyRecord.h: Copy fields from a Record to a table or other record.
2 //# Copyright (C) 1995,1996,1997,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 //#
27 //# $Id$
28 
29 #ifndef FITS_COPYRECORD_H
30 #define FITS_COPYRECORD_H
31 
32 
33 #include <casacore/casa/aips.h>
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 //# Forward Declarations
40 
41 class Table;
42 class TableDesc;
43 class RecordInterface;
44 class RecordDesc;
45 class String;
46 template <class T> class Vector;
47 template <class T> class ScalarColumn;
48 template <class T> class ArrayColumn;
49 
50 // <summary>
51 // Copies fields from a Record to columns of a Table.
52 // </summary>
53 
54 // <use visibility=export>
55 
56 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
57 // </reviewed>
58 
59 // <prerequisite>
60 // <li> Record
61 // <li> Table
62 // </prerequisite>
63 //
64 // <etymology>
65 // </etymology>
66 //
67 // <synopsis>
68 // </synopsis>
69 //
70 // <example>
71 // </example>
72 //
73 // <motivation>
74 // This class should be generalized, and made better. It is the analog of
75 // RowCopier, i.e. it copies all the fields from some Record to certain
76 // columns of a table. The mapping from fields to columns occurs at
77 // construction of the CopyRecordToTable object.
78 // </motivation>
79 
81 {
82 public:
83  // Set the mapping between fields and columns. In particular,
84  // inputMap(fieldNumber) -> columnNumber.
85  CopyRecordToTable(Table &outputTable,
86  const RecordInterface &inputBuffer,
87  const Vector<Int> inputMap);
88 
89  // assignment constructor, reference semantics
91 
93 
94  // assignment operator, reference semantics
96 
97  // Copy from the record (which must still exist) to the given row number
98  // of the table (which must also still exist).
99  void copy(uInt rownr);
100 
101 private:
102  // We could just have a TableColumn for scalars, but we'd need all of
103  // the array types anyway.
122 
141 
142  void clearAll();
143 
144  // Undefined and inaccessible
146 };
147 
148 //#! global functions
149 
150 // This function probably doesn't belong here, but I'm not yet sure where it does belong.
151 // This function adds all the fields in recordDescription to tableDescription, prefixed by "prefix".
152 // If prefix is empty, nothing is prepended
153 // otherwise the string prefix + "_" is prepended to each RecordFieldPtr name in
154 // constructing the TableDesc
155 void addRecordDesc(TableDesc &tableDescription,
156  const RecordDesc &recordDescription,
157  const String &prefix);
158 
159 
160 // <summary>
161 // Copies fields between Records, possibly to fields with another name.
162 // </summary>
163 
164 // <use visibility=export>
165 
166 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
167 // </reviewed>
168 
169 // <prerequisite>
170 // <li> Record
171 // </prerequisite>
172 //
173 // <etymology>
174 // </etymology>
175 //
176 // <synopsis>
177 // </synopsis>
178 //
179 // <example>
180 // </example>
181 //
182 // <motivation>
183 // </motivation>
184 
186 {
187 public:
188  // Set the mapping between fields and columns. In particular,
189  // inputMap(fieldNumber) -> outputFieldNumber.
190  CopyRecordToRecord(RecordInterface &outputBuffer,
191  const RecordInterface &inputBuffer,
192  const Vector<Int> inputMap);
193 
194 
196 
197  // Copy from the record (which must still exist) to the
198  // output record (which must also still exist).
199  void copy();
200 
201 private:
202 
203  // Undefined and inaccessible
207 
226 
245 };
246 
247 
248 } //# NAMESPACE CASACORE - END
249 
250 #endif
251 
252 
Copies fields between Records, possibly to fields with another name.
Definition: CopyRecord.h:185
Block< RORecordFieldPtr< uChar > > record_char
Definition: CopyRecord.h:124
Block< RORecordFieldPtr< DComplex > > record_dcomplex
Definition: CopyRecord.h:130
Block< RORecordFieldPtr< Complex > > in_record_complex
Definition: CopyRecord.h:214
Block< RecordFieldPtr< Array< Int > > > out_record_array_int
Definition: CopyRecord.h:239
Block< RORecordFieldPtr< Float > > in_record_float
Definition: CopyRecord.h:212
PtrBlock< ScalarColumn< Complex > * > table_complex
Definition: CopyRecord.h:110
std::vector< double > Vector
Definition: ds9context.h:24
Block< RORecordFieldPtr< Array< Complex > > > in_record_array_complex
Definition: CopyRecord.h:223
PtrBlock< ScalarColumn< Int > * > table_int
Definition: CopyRecord.h:107
Block< RORecordFieldPtr< Array< uChar > > > record_array_char
Definition: CopyRecord.h:133
Block< RORecordFieldPtr< Short > > in_record_short
Definition: CopyRecord.h:210
Block< RecordFieldPtr< String > > out_record_string
Definition: CopyRecord.h:235
Block< RecordFieldPtr< Float > > out_record_float
Definition: CopyRecord.h:231
Block< RORecordFieldPtr< Complex > > record_complex
Definition: CopyRecord.h:129
Main interface class to a read/write table.
Definition: Table.h:153
Block< RORecordFieldPtr< String > > in_record_string
Definition: CopyRecord.h:216
Block< RORecordFieldPtr< Bool > > record_bool
Definition: CopyRecord.h:123
Block< RecordFieldPtr< Complex > > out_record_complex
Definition: CopyRecord.h:233
Block< RecordFieldPtr< Array< uChar > > > out_record_array_char
Definition: CopyRecord.h:237
Block< RecordFieldPtr< Double > > out_record_double
Definition: CopyRecord.h:232
Block< RecordFieldPtr< Array< String > > > out_record_array_string
Definition: CopyRecord.h:244
Block< RORecordFieldPtr< Array< Int > > > in_record_array_int
Definition: CopyRecord.h:220
PtrBlock< ArrayColumn< Complex > * > table_array_complex
Definition: CopyRecord.h:119
Block< RecordFieldPtr< Array< DComplex > > > out_record_array_dcomplex
Definition: CopyRecord.h:243
Block< RORecordFieldPtr< Array< Double > > > record_array_double
Definition: CopyRecord.h:137
PtrBlock< ScalarColumn< Double > * > table_double
Definition: CopyRecord.h:109
Block< RORecordFieldPtr< Int > > record_int
Definition: CopyRecord.h:126
Block< RORecordFieldPtr< Array< Double > > > in_record_array_double
Definition: CopyRecord.h:222
Block< RecordFieldPtr< Array< Complex > > > out_record_array_complex
Definition: CopyRecord.h:242
Block< RORecordFieldPtr< Array< Short > > > record_array_short
Definition: CopyRecord.h:134
PtrBlock< ArrayColumn< String > * > table_array_string
Definition: CopyRecord.h:121
PtrBlock< ArrayColumn< Short > * > table_array_short
Definition: CopyRecord.h:115
void copy()
Copy from the record (which must still exist) to the output record (which must also still exist)...
PtrBlock< ScalarColumn< Short > * > table_short
Definition: CopyRecord.h:106
void copy(uInt rownr)
Copy from the record (which must still exist) to the given row number of the table (which must also s...
Block< RecordFieldPtr< Array< Short > > > out_record_array_short
Definition: CopyRecord.h:238
Block< RecordFieldPtr< uChar > > out_record_char
Definition: CopyRecord.h:228
Block< RORecordFieldPtr< Array< Float > > > record_array_float
Definition: CopyRecord.h:136
PtrBlock< ArrayColumn< Float > * > table_array_float
Definition: CopyRecord.h:117
Block< RORecordFieldPtr< Array< Short > > > in_record_array_short
Definition: CopyRecord.h:219
Block< RecordFieldPtr< Short > > out_record_short
Definition: CopyRecord.h:229
Block< RORecordFieldPtr< Array< DComplex > > > record_array_dcomplex
Definition: CopyRecord.h:139
Block< RORecordFieldPtr< Float > > record_float
Definition: CopyRecord.h:127
PtrBlock< ScalarColumn< uChar > * > table_char
Definition: CopyRecord.h:105
Description of the fields in a record object.
Definition: RecordDesc.h:105
Block< RecordFieldPtr< Bool > > out_record_bool
Definition: CopyRecord.h:227
Block< RORecordFieldPtr< Array< DComplex > > > in_record_array_dcomplex
Definition: CopyRecord.h:224
void addRecordDesc(TableDesc &tableDescription, const RecordDesc &recordDescription, const String &prefix)
This function probably doesn&#39;t belong here, but I&#39;m not yet sure where it does belong.
CopyRecordToTable & operator=(const CopyRecordToTable &other)
assignment operator, reference semantics
PtrBlock< ArrayColumn< uChar > * > table_array_char
Definition: CopyRecord.h:114
Block< RecordFieldPtr< DComplex > > out_record_dcomplex
Definition: CopyRecord.h:234
Block< RecordFieldPtr< Array< Double > > > out_record_array_double
Definition: CopyRecord.h:241
Block< RORecordFieldPtr< Int > > in_record_int
Definition: CopyRecord.h:211
Block< RORecordFieldPtr< Array< String > > > record_array_string
Definition: CopyRecord.h:140
Block< RORecordFieldPtr< Array< uChar > > > in_record_array_char
Definition: CopyRecord.h:218
CopyRecordToRecord & operator=(const CopyRecordToRecord &)
Block< RORecordFieldPtr< DComplex > > in_record_dcomplex
Definition: CopyRecord.h:215
Block< RORecordFieldPtr< Double > > record_double
Definition: CopyRecord.h:128
PtrBlock< ScalarColumn< DComplex > * > table_dcomplex
Definition: CopyRecord.h:111
A drop-in replacement for Block&lt;T*&gt;.
Definition: WProjectFT.h:54
Block< RORecordFieldPtr< Array< Int > > > record_array_int
Definition: CopyRecord.h:135
PtrBlock< ScalarColumn< Float > * > table_float
Definition: CopyRecord.h:108
Block< RORecordFieldPtr< Array< String > > > in_record_array_string
Definition: CopyRecord.h:225
Block< RORecordFieldPtr< Double > > in_record_double
Definition: CopyRecord.h:213
simple 1-D array
Block< RecordFieldPtr< Array< Bool > > > out_record_array_bool
Definition: CopyRecord.h:236
PtrBlock< ArrayColumn< Double > * > table_array_double
Definition: CopyRecord.h:118
Block< RORecordFieldPtr< Array< Float > > > in_record_array_float
Definition: CopyRecord.h:221
Block< RORecordFieldPtr< uChar > > in_record_char
Definition: CopyRecord.h:209
CopyRecordToTable()
Undefined and inaccessible.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
Define the structure of a Casacore table.
Definition: TableDesc.h:187
PtrBlock< ScalarColumn< Bool > * > table_bool
We could just have a TableColumn for scalars, but we&#39;d need all of the array types anyway...
Definition: CopyRecord.h:104
Block< RORecordFieldPtr< Short > > record_short
Definition: CopyRecord.h:125
Abstract base class for Record classes.
Block< RecordFieldPtr< Array< Float > > > out_record_array_float
Definition: CopyRecord.h:240
PtrBlock< ScalarColumn< String > * > table_string
Definition: CopyRecord.h:112
CopyRecordToRecord()
Undefined and inaccessible.
Block< RORecordFieldPtr< Array< Bool > > > in_record_array_bool
Definition: CopyRecord.h:217
PtrBlock< ArrayColumn< DComplex > * > table_array_dcomplex
Definition: CopyRecord.h:120
PtrBlock< ArrayColumn< Bool > * > table_array_bool
Definition: CopyRecord.h:113
Block< RecordFieldPtr< Int > > out_record_int
Definition: CopyRecord.h:230
Block< RORecordFieldPtr< Array< Complex > > > record_array_complex
Definition: CopyRecord.h:138
Block< RORecordFieldPtr< String > > record_string
Definition: CopyRecord.h:131
PtrBlock< ArrayColumn< Int > * > table_array_int
Definition: CopyRecord.h:116
unsigned int uInt
Definition: aipstype.h:51
Block< RORecordFieldPtr< Array< Bool > > > record_array_bool
Definition: CopyRecord.h:132
Copies fields from a Record to columns of a Table.
Definition: CopyRecord.h:80
Block< RORecordFieldPtr< Bool > > in_record_bool
Definition: CopyRecord.h:208
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42