32 #ifndef PLANCK_FITSHANDLE_H 33 #define PLANCK_FITSHANDLE_H 48 std::string name_, unit_;
56 fitscolumn (
const std::string &nm,
const std::string &un, int64 rc,
PDT tp);
60 const std::string &
name()
const {
return name_;}
62 const std::string &
unit()
const {
return unit_;}
73 enum { INVALID = -4711 };
77 int hdutype_, bitpix_;
78 std::vector<int64> axes_;
79 std::vector<fitscolumn> columns_;
82 void check_errors()
const;
87 bool connected()
const {
return (hdutype_!=INVALID); }
88 bool table_hdu (
tsize col)
const;
89 bool image_hdu ()
const;
96 void read_col (
int colnum,
void *data, int64 ndata,
PDT type,
98 void write_col (
int colnum,
const void *data, int64 ndata,
PDT type,
101 void getKeyHelper(
const std::string &name)
const;
118 void open (
const std::string &fname);
120 void create (
const std::string &fname);
136 const std::string &extname=
"xtension");
141 const std::string &extname=
"xtension");
160 const std::vector<int64> &
axes()
const;
162 const std::string &
colname(
int i)
const;
164 const std::string &
colunit(
int i)
const;
175 int64
nelems(
int i)
const;
187 void get_all_keys (std::vector<std::string> &keys)
const;
189 void set_key_void (
const std::string &key,
const void *value,
PDT type,
190 const std::string &comment=
"");
192 template<
typename T>
void set_key (
const std::string &name,
193 const T &value,
const std::string &comment=
"")
194 { set_key_void (name, &value, planckType<T>(), comment); }
199 void get_key_void (
const std::string &key,
void *value,
PDT type)
const;
201 template<
typename T>
void get_key (
const std::string &name, T &value)
const 202 { get_key_void (name,&value,planckType<T>()); }
204 template<
typename T> T
get_key (
const std::string &name)
const 205 { T tmp;
get_key(name, tmp);
return tmp; }
214 void read_column_raw_void
215 (
int colnum,
void *data,
PDT type, int64 num, int64 offset=0)
const;
219 (
int colnum, T *data, int64 num, int64 offset=0)
const 220 { read_column_raw_void (colnum, data, planckType<T>(), num, offset); }
224 (
int colnum,
arr<T> &data, int64 offset=0)
const 229 (
int colnum, std::vector<T> &data, int64 offset=0)
const 233 (
int colnum, T &data, int64 offset=0)
const 246 (
int colnum, std::vector<T> &data)
const 248 data.resize(safe_cast<tsize>(
nelems(colnum)));
252 void write_column_raw_void
253 (
int colnum,
const void *data,
PDT type, int64 num, int64 offset=0);
257 (
int colnum,
const T *data, int64 num, int64 offset=0)
258 { write_column_raw_void (colnum, data, planckType<T>(), num, offset); }
262 (
int colnum,
const arr<T> &data, int64 offset=0)
267 (
int colnum,
const std::vector<T> &data, int64 offset=0)
271 (
int colnum,
const T &data, int64 offset=0)
287 (
arr2<T> &data,
int xl,
int yl)
const;
288 void read_subimage_void (
void *data,
PDT type,
tsize ndata, int64 offset=0)
295 { read_subimage_void (&data[0],planckType<T>(),data.
size(),offset); }
297 void write_image2D_void (
const void *data,
PDT type,
tsize s1,
303 write_image2D_void (&data[0][0],planckType<T>(),data.
size1(),
307 void write_subimage_void (
const void *data,
PDT type,
tsize sz,
314 { write_subimage_void(&data[0],planckType<T>(),data.
size(),offset); }
void create(const std::string &fname)
int64 nelems(int i) const
void get_key(const std::string &name, T &value) const
void assert_pdmtype(const std::string &pdmtype) const
int64 repcount(int i) const
void open(const std::string &fname)
int64 efficientChunkSize(int i) const
void insert_asctab(const std::vector< fitscolumn > &cols, const std::string &extname="xtension")
void insert_bintab(const std::vector< fitscolumn > &cols, const std::string &extname="xtension")
const std::string & colname(int i) const
T get_key(const std::string &name) const
void read_column_raw(int colnum, T *data, int64 num, int64 offset=0) const
void get_all_keys(std::vector< std::string > &keys) const
void delete_key(const std::string &name)
void write_column(int colnum, const arr< T > &data, int64 offset=0)
void write_image(const arr2< T > &data)
void set_key(const std::string &name, const T &value, const std::string &comment="")
void write_column_raw(int colnum, const T *data, int64 num, int64 offset=0)
std::string fileName() const
const std::string & unit() const
void read_column(int colnum, arr< T > &data, int64 offset=0) const
void read_subimage(arr< T > &data, int64 offset=0) const
void read_image(arr2< T > &data) const
void read_subimage(arr2< T > &data, int xl, int yl) const
void write_subimage(const arr< T > &data, int64 offset=0)
void read_entire_column(int colnum, arr< T > &data) const
void add_comment(const std::string &comment)
bool key_present(const std::string &name) const
const std::string & name() const
const std::vector< int64 > & axes() const
void insert_image(PDT type, const std::vector< int64 > &Axes)
static void delete_file(const std::string &name)
const std::string & colunit(int i) const