2 #ifndef AFW_TABLE_IO_FitsReader_h_INCLUDED 3 #define AFW_TABLE_IO_FitsReader_h_INCLUDED 43 explicit FitsReader(std::string
const& persistedClassName);
65 template <
typename ContainerT>
67 std::shared_ptr<InputArchive> archive = std::shared_ptr<InputArchive>()) {
68 std::shared_ptr<daf::base::PropertyList> metadata = std::make_shared<daf::base::PropertyList>();
70 FitsReader const* reader = _lookupFitsReader(*metadata);
72 reader->_setupArchive(fits, mapper, archive, ioFlags);
73 std::shared_ptr<BaseTable> table = reader->
makeTable(mapper, metadata, ioFlags,
true);
74 ContainerT container(std::dynamic_pointer_cast<typename ContainerT::Table>(table));
75 if (!container.getTable()) {
76 throw LSST_EXCEPT(pex::exceptions::RuntimeError,
"Invalid table class for catalog.");
79 container.reserve(nRows);
80 for (std::size_t row = 0; row < nRows; ++row) {
85 const_cast<typename std::remove_const<typename ContainerT::Record>::type&
>(
98 template <
typename ContainerT,
typename SourceT>
99 static ContainerT
apply(SourceT& source,
int hdu,
int ioFlags,
100 std::shared_ptr<InputArchive> archive = std::shared_ptr<InputArchive>()) {
103 return apply<ContainerT>(fits, ioFlags, archive);
126 std::shared_ptr<daf::base::PropertyList> metadata,
127 int ioFlags,
bool stripMetadata)
const;
141 std::shared_ptr<InputArchive> archive,
int ioFlags)
const;
148 #endif // !AFW_TABLE_IO_FitsReader_h_INCLUDED std::size_t countRows()
Return the number of row in a table.
static ContainerT apply(SourceT &source, int hdu, int ioFlags, std::shared_ptr< InputArchive > archive=std::shared_ptr< InputArchive >())
Create a new Catalog by reading a FITS file.
A utility class for reading FITS binary tables.
FitsReader(std::string const &persistedClassName)
Construct a FitsReader, registering it to be used for all persisted tables with the given tag...
lsst::daf::base::PropertyList PropertyList
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
virtual std::shared_ptr< BaseTable > makeTable(FitsSchemaInputMapper &mapper, std::shared_ptr< daf::base::PropertyList > metadata, int ioFlags, bool stripMetadata) const
Callback to create a Table object from a FITS binary table schema.
A base class for image defects.
void setHdu(int hdu, bool relative=false)
Set the current HDU.
static ContainerT apply(afw::fits::Fits &fits, int ioFlags, std::shared_ptr< InputArchive > archive=std::shared_ptr< InputArchive >())
Create a new Catalog by reading a FITS binary table.
virtual bool usesArchive(int ioFlags) const
Callback that should return true if the FitsReader subclass makes use of an InputArchive to read firs...
void readMetadata(daf::base::PropertySet &metadata, bool strip=false)
Read a FITS header into a PropertySet or PropertyList.