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