lsst.afw  13.0-100-ge0459d59f+5
Public Member Functions | Protected Types | Protected Member Functions | Friends | List of all members
lsst::afw::table::io::Persistable Class Reference

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

#include <Persistable.h>

Inheritance diagram for lsst::afw::table::io::Persistable:
lsst::afw::math::Function< Kernel::Pixel > lsst::afw::detection::Footprint lsst::afw::detection::Psf lsst::afw::geom::polygon::Polygon lsst::afw::geom::SpanSet lsst::afw::image::ApCorrMap lsst::afw::image::Calib lsst::afw::image::CoaddInputs lsst::afw::image::PhotoCalib lsst::afw::image::VisitInfo lsst::afw::image::Wcs lsst::afw::math::BoundedField lsst::afw::math::Function< ReturnT > lsst::afw::math::Kernel

Public Member Functions

void writeFits (std::string const &fileName, std::string const &mode="w") const
 Write the object to a regular FITS file. More...
 
void writeFits (fits::MemFileManager &manager, std::string const &mode="w") const
 Write the object to a FITS image in memory. More...
 
void writeFits (fits::Fits &fitsfile) const
 Write the object to an already-open FITS object. More...
 
virtual bool isPersistable () const
 Return true if this particular object can be persisted using afw::table::io. More...
 
virtual ~Persistable ()
 

Protected Types

typedef io::OutputArchiveHandle OutputArchiveHandle
 

Protected Member Functions

virtual std::string getPersistenceName () const
 Return the unique name used to persist this object and look up its factory. More...
 
virtual std::string getPythonModule () const
 Return the fully-qualified Python module that should be imported to guarantee that its factory is registered. More...
 
virtual void write (OutputArchiveHandle &handle) const
 Write the object to one or more catalogs. More...
 
 Persistable ()
 
 Persistable (Persistable const &other)
 
void operator= (Persistable const &other)
 

Friends

class io::OutputArchive
 
class io::InputArchive
 
template<typename T >
class PersistableFacade
 

Detailed Description

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(), 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.

Definition at line 73 of file Persistable.h.

Member Typedef Documentation

◆ OutputArchiveHandle

Definition at line 107 of file Persistable.h.

Constructor & Destructor Documentation

◆ ~Persistable()

virtual lsst::afw::table::io::Persistable::~Persistable ( )
inlinevirtual

Definition at line 103 of file Persistable.h.

◆ Persistable() [1/2]

lsst::afw::table::io::Persistable::Persistable ( )
inlineprotected

Definition at line 135 of file Persistable.h.

◆ Persistable() [2/2]

lsst::afw::table::io::Persistable::Persistable ( Persistable const &  other)
inlineprotected

Definition at line 137 of file Persistable.h.

Member Function Documentation

◆ getPersistenceName()

virtual std::string lsst::afw::table::io::Persistable::getPersistenceName ( ) const
protectedvirtual

◆ getPythonModule()

virtual std::string lsst::afw::table::io::Persistable::getPythonModule ( ) const
protectedvirtual

◆ isPersistable()

virtual bool lsst::afw::table::io::Persistable::isPersistable ( ) const
inlinevirtual

◆ operator=()

void lsst::afw::table::io::Persistable::operator= ( Persistable const &  other)
inlineprotected

Definition at line 139 of file Persistable.h.

◆ write()

virtual void lsst::afw::table::io::Persistable::write ( OutputArchiveHandle &  handle) const
protectedvirtual

◆ writeFits() [1/3]

void lsst::afw::table::io::Persistable::writeFits ( std::string const &  fileName,
std::string const &  mode = "w" 
) const

Write the object to a regular FITS file.

Parameters
[in]fileNameName of the file to write to.
[in]modeIf "w", any existing file with the given name will be overwritten. If "a", new HDUs will be appended to an existing file.

◆ writeFits() [2/3]

void lsst::afw::table::io::Persistable::writeFits ( fits::MemFileManager &  manager,
std::string const &  mode = "w" 
) const

Write the object to a FITS image in memory.

Parameters
[in]managerName of the file to write to.
[in]modeIf "w", any existing file with the given name will be overwritten. If "a", new HDUs will be appended to an existing file.

◆ writeFits() [3/3]

void lsst::afw::table::io::Persistable::writeFits ( fits::Fits &  fitsfile) const

Write the object to an already-open FITS object.

Parameters
[in]fitsfileOpen FITS object to write to.

Friends And Related Function Documentation

◆ io::InputArchive

friend class io::InputArchive
friend

Definition at line 143 of file Persistable.h.

◆ io::OutputArchive

friend class io::OutputArchive
friend

Definition at line 142 of file Persistable.h.

◆ PersistableFacade

template<typename T >
friend class PersistableFacade
friend

Definition at line 146 of file Persistable.h.


The documentation for this class was generated from the following file: