Class Persistable

Inheritance Relationships

Derived Types

Class Documentation

class Persistable

A base class for objects that can be persisted via afw::table::io Archive classes.

Inheriting from Persistable provides a public API for reading/writing individual objects to FITS that is fully defined in the base class, with derived classes only needing to implement persistence to catalogs. It is expected that objects that contain multiple persistables (such as Exposures) will create their own InputArchives and OutputArchives, and use these to avoid writing the same object twice (which would otherwise be a big concern for future objects like ExposureCatalog and CoaddPsf).

Generally speaking, an abstract base class that inherits from Persistable should also inherit from PersistableFacade<Base>. A concrete class that inherits (possibly indirectly) from Persistable should inherit from PersistableFacade<Derived> (though this just provides a slightly nicer interface to users), implement isPersistable(), getPersistenceName(), getPythonModule(), and write(), and define a subclass of PersistenceFactory. Inheritance from PersistableFacade should always precede inheritance from Persistable.

Persistable has no pure virtual member functions, and instead contains a default implementation that throws LogicError when the user attempts to save an object for which persistence has not actually been implemented.

Subclassed by lsst::afw::math::Function< Kernel::Pixel >, lsst::afw::cameraGeom::DetectorCollection, lsst::afw::cameraGeom::TransformMap, lsst::afw::detection::Footprint, lsst::afw::geom::Transform< FromEndpoint, ToEndpoint >, lsst::afw::math::BoundedField, lsst::afw::math::Function< ReturnT >, lsst::afw::math::Kernel, lsst::meas::modelfit::Mixture, lsst::afw::geom::Transform< afw::geom::Point2Endpoint, afw::geom::GenericEndpoint >

Public Functions

void writeFits(std::string const &fileName, std::string const &mode = "w") const

Write the object to a regular FITS file.

Parameters
  • [in] fileName: Name of the file to write to.

  • [in] mode: If “w”, any existing file with the given name will be overwritten. If “a”, new HDUs will be appended to an existing file.

void writeFits(fits::MemFileManager &manager, std::string const &mode = "w") const

Write the object to a FITS image in memory.

Parameters
  • [in] manager: Name of the file to write to.

  • [in] mode: If “w”, any existing file with the given name will be overwritten. If “a”, new HDUs will be appended to an existing file.

void writeFits(fits::Fits &fitsfile) const

Write the object to an already-open FITS object.

Parameters
  • [in] fitsfile: Open FITS object to write to.

virtual bool isPersistable() const

Return true if this particular object can be persisted using afw::table::io.

virtual ~Persistable()

Protected Types

typedef io::OutputArchiveHandle OutputArchiveHandle

Protected Functions

virtual std::string getPersistenceName() const

Return the unique name used to persist this object and look up its factory.

Must be less than ArchiveIndexSchema::MAX_NAME_LENGTH characters.

virtual std::string getPythonModule() const

Return the fully-qualified Python module that should be imported to guarantee that its factory is registered.

Must be less than ArchiveIndexSchema::MAX_MODULE_LENGTH characters.

Will be ignored if empty.

virtual void write(OutputArchiveHandle &handle) const

Write the object to one or more catalogs.

The handle object passed to this function provides an interface for adding new catalogs and adding nested objects to the same archive (while checking for duplicates). See OutputArchiveHandle for more information.

Persistable()
Persistable(Persistable const &other)
Persistable(Persistable &&other)
Persistable &operator=(Persistable const &other)
Persistable &operator=(Persistable &&other)

Friends

friend lsst::afw::table::io::Persistable::io::OutputArchive
friend lsst::afw::table::io::Persistable::io::InputArchive