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;
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;
114 virtual std::string getPersistenceName()
const;
124 virtual std::string getPythonModule()
const;
133 virtual void write(OutputArchiveHandle& handle)
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));
234 virtual std::shared_ptr<Persistable> read(InputArchive
const& archive,
235 CatalogVector
const& catalogs)
const = 0;
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()
io::CatalogVector CatalogVector
table::Key< std::string > name
An object passed to Persistable::write to allow it to persist itself.
A base class for factory classes used to reconstruct objects from records.
virtual bool isPersistable() const
Return true if this particular object can be persisted using afw::table::io.
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.
A multi-catalog archive object used to save table::io::Persistable objects.
Persistable(Persistable const &other)
A base class for image defects.
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.
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.
An exception thrown when problems occur during persistence.
io::InputArchive InputArchive