lsst.afw
g3a5ebb7d8a+28b83bf6a5
Toggle main menu visibility
Loading...
Searching...
No Matches
include
lsst
afw
table
io
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
"
6
#include "
lsst/afw/table/Schema.h
"
7
#include "
lsst/afw/table/io/InputArchive.h
"
8
#include "
lsst/afw/table/BaseRecord.h
"
9
#include "
lsst/afw/table/BaseColumnView.h
"
10
11
namespace
lsst
{
12
namespace
afw
{
13
namespace
table
{
14
namespace
io
{
15
20
class
FitsColumnReader
{
21
public
:
22
FitsColumnReader
() noexcept = default;
23
24
// Neither copyable nor moveable.
25
FitsColumnReader
(
FitsColumnReader
const &) = delete;
26
FitsColumnReader
(
FitsColumnReader
&&) = delete;
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
62
struct
FitsSchemaItem
{
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
91
class
FitsSchemaInputMapper
{
92
public
:
93
using
Item
=
FitsSchemaItem
;
94
107
static
std::size_t
PREPPED_ROWS_FACTOR
;
108
110
FitsSchemaInputMapper
(
daf::base::PropertyList
&metadata,
bool
stripMetadata);
111
112
FitsSchemaInputMapper
(
FitsSchemaInputMapper
const
&);
113
FitsSchemaInputMapper
(
FitsSchemaInputMapper
&&);
114
FitsSchemaInputMapper
&
operator=
(
FitsSchemaInputMapper
const
&);
115
FitsSchemaInputMapper
&
operator=
(
FitsSchemaInputMapper
&&);
116
~FitsSchemaInputMapper
();
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
BaseColumnView.h
BaseRecord.h
InputArchive.h
Schema.h
std::string
lsst::afw::fits::Fits
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition
fits.h:242
lsst::afw::table::BaseRecord
Base class for all records.
Definition
BaseRecord.h:31
lsst::afw::table::Schema
Defines the fields and offsets for a table.
Definition
Schema.h:51
lsst::afw::table::io::FitsColumnReader::FitsColumnReader
FitsColumnReader() noexcept=default
lsst::afw::table::io::FitsColumnReader::~FitsColumnReader
virtual ~FitsColumnReader() noexcept=default
lsst::afw::table::io::FitsColumnReader::readCell
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.
lsst::afw::table::io::FitsColumnReader::prepRead
virtual void prepRead(std::size_t firstRow, std::size_t nRows, fits::Fits &fits)
Optionally read ahead and cache values from multiple rows.
Definition
FitsSchemaInputMapper.h:42
lsst::afw::table::io::FitsSchemaInputMapper::Impl
Definition
FitsSchemaInputMapper.cc:45
lsst::afw::table::io::FitsSchemaInputMapper::operator=
FitsSchemaInputMapper & operator=(FitsSchemaInputMapper const &)
lsst::afw::table::io::FitsSchemaInputMapper::FitsSchemaInputMapper
FitsSchemaInputMapper(FitsSchemaInputMapper const &)
lsst::afw::table::io::FitsSchemaInputMapper::PREPPED_ROWS_FACTOR
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...
Definition
FitsSchemaInputMapper.h:107
lsst::afw::table::io::FitsSchemaInputMapper::readArchive
bool readArchive(afw::fits::Fits &fits)
Set the Archive by reading from the HDU specified by the AR_HDU header entry.
Definition
FitsSchemaInputMapper.cc:297
lsst::afw::table::io::FitsSchemaInputMapper::finalize
Schema finalize()
Map any remaining items into regular Schema items, and return the final Schema.
Definition
FitsSchemaInputMapper.cc:771
lsst::afw::table::io::FitsSchemaInputMapper::operator=
FitsSchemaInputMapper & operator=(FitsSchemaInputMapper &&)
lsst::afw::table::io::FitsSchemaInputMapper::FitsSchemaInputMapper
FitsSchemaInputMapper(FitsSchemaInputMapper &&)
lsst::afw::table::io::FitsSchemaInputMapper::~FitsSchemaInputMapper
~FitsSchemaInputMapper()
lsst::afw::table::io::FitsSchemaInputMapper::customize
void customize(std::unique_ptr< FitsColumnReader > reader)
Customize a mapping by providing a FitsColumnReader instance that will be invoked by readRecords().
Definition
FitsSchemaInputMapper.cc:353
lsst::afw::table::io::FitsSchemaInputMapper::readRecord
void readRecord(BaseRecord &record, afw::fits::Fits &fits, std::size_t row)
Fill a record from a FITS binary table row.
Definition
FitsSchemaInputMapper.cc:869
lsst::afw::table::io::FitsSchemaInputMapper::FitsSchemaInputMapper
FitsSchemaInputMapper(daf::base::PropertyList &metadata, bool stripMetadata)
Construct a mapper from a PropertyList of FITS header values, stripping recognized keys if desired.
Definition
FitsSchemaInputMapper.cc:89
lsst::afw::table::io::FitsSchemaInputMapper::erase
void erase(Item const *item)
Remove the given item (which should have been retrieved via find()) from the mapping,...
Definition
FitsSchemaInputMapper.cc:331
lsst::afw::table::io::FitsSchemaInputMapper::Item
FitsSchemaItem Item
Definition
FitsSchemaInputMapper.h:93
lsst::afw::table::io::FitsSchemaInputMapper::hasArchive
bool hasArchive() const
Return true if the mapper has an InputArchive.
Definition
FitsSchemaInputMapper.cc:313
lsst::afw::table::io::FitsSchemaInputMapper::find
Item const * find(std::string const &ttype) const
Find an item with the given column name (ttype), returning nullptr if no such column exists.
Definition
FitsSchemaInputMapper.cc:315
lsst::afw::table::io::FitsSchemaInputMapper::setArchive
void setArchive(std::shared_ptr< InputArchive > archive)
Set the Archive to an externally-provided one, overriding any that may have been read.
Definition
FitsSchemaInputMapper.cc:295
lsst::daf::base::PropertyList
fits.h
lsst::afw::fits
Definition
fits.h:32
lsst::afw::table::io
Definition
tablePersistence.dox:3
lsst::afw::table
Definition
table.dox:3
lsst::afw
Definition
imageAlgorithm.dox:1
lsst
std
STL namespace.
std::shared_ptr
std::size_t
lsst::afw::table::io::FitsSchemaItem
A structure that describes a field as a collection of related strings read from the FITS header.
Definition
FitsSchemaInputMapper.h:62
lsst::afw::table::io::FitsSchemaItem::ttype
std::string ttype
Definition
FitsSchemaInputMapper.h:65
lsst::afw::table::io::FitsSchemaItem::tccls
std::string tccls
Definition
FitsSchemaInputMapper.h:67
lsst::afw::table::io::FitsSchemaItem::bit
int bit
Definition
FitsSchemaInputMapper.h:64
lsst::afw::table::io::FitsSchemaItem::tform
std::string tform
Definition
FitsSchemaInputMapper.h:66
lsst::afw::table::io::FitsSchemaItem::column
int column
Definition
FitsSchemaInputMapper.h:63
lsst::afw::table::io::FitsSchemaItem::FitsSchemaItem
FitsSchemaItem(int column_, int bit_)
Definition
FitsSchemaInputMapper.h:71
lsst::afw::table::io::FitsSchemaItem::tunit
std::string tunit
Definition
FitsSchemaInputMapper.h:68
lsst::afw::table::io::FitsSchemaItem::doc
std::string doc
Definition
FitsSchemaInputMapper.h:69
std::unique_ptr
Generated on
for lsst.afw by
1.17.0