2 #ifndef AFW_TABLE_IO_Persistable_h_INCLUDED
3 #define AFW_TABLE_IO_Persistable_h_INCLUDED
7 #include "lsst/pex/exceptions.h"
24 class OutputArchiveHandle;
38 lsst::afw::table::io::MalformedArchiveError)
47 #define LSST_ARCHIVE_ASSERT(EXPR) \
49 throw LSST_EXCEPT(lsst::afw::table::io::MalformedArchiveError, "Archive assertion failed: " #EXPR)
82 void writeFits(std::string
const& fileName, std::string
const& mode =
"w")
const;
145 template <
typename T>
148 static std::shared_ptr<Persistable> _readFits(std::string
const& fileName,
int hdu = INT_MIN);
150 static std::shared_ptr<Persistable> _readFits(
fits::MemFileManager& manager,
int hdu = INT_MIN);
152 static std::shared_ptr<Persistable> _readFits(
fits::Fits& fitsfile);
172 template <
typename T>
181 return std::dynamic_pointer_cast<T>(Persistable::_readFits(fitsfile));
191 static std::shared_ptr<T>
readFits(std::string
const& fileName,
int hdu = INT_MIN) {
192 return std::dynamic_pointer_cast<T>(Persistable::_readFits(fileName, hdu));
203 return std::dynamic_pointer_cast<T>(Persistable::_readFits(manager, hdu));
261 #endif // !AFW_TABLE_IO_Persistable_h_INCLUDED
static std::shared_ptr< T > readFits(std::string const &fileName, int hdu=INT_MIN)
Read an object from a regular FITS file.
virtual ~PersistableFactory()
PersistableFactory(std::string const &name)
Constructor for the factory.
io::CatalogVector CatalogVector
An object passed to Persistable::write to allow it to persist itself.
PersistableFactory & operator=(const PersistableFactory &)=delete
void writeFits(std::string const &fileName, std::string const &mode="w") const
Write the object to a regular FITS file.
A base class for factory classes used to reconstruct objects from records.
virtual std::string getPersistenceName() const
Return the unique name used to persist this object and look up its factory.
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
A base class for objects that can be persisted via afw::table::io Archive classes.
virtual std::shared_ptr< Persistable > read(InputArchive const &archive, CatalogVector const &catalogs) const =0
Construct a new object from the given InputArchive and vector of catalogs.
A multi-catalog archive object used to save table::io::Persistable objects.
Persistable(Persistable const &other)
virtual bool isPersistable() const
Return true if this particular object can be persisted using afw::table::io.
void operator=(Persistable const &other)
Lifetime-management for memory that goes into FITS memory files.
static std::shared_ptr< T > readFits(fits::MemFileManager &manager, int hdu=INT_MIN)
Read an object from a FITS file in memory.
table::Key< std::string > name
virtual std::string getPythonModule() const
Return the fully-qualified Python module that should be imported to guarantee that its factory is reg...
A vector of catalogs used by Persistable.
io::OutputArchiveHandle OutputArchiveHandle
static std::shared_ptr< T > readFits(fits::Fits &fitsfile)
Read an object from an already open FITS object.
A CRTP facade class for subclasses of Persistable.
virtual void write(OutputArchiveHandle &handle) const
Write the object to one or more catalogs.
static PersistableFactory const & lookup(std::string const &name, std::string const &module="")
Return the factory that has been registered with the given name.
An exception thrown when problems occur during persistence.
io::InputArchive InputArchive