24 explicit SimpleFitsWriter(Fits* fits,
int flags) : io::FitsWriter(fits, flags) {}
27 void _writeTable(std::shared_ptr<BaseTable const>
const& table, std::size_t nRows)
override;
30void SimpleFitsWriter::_writeTable(std::shared_ptr<BaseTable const>
const& t, std::size_t nRows) {
33 throw LSST_EXCEPT(lsst::pex::exceptions::LogicError,
34 "Cannot use a SimpleFitsWriter on a non-Simple table.");
36 io::FitsWriter::_writeTable(table, nRows);
37 _fits->writeKey(
"AFW_TYPE",
"SIMPLE",
"Tells lsst::afw to load this as a Simple table.");
51class SimpleFitsReader :
public io::FitsReader {
53 SimpleFitsReader() : io::FitsReader(
"SIMPLE") {}
55 std::shared_ptr<BaseTable> makeTable(io::FitsSchemaInputMapper& mapper,
56 std::shared_ptr<daf::base::PropertyList> metadata,
int ioFlags,
57 bool stripMetadata)
const override {
58 std::shared_ptr<SimpleTable> table = SimpleTable::make(mapper.finalize());
59 table->setMetadata(metadata);
65static SimpleFitsReader
const simpleFitsReader;
79 "Schema for Simple must contain at least the keys defined by makeMinimalSchema().");
82 table->getSchema().getAliasMap()->setTable(
table);
90 :
BaseTable(other), _idFactory(other._idFactory ? other._idFactory->
clone() : other._idFactory) {}
94SimpleTable::MinimalSchema::MinimalSchema() {
99SimpleTable::MinimalSchema& SimpleTable::getMinimalSchema() {
100 static MinimalSchema it;
110 table->getSchema().getAliasMap()->setTable(
table);
#define LSST_EXCEPT(type,...)
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
std::shared_ptr< RecordT > constructRecord(Args &&... args)
Helper function that must be used by all _makeRecord overrides to actually construct records.
BaseTable(Schema const &schema, std::shared_ptr< daf::base::PropertyList > metadata=nullptr)
Construct from a schema.
A custom container class for records, based on std::vector.
static CoordKey addFields(afw::table::Schema &schema, std::string const &name, std::string const &doc)
Add a pair of _ra, _dec fields to a Schema, and return a CoordKey that points to them.
Defines the fields and offsets for a table.
Key< T > addField(Field< T > const &field, bool doReplace=false)
Add a new field to the Schema, and return the associated Key.
std::shared_ptr< SimpleTable > clone() const
Return a polymorphic deep copy of the table.
static bool checkSchema(Schema const &other)
Return true if the given schema is a valid SimpleTable schema.
std::shared_ptr< BaseTable > _clone() const override
Clone implementation with noncovariant return types.
std::shared_ptr< io::FitsWriter > makeFitsWriter(fits::Fits *fitsfile, int flags) const override
std::shared_ptr< BaseRecord > _makeRecord() override
Default-construct an associated record (protected implementation).
std::shared_ptr< IdFactory > getIdFactory()
Return the object that generates IDs for the table (may be null).
static std::shared_ptr< SimpleTable > make(Schema const &schema, std::shared_ptr< IdFactory > const &idFactory)
Construct a new table.
SimpleTable(Schema const &schema, std::shared_ptr< IdFactory > const &idFactory)
Custom catalog class for record/table subclasses that are guaranteed to have an ID,...
Writer object for FITS binary tables.
std::int64_t RecordId
Type used for unique IDs for records.
T dynamic_pointer_cast(T... args)