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{
65public:
67 virtual void writeField() = 0;
68};
69
70// <summary> Record field copier. Copies field to field as is.
71// </summary>
72
73// <use visibility=local>
74
75// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
76// </reviewed>
77
78// <etymology>
79// Copies a field from a record to another record with a field
80// of the same type.
81// </etymology>
82
83// <motivation>
84// This type of copy can be inlined.
85// </motivation>
86
87template<class outType, class inType>
89{
90public:
92 RecordFieldId whichOutField,
93 const RecordInterface &inRecord,
94 RecordFieldId whichInField);
95 void copy() {*out_p = outType(*in_p);}
96 virtual void writeField();
97private:
100};
101
102// <summary> Unequal shape copier.
103// </summary>
104
105// <use visibility=local>
106
107// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
108// </reviewed>
109
110// <etymology>
111// Copy fields where the two fields fields do not have the same shape,
112// however, the number of elements must match. Copying is done element
113// by element in vector order.
114// </etymology>
115//
116// <motivation>
117// Sometimes the shapes need to change even though the number of elements
118// stays the same.
119// </motivation>
120//
121
122template<class T> class UnequalShapeCopier : public RecordFieldWriter
123{
124public:
126 RecordFieldId whichOutField,
127 const RecordInterface &inRecord,
128 RecordFieldId whichInField);
129 virtual void writeField();
130private:
133};
134
135// <summary> Multi field writer. Copy many fields with a single call.
136// </summary>
137
138// <use visibility=local>
139
140// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
141// </reviewed>
142
143// <etymology>
144// This class contains other copiers and copies multiple fields at a time.
145// </etymology>
146//
147// <motivation>
148// It was useful to set up a number of copiers and invoke them as appropriate
149// via a single function call.
150// </motivation>
151//
152
154{
155public:
157 void copy();
159private:
160 // Make faster by having the RecordFieldCopiers split out so straight copying
161 // is inline.
163};
164
165
166} //# NAMESPACE CASACORE - END
167
168#ifndef CASACORE_NO_AUTO_TEMPLATES
169#include <casacore/casa/Containers/RecordFieldWriter.tcc>
170#endif //# CASACORE_NO_AUTO_TEMPLATES
171#endif
PtrBlock< RecordFieldWriter * > writers_p
Make faster by having the RecordFieldCopiers split out so straight copying is inline.
void addWriter(RecordFieldWriter *fromNew)
A drop-in replacement for Block<T*>.
Definition Block.h:812
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
this file contains all the compiler specific defines
Definition mainpage.dox:28