LSST Applications  21.0.0+04719a4bac,21.0.0-1-ga51b5d4+f5e6047307,21.0.0-11-g2b59f77+a9c1acf22d,21.0.0-11-ga42c5b2+86977b0b17,21.0.0-12-gf4ce030+76814010d2,21.0.0-13-g1721dae+760e7a6536,21.0.0-13-g3a573fe+768d78a30a,21.0.0-15-g5a7caf0+f21cbc5713,21.0.0-16-g0fb55c1+b60e2d390c,21.0.0-19-g4cded4ca+71a93a33c0,21.0.0-2-g103fe59+bb20972958,21.0.0-2-g45278ab+04719a4bac,21.0.0-2-g5242d73+3ad5d60fb1,21.0.0-2-g7f82c8f+8babb168e8,21.0.0-2-g8f08a60+06509c8b61,21.0.0-2-g8faa9b5+616205b9df,21.0.0-2-ga326454+8babb168e8,21.0.0-2-gde069b7+5e4aea9c2f,21.0.0-2-gecfae73+1d3a86e577,21.0.0-2-gfc62afb+3ad5d60fb1,21.0.0-25-g1d57be3cd+e73869a214,21.0.0-3-g357aad2+ed88757d29,21.0.0-3-g4a4ce7f+3ad5d60fb1,21.0.0-3-g4be5c26+3ad5d60fb1,21.0.0-3-g65f322c+e0b24896a3,21.0.0-3-g7d9da8d+616205b9df,21.0.0-3-ge02ed75+a9c1acf22d,21.0.0-4-g591bb35+a9c1acf22d,21.0.0-4-g65b4814+b60e2d390c,21.0.0-4-gccdca77+0de219a2bc,21.0.0-4-ge8a399c+6c55c39e83,21.0.0-5-gd00fb1e+05fce91b99,21.0.0-6-gc675373+3ad5d60fb1,21.0.0-64-g1122c245+4fb2b8f86e,21.0.0-7-g04766d7+cd19d05db2,21.0.0-7-gdf92d54+04719a4bac,21.0.0-8-g5674e7b+d1bd76f71f,master-gac4afde19b+a9c1acf22d,w.2021.13
LSST Data Management Base Package
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"
10 
11 namespace lsst {
12 namespace afw {
13 namespace table {
14 namespace io {
15 
21 public:
22  FitsColumnReader() noexcept = default;
23 
24  // Neither copyable nor moveable.
27  FitsColumnReader &operator=(FitsColumnReader const &) = delete;
28  FitsColumnReader &operator=(FitsColumnReader &&) = delete;
29 
42  virtual void prepRead(std::size_t firstRow, std::size_t nRows, fits::Fits & fits) {}
43 
53  virtual void readCell(BaseRecord &record, std::size_t row, fits::Fits &fits,
54  std::shared_ptr<InputArchive> const &archive) const = 0;
55 
56  virtual ~FitsColumnReader() noexcept = default;
57 };
58 
63  int column; // column number (0-indexed); -1 for Flag fields
64  int bit; // flag bit number (0-indexed); -1 for non-Flag fields
65  std::string ttype; // name of the field (from TTYPE keys)
66  std::string tform; // FITS column format code (from TFORM keys)
67  std::string tccls; // which field class to use (from our own TCCLS keys)
68  std::string tunit; // field units (from TUNIT keys)
69  std::string doc; // field docs (from comments on TTYPE keys)
70 
71  explicit FitsSchemaItem(int column_, int bit_) : column(column_), bit(bit_) {}
72 };
73 
92 public:
94 
108 
110  FitsSchemaInputMapper(daf::base::PropertyList &metadata, bool stripMetadata);
111 
117 
121  void setArchive(std::shared_ptr<InputArchive> archive);
122 
128  bool readArchive(afw::fits::Fits &fits);
129 
131  bool hasArchive() const;
132 
139  Item const *find(std::string const &ttype) const;
140 
147  Item const *find(int column) const;
148 
153  void erase(Item const *item);
154 
159  void erase(std::string const &ttype);
160 
165  void erase(int column);
166 
170  void customize(std::unique_ptr<FitsColumnReader> reader);
171 
177  Schema finalize();
178 
182  void readRecord(BaseRecord &record, afw::fits::Fits &fits, std::size_t row);
183 
184 private:
185  class Impl;
186  std::shared_ptr<Impl> _impl;
187 };
188 } // namespace io
189 } // namespace table
190 } // namespace afw
191 } // namespace lsst
192 
193 #endif // !AFW_TABLE_IO_FitsSchemaInputMapper_h_INCLUDED
Fits * fits
Definition: FitsWriter.cc:90
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:297
Base class for all records.
Definition: BaseRecord.h:31
Defines the fields and offsets for a table.
Definition: Schema.h:50
Polymorphic reader interface used to read different kinds of objects from one or more FITS binary tab...
virtual ~FitsColumnReader() noexcept=default
virtual void readCell(BaseRecord &record, std::size_t row, fits::Fits &fits, std::shared_ptr< InputArchive > const &archive) const =0
Read values from a single row.
virtual void prepRead(std::size_t firstRow, std::size_t nRows, fits::Fits &fits)
Optionally read ahead and cache values from multiple rows.
A class that describes a mapping from a FITS binary table to an afw::table Schema.
FitsSchemaInputMapper & operator=(FitsSchemaInputMapper const &)
FitsSchemaInputMapper(FitsSchemaInputMapper const &)
static std::size_t PREPPED_ROWS_FACTOR
When processing each column, divide this number by the record size (in bytes) and ask CFITSIO to read...
FitsSchemaInputMapper & operator=(FitsSchemaInputMapper &&)
FitsSchemaInputMapper(FitsSchemaInputMapper &&)
Class for storing ordered metadata with comments.
Definition: PropertyList.h:68
void erase(int column)
A base class for image defects.
STL namespace.
int row
Definition: CR.cc:145
A structure that describes a field as a collection of related strings read from the FITS header.