LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
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 { namespace afw { namespace table { namespace io {
11 
13 public:
14 
16 
17  // Neither copyable nor moveable.
18  FitsColumnReader(FitsColumnReader const &) = delete;
20  FitsColumnReader & operator=(FitsColumnReader const &) = delete;
22 
23  virtual void readCell(
24  BaseRecord & record,
25  std::size_t row,
26  fits::Fits & fits,
27  PTR(InputArchive) const & archive
28  ) const = 0;
29 
30  virtual ~FitsColumnReader() {}
31 
32 };
33 
38  int column; // column number (0-indexed); -1 for Flag fields
39  int bit; // flag bit number (0-indexed); -1 for non-Flag fields
40  std::string ttype; // name of the field (from TTYPE keys)
41  std::string tform; // FITS column format code (from TFORM keys)
42  std::string tccls; // which field class to use (from our own TCCLS keys)
43  std::string tunit; // field units (from TUNIT keys)
44  std::string doc; // field docs (from comments on TTYPE keys)
45 
46  explicit FitsSchemaItem(int column_, int bit_) : column(column_), bit(bit_) {}
47 };
48 
49 
68 public:
69 
71 
73  FitsSchemaInputMapper(daf::base::PropertyList & metadata, bool stripMetadata);
74 
78  void setArchive(PTR(InputArchive) archive);
79 
85  bool readArchive(afw::fits::Fits & fits);
86 
88  bool hasArchive() const;
89 
96  Item const * find(std::string const & ttype) const;
97 
104  Item const * find(int column) const;
105 
110  void erase(Item const * item);
111 
116  void erase(std::string const & ttype);
117 
122  void erase(int column);
123 
127  void customize(std::unique_ptr<FitsColumnReader> reader);
128 
134  Schema finalize();
135 
139  void readRecord(
140  BaseRecord & record,
141  afw::fits::Fits & fits,
142  std::size_t row
143  );
144 
145 private:
146  class Impl;
147  PTR(Impl) _impl;
148 };
149 
150 }}}} // namespace lsst::afw::table::io
151 
152 #endif // !AFW_TABLE_IO_FitsSchemaInputMapper_h_INCLUDED
Defines the fields and offsets for a table.
Definition: Schema.h:46
#define PTR(...)
Definition: base.h:41
Class for storing ordered metadata with comments.
Definition: PropertyList.h:81
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:194
void setArchive(boost::shared_ptr< InputArchive > archive)
bool readArchive(afw::fits::Fits &fits)
FitsColumnReader & operator=(FitsColumnReader const &)=delete
Item const * find(std::string const &ttype) const
void customize(std::unique_ptr< FitsColumnReader > reader)
int row
Definition: CR.cc:153
Base class for all records.
Definition: BaseRecord.h:27
virtual void readCell(BaseRecord &record, std::size_t row, fits::Fits &fits, boost::shared_ptr< InputArchive > const &archive) const =0
FitsSchemaInputMapper(daf::base::PropertyList &metadata, bool stripMetadata)
Construct a mapper from a PropertyList of FITS header values, stripping recognized keys if desired...
bool hasArchive() const
Return true if the mapper has an InputArchive.
A multi-catalog archive object used to load table::io::Persistable objects.
Definition: InputArchive.h:28
void readRecord(BaseRecord &record, afw::fits::Fits &fits, std::size_t row)