26#ifndef FITS_FITSFIELDCOPIER_H
27#define FITS_FITSFIELDCOPIER_H
29#include <casacore/casa/aips.h>
30#include <casacore/fits/FITS/hdu.h>
31#include <casacore/casa/Containers/RecordField.h>
32#include <casacore/casa/Arrays/Array.h>
33#include <casacore/casa/BasicSL/String.h>
34#include <casacore/fits/FITS/FITSKeywordUtil.h>
117template <
class recordType,
class fitsType>
183 Int minlength = fitslength < reclength ? fitslength : reclength;
184 const char *chars = (**rec_p).c_str();
186 for (i = 0; i < minlength; i++) {
187 (*fits_p)(i) = chars[i];
189 if (i < fitslength) {
242template <
class recordType,
class fitsType>
255 uInt narray = (**rec_p).nelements();
256 uInt nmin = narray < nfits ? narray : nfits;
258 const recordType *rptr = (**rec_p).getStorage(deleteIt);
259 for (
uInt i = 0; i < nmin; i++) {
260 (*fits_p)(i) = rptr[i];
263 for (
uInt i = nmin; i < nfits; i++) {
266 (**rec_p).freeStorage(rptr, deleteIt);
278template <
class recordType,
class fitsType>
292 uInt narray = (**rec_p).nelements();
293 uInt nmin = narray < nfits ? narray : nfits;
295 const recordType *rptr = (**rec_p).getStorage(deleteIt);
296 for (
uInt i = 0; i < nmin; i++) {
297 (*fits_p)(i) = rptr[i];
299 for (
uInt i = nmin; i < nfits; i++) {
302 (**rec_p).freeStorage(rptr, deleteIt);
308 Int reclength = thisTDIR.length();
309 Int minlength = fitslength < reclength ? fitslength : reclength;
310 const char *chars = thisTDIR.c_str();
312 for (i = 0; i < minlength; i++) {
313 (*tdir_p)(i) = chars[i];
315 for (
Int i = minlength; i < fitslength; i++) {
ArrayFITSFieldCopier & operator=(const ArrayFITSFieldCopier< recordType, fitsType > &other)
ArrayFITSFieldCopier(const ArrayFITSFieldCopier< recordType, fitsType > &other)
Undefined and inaccessible.
virtual void copyToFITS()
Copy the current contents of the input RORecordFieldPtr to the output FitsField.
ArrayFITSFieldCopier(RORecordFieldPtr< Array< recordType > > *recptr, FitsField< fitsType > *fitsptr)
FitsField< fitsType > * fits_p
RORecordFieldPtr< Array< recordType > > * rec_p
virtual ~FITSFieldCopier()
destructor
virtual void copyToFITS()=0
the things which does the work - to be implemented in each derived class
static Bool toTDIM(String &tdim, const IPosition &shape)
Convert an IPosition to a String appropriate for use as the value of a TDIMnnn keyword.
helper class Note: Note that FitsField does not allocate space for the data; Space is external to Fi...
Read-Only access to an individual field from a Record.
FitsField< fitsType > * fits_p
ScalarFITSFieldCopier & operator=(const ScalarFITSFieldCopier< recordType, fitsType > &other)
virtual void copyToFITS()
Copy the current contents of the input RORecordFieldPtr to the output FitsField.
ScalarFITSFieldCopier(const ScalarFITSFieldCopier< recordType, fitsType > &other)
RORecordFieldPtr< recordType > * rec_p
ScalarFITSFieldCopier(RORecordFieldPtr< recordType > *recptr, FitsField< fitsType > *fitsptr)
FitsField< char > * fits_p
StringFITSFieldCopier(const StringFITSFieldCopier &other)
Undefined and inaccessible.
virtual void copyToFITS()
Copy the current contents of the input RORecordFieldPtr to the output FitsField.
StringFITSFieldCopier & operator=(const StringFITSFieldCopier &other)
RORecordFieldPtr< String > * rec_p
StringFITSFieldCopier(RORecordFieldPtr< String > *rptr, FitsField< char > *fptr)
String: the storage and methods of handling collections of characters.
FitsField< char > * tdir_p
virtual void copyToFITS()
Copy the current contents of the input RORecordFieldPtr to the output FitsField.
VariableArrayFITSFieldCopier(RORecordFieldPtr< Array< recordType > > *recptr, FitsField< fitsType > *fitsptr, FitsField< char > *tdirptr)
VariableArrayFITSFieldCopier & operator=(const VariableArrayFITSFieldCopier< recordType, fitsType > &other)
FitsField< fitsType > * fits_p
~VariableArrayFITSFieldCopier()
VariableArrayFITSFieldCopier(const VariableArrayFITSFieldCopier< recordType, fitsType > &other)
Undefined and inaccessible.
RORecordFieldPtr< Array< recordType > > * rec_p
For temporary backward namespace compatibility, use casa as alias for casacore.
RecordType & recordType()
Give access to the RecordType flag (write-access is needed when a record is read back).
LatticeExprNode length(const LatticeExprNode &expr, const LatticeExprNode &axis)
2-argument function to get the length of an axis.
bool Bool
Define the standard types used by Casacore.