Loading [MathJax]/extensions/tex2jax.js
LSST Applications g0fba68d861+05816baf74,g1ec0fe41b4+f536777771,g1fd858c14a+a9301854fb,g35bb328faa+fcb1d3bbc8,g4af146b050+a5c07d5b1d,g4d2262a081+6e5fcc2a4e,g53246c7159+fcb1d3bbc8,g56a49b3a55+9c12191793,g5a012ec0e7+3632fc3ff3,g60b5630c4e+ded28b650d,g67b6fd64d1+ed4b5058f4,g78460c75b0+2f9a1b4bcd,g786e29fd12+cf7ec2a62a,g8352419a5c+fcb1d3bbc8,g87b7deb4dc+7b42cf88bf,g8852436030+e5453db6e6,g89139ef638+ed4b5058f4,g8e3bb8577d+d38d73bdbd,g9125e01d80+fcb1d3bbc8,g94187f82dc+ded28b650d,g989de1cb63+ed4b5058f4,g9d31334357+ded28b650d,g9f33ca652e+50a8019d8c,gabe3b4be73+1e0a283bba,gabf8522325+fa80ff7197,gb1101e3267+d9fb1f8026,gb58c049af0+f03b321e39,gb665e3612d+2a0c9e9e84,gb89ab40317+ed4b5058f4,gcf25f946ba+e5453db6e6,gd6cbbdb0b4+bb83cc51f8,gdd1046aedd+ded28b650d,gde0f65d7ad+941d412827,ge278dab8ac+d65b3c2b70,ge410e46f29+ed4b5058f4,gf23fb2af72+b7cae620c0,gf5e32f922b+fcb1d3bbc8,gf67bdafdda+ed4b5058f4,w.2025.16
LSST Data Management Base Package
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
11namespace lsst {
12namespace afw {
13namespace table {
14namespace io {
15
21public:
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
92public:
94
108
110 FitsSchemaInputMapper(daf::base::PropertyList &metadata, bool stripMetadata);
111
117
122
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
171
178
183
184private:
185 class Impl;
187};
188} // namespace io
189} // namespace table
190} // namespace afw
191} // namespace lsst
192
193#endif // !AFW_TABLE_IO_FitsSchemaInputMapper_h_INCLUDED
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition fits.h:308
Base class for all records.
Definition BaseRecord.h:31
Defines the fields and offsets for a table.
Definition Schema.h:51
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.
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...
bool readArchive(afw::fits::Fits &fits)
Set the Archive by reading from the HDU specified by the AR_HDU header entry.
Schema finalize()
Map any remaining items into regular Schema items, and return the final Schema.
FitsSchemaInputMapper & operator=(FitsSchemaInputMapper &&)
FitsSchemaInputMapper(FitsSchemaInputMapper &&)
void customize(std::unique_ptr< FitsColumnReader > reader)
Customize a mapping by providing a FitsColumnReader instance that will be invoked by readRecords().
void readRecord(BaseRecord &record, afw::fits::Fits &fits, std::size_t row)
Fill a record from a FITS binary table row.
FitsSchemaInputMapper(daf::base::PropertyList &metadata, bool stripMetadata)
Construct a mapper from a PropertyList of FITS header values, stripping recognized keys if desired.
void erase(Item const *item)
Remove the given item (which should have been retrieved via find()) from the mapping,...
bool hasArchive() const
Return true if the mapper has an InputArchive.
Item const * find(std::string const &ttype) const
Find an item with the given column name (ttype), returning nullptr if no such column exists.
void setArchive(std::shared_ptr< InputArchive > archive)
Set the Archive to an externally-provided one, overriding any that may have been read.
Class for storing ordered metadata with comments.
STL namespace.
A structure that describes a field as a collection of related strings read from the FITS header.