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>
188 Int minlength = fitslength < reclength ? fitslength : reclength;
189 const char *chars = (**rec_p).chars();
191 for (i=0; i<minlength; i++) {
192 (*fits_p)(i) = chars[i];
194 if (i < fitslength) {
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++) {
264 (*fits_p)(i) = recordType(0);
266 (**rec_p).freeStorage(rptr, deleteIt);
291 uInt narray = (**rec_p).nelements();
292 uInt nmin = narray < nfits ? narray : nfits;
294 const recordType *rptr = (**rec_p).getStorage(deleteIt);
295 for (
uInt i=0; i<nmin; i++) {
296 (*fits_p)(i) = rptr[i];
298 for (
uInt i=nmin;i<nfits;i++) {
299 (*fits_p)(i) = recordType(0);
301 (**rec_p).freeStorage(rptr, deleteIt);
308 Int minlength = fitslength < reclength ? fitslength : reclength;
309 const char *chars = thisTDIR.
chars();
311 for (i=0; i<minlength; i++) {
312 (*tdir_p)(i) = chars[i];
314 for (
Int i=minlength; i<fitslength; i++) {
A FITSFieldCopier for copying Array RecordFields to FitsFields.
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.
unsigned int nelements() const
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.
A FITSFieldCopier for copying scalar non-string RecordFields to FitsFields.
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)
A FITSFieldCopier for copying String RecordFields to FitsFields.
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.
const Char * chars() const
** Casacore synonym
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
this file contains all the compiler specific defines
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.