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