casacore
Loading...
Searching...
No Matches
RecordFieldWriter.h
Go to the documentation of this file.
1// # RecordFieldWriter.h: Various copiers to move fields between records.
2// # Copyright (C) 1996,2000,2001
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 CASA_RECORDFIELDWRITER_H
27#define CASA_RECORDFIELDWRITER_H
28
29#include <casacore/casa/aips.h>
30#include <casacore/casa/Containers/RecordField.h>
31#include <casacore/casa/Arrays/Array.h>
32
33namespace casacore { // # NAMESPACE CASACORE - BEGIN
34
35// <summary> Record field writer. Base class for the copiers.
36// </summary>
37
38// <use visibility=local>
39
40// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
41// </reviewed>
42
43// <etymology>
44// These classes write values to a field or fields in a record.
45// </etymology>
46//
47// <synopsis>
48// These classes are used in the ms2sdfits conversion code.
49// It might be better if they were moved there.
50// </synopsis>
51//
52// <motivation>
53// It was useful to set up a number of copiers and invoke them as appropriate
54// via a single function call. Some copiers may be more complicate than a
55// direct field to field copy.
56// </motivation>
57//
58// <todo asof="2001/07/10">
59// <li> Either make this generally useful here or move them out of containers
60// <li> fully document this
61// </todo>
62
64 public:
66 virtual void writeField() = 0;
67};
68
69// <summary> Record field copier. Copies field to field as is.
70// </summary>
71
72// <use visibility=local>
73
74// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
75// </reviewed>
76
77// <etymology>
78// Copies a field from a record to another record with a field
79// of the same type.
80// </etymology>
81
82// <motivation>
83// This type of copy can be inlined.
84// </motivation>
85
86template <class outType, class inType>
88 public:
90 const RecordInterface &inRecord, RecordFieldId whichInField);
91 void copy() { *out_p = outType(*in_p); }
92 virtual void writeField();
93
94 private:
97};
98
99// <summary> Unequal shape copier.
100// </summary>
101
102// <use visibility=local>
103
104// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
105// </reviewed>
106
107// <etymology>
108// Copy fields where the two fields fields do not have the same shape,
109// however, the number of elements must match. Copying is done element
110// by element in vector order.
111// </etymology>
112//
113// <motivation>
114// Sometimes the shapes need to change even though the number of elements
115// stays the same.
116// </motivation>
117//
118
119template <class T>
121 public:
123 const RecordInterface &inRecord, RecordFieldId whichInField);
124 virtual void writeField();
125
126 private:
129};
130
131// <summary> Multi field writer. Copy many fields with a single call.
132// </summary>
133
134// <use visibility=local>
135
136// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
137// </reviewed>
138
139// <etymology>
140// This class contains other copiers and copies multiple fields at a time.
141// </etymology>
142//
143// <motivation>
144// It was useful to set up a number of copiers and invoke them as appropriate
145// via a single function call.
146// </motivation>
147//
148
150 public:
152 void copy();
154
155 private:
156 // Make faster by having the RecordFieldCopiers split out so straight copying
157 // is inline.
159};
160
161} // namespace casacore
162
163#ifndef CASACORE_NO_AUTO_TEMPLATES
164#include <casacore/casa/Containers/RecordFieldWriter.tcc>
165#endif // # CASACORE_NO_AUTO_TEMPLATES
166#endif
Block< RecordFieldWriter * > writers_p
Make faster by having the RecordFieldCopiers split out so straight copying is inline.
void addWriter(RecordFieldWriter *fromNew)
Read-Only access to an individual field from a Record.
RORecordFieldPtr< inType > in_p
RecordFieldPtr< outType > out_p
RecordFieldCopier(RecordInterface &outRecord, RecordFieldId whichOutField, const RecordInterface &inRecord, RecordFieldId whichInField)
virtual void writeField()=0
RecordFieldPtr< Array< T > > out_p
UnequalShapeCopier(RecordInterface &outRecord, RecordFieldId whichOutField, const RecordInterface &inRecord, RecordFieldId whichInField)
RORecordFieldPtr< Array< T > > in_p
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
RecordInterface()
The default constructor creates an empty record with a variable structure.