29 #ifndef FITS_FITSFIELDCOPIER_H 30 #define FITS_FITSFIELDCOPIER_H 32 #include <casacore/casa/aips.h> 33 #include <casacore/fits/FITS/hdu.h> 34 #include <casacore/casa/Containers/RecordField.h> 35 #include <casacore/casa/Arrays/Array.h> 36 #include <casacore/casa/BasicSL/String.h> 37 #include <casacore/fits/FITS/FITSKeywordUtil.h> 129 : rec_p(recptr), fits_p(fitsptr) {}
189 Int fitslength = fits_p->nelements();
191 Int minlength = fitslength < reclength ? fitslength : reclength;
192 const char *chars = (**rec_p).chars();
194 for (i=0; i<minlength; i++) {
195 (*fits_p)(i) = chars[i];
197 if (i < fitslength) {
257 uInt nfits = fits_p->nelements();
258 uInt narray = (**rec_p).nelements();
259 uInt nmin = narray < nfits ? narray : nfits;
261 const recordType *rptr = (**rec_p).getStorage(deleteIt);
262 for (
uInt i=0; i<nmin; i++) {
263 (*fits_p)(i) = rptr[i];
266 for (
uInt i=nmin;i<nfits;i++) {
267 (*fits_p)(i) = recordType(0);
269 (**rec_p).freeStorage(rptr, deleteIt);
288 : rec_p(recptr), fits_p(fitsptr), tdir_p(tdirptr) {}
293 uInt nfits = fits_p->nelements();
294 uInt narray = (**rec_p).nelements();
295 uInt nmin = narray < nfits ? narray : nfits;
297 const recordType *rptr = (**rec_p).getStorage(deleteIt);
298 for (
uInt i=0; i<nmin; i++) {
299 (*fits_p)(i) = rptr[i];
301 for (
uInt i=nmin;i<nfits;i++) {
302 (*fits_p)(i) = recordType(0);
304 (**rec_p).freeStorage(rptr, deleteIt);
309 Int fitslength = tdir_p->nelements();
311 Int minlength = fitslength < reclength ? fitslength : reclength;
312 const char *chars = thisTDIR.
chars();
314 for (i=0; i<minlength; i++) {
315 (*tdir_p)(i) = chars[i];
317 for (
Int i=minlength; i<fitslength; i++) {
FitsField< fitsType > * fits_p
ScalarFITSFieldCopier(RORecordFieldPtr< recordType > *recptr, FitsField< fitsType > *fitsptr)
~VariableArrayFITSFieldCopier()
virtual void copyToFITS()
Copy the current contents of the input RORecordFieldPtr to the output FitsField.
PtrHolder< T > & operator=(const PtrHolder< T > &other)
StringFITSFieldCopier(RORecordFieldPtr< String > *rptr, FitsField< char > *fptr)
RORecordFieldPtr< Array< recordType > > * rec_p
FitsField< fitsType > * fits_p
FitsField< char > * fits_p
RORecordFieldPtr< recordType > * rec_p
LatticeExprNode length(const LatticeExprNode &expr, const LatticeExprNode &axis)
2-argument function to get the length of an axis.
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.
FitsField< fitsType > * fits_p
bool Bool
Define the standard types used by Casacore.
virtual void copyToFITS()
Copy the current contents of the input RORecordFieldPtr to the output FitsField.
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)
ArrayFITSFieldCopier(RORecordFieldPtr< Array< recordType > > *recptr, FitsField< fitsType > *fitsptr)
A FITSFieldCopier for copying Array RecordFields to FitsFields.
virtual void copyToFITS()=0
the things which does the work - to be implemented in each derived class
RORecordFieldPtr< Array< recordType > > * rec_p
A FITSFieldCopier for copying scalar non-string RecordFields to FitsFields.
String: the storage and methods of handling collections of characters.
static Bool toTDIM(String &tdim, const IPosition &shape)
Convert an IPosition to a String appropriate for use as the value of a TDIMnnn keyword.
A FITSFieldCopier for copying String RecordFields to FitsFields.
virtual ~FITSFieldCopier()
destructor
this file contains all the compiler specific defines
RORecordFieldPtr< String > * rec_p
Virtual base class for copying RORecordFields to FitsFields.