lsst.afw  16.0-60-g0d536d8fc
FitsSchemaInputMapper.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 #ifndef AFW_TABLE_IO_FitsSchemaInputMapper_h_INCLUDED
3 #define AFW_TABLE_IO_FitsSchemaInputMapper_h_INCLUDED
4 
5 #include "lsst/afw/fits.h"
9 
10 namespace lsst {
11 namespace afw {
12 namespace table {
13 namespace io {
14 
16 public:
17  FitsColumnReader() = default;
18 
19  // Neither copyable nor moveable.
20  FitsColumnReader(FitsColumnReader const &) = delete;
22  FitsColumnReader &operator=(FitsColumnReader const &) = delete;
24 
25  virtual void readCell(BaseRecord &record, std::size_t row, fits::Fits &fits,
26  std::shared_ptr<InputArchive> const &archive) const = 0;
27 
28  virtual ~FitsColumnReader() = default;
29 };
30 
35  int column; // column number (0-indexed); -1 for Flag fields
36  int bit; // flag bit number (0-indexed); -1 for non-Flag fields
37  std::string ttype; // name of the field (from TTYPE keys)
38  std::string tform; // FITS column format code (from TFORM keys)
39  std::string tccls; // which field class to use (from our own TCCLS keys)
40  std::string tunit; // field units (from TUNIT keys)
41  std::string doc; // field docs (from comments on TTYPE keys)
42 
43  explicit FitsSchemaItem(int column_, int bit_) : column(column_), bit(bit_) {}
44 };
45 
64 public:
66 
68  FitsSchemaInputMapper(daf::base::PropertyList &metadata, bool stripMetadata);
69 
75 
79  void setArchive(std::shared_ptr<InputArchive> archive);
80 
86  bool readArchive(afw::fits::Fits &fits);
87 
89  bool hasArchive() const;
90 
97  Item const *find(std::string const &ttype) const;
98 
105  Item const *find(int column) const;
106 
111  void erase(Item const *item);
112 
117  void erase(std::string const &ttype);
118 
123  void erase(int column);
124 
128  void customize(std::unique_ptr<FitsColumnReader> reader);
129 
135  Schema finalize();
136 
140  void readRecord(BaseRecord &record, afw::fits::Fits &fits, std::size_t row);
141 
142 private:
143  class Impl;
144  std::shared_ptr<Impl> _impl;
145 };
146 } // namespace io
147 } // namespace table
148 } // namespace afw
149 } // namespace lsst
150 
151 #endif // !AFW_TABLE_IO_FitsSchemaInputMapper_h_INCLUDED
Defines the fields and offsets for a table.
Definition: Schema.h:50
void erase(int column)
A class that describes a mapping from a FITS binary table to an afw::table Schema.
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:296
A structure that describes a field as a collection of related strings read from the FITS header...
Fits * fits
Definition: FitsWriter.cc:90
STL class.
A base class for image defects.
FitsColumnReader & operator=(FitsColumnReader const &)=delete
STL class.
Base class for all records.
Definition: BaseRecord.h:31
virtual void readCell(BaseRecord &record, std::size_t row, fits::Fits &fits, std::shared_ptr< InputArchive > const &archive) const =0