LSSTApplications  19.0.0-14-gb0260a2+1b4fc4249b,20.0.0+19029f0d82,20.0.0+66077e84be,20.0.0+b8df9e862d,20.0.0+e2e26847c2,20.0.0+e47e9b3a81,20.0.0-1-g253301a+19029f0d82,20.0.0-1-g2b7511a+46a6078777,20.0.0-1-g3dda6ea+905cef1a44,20.0.0-1-g4d801e7+5fcfd52d2e,20.0.0-1-g5b95a8c+19889959e1,20.0.0-1-gc96f8cb+d5e4df5959,20.0.0-1-gedffbd8+6ca2c30637,20.0.0-10-g0891cd99+caa8c2603a,20.0.0-13-gad96b2d30+614f89f815,20.0.0-17-gcdbda88+2b141d441d,20.0.0-2-g4dae9ad+d5e4df5959,20.0.0-2-g52fdb94+046030bafd,20.0.0-2-g61b8584+85c46248f3,20.0.0-2-g8177d33+f2ab36af31,20.0.0-2-gb780d76+f45b7d88f4,20.0.0-2-gf072044+19029f0d82,20.0.0-22-gdf434b7+d5e4df5959,20.0.0-23-g10eeb28+452d7a9290,20.0.0-23-g8900aa8+a8b4322b0e,20.0.0-3-g1653f94+85c46248f3,20.0.0-3-g4cc78c6+63636aeed8,20.0.0-3-g750bffe+7a989609f2,20.0.0-3-gbd60e8c+ff10c6d78d,20.0.0-33-g078e64d5+a2256d2c79,20.0.0-4-g97dc21a+a8b4322b0e,20.0.0-4-gfea843c+f45b7d88f4,20.0.0-5-g357b56b+f45b7d88f4,20.0.0-6-g9a5b7a1+3d4d12ed4e,20.0.0-61-g4de25fb+ddf3488217,20.0.0-7-gcda7bf1+dffc53c16b,w.2020.44
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< double > lsst::afw::math::Function< Kernel::Pixel > lsst::afw::math::Function< Pixel > lsst::afw::cameraGeom::DetectorCollection lsst::afw::cameraGeom::TransformMap lsst::afw::detection::Footprint lsst::afw::geom::SpanSet lsst::afw::geom::Transform< FromEndpoint, ToEndpoint > lsst::afw::math::BoundedField lsst::afw::math::Function< ReturnT > lsst::afw::math::Kernel lsst::afw::typehandling::Storable lsst::meas::modelfit::Mixture lsst::afw::geom::Transform< afw::geom::Point2Endpoint, afw::geom::GenericEndpoint >

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 noexcept
 Return true if this particular object can be persisted using afw::table::io. More...
virtual ~Persistable () noexcept=default

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 () noexcept=default
 Persistable (Persistable const &other) noexcept=default
 Persistable (Persistable &&other) noexcept=default
Persistableoperator= (Persistable const &other) noexcept=default
Persistableoperator= (Persistable &&other) noexcept=default


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

Definition at line 74 of file Persistable.h.

Member Typedef Documentation

◆ OutputArchiveHandle

Definition at line 108 of file Persistable.h.

Constructor & Destructor Documentation

◆ ~Persistable()

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

◆ Persistable() [1/3]

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

◆ Persistable() [2/3]

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

◆ Persistable() [3/3]

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

Member Function Documentation

◆ getPersistenceName()

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

◆ getPythonModule()

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

◆ isPersistable()

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

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ write()

void lsst::afw::table::io::Persistable::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.

Reimplemented in lsst::afw::image::FilterLabel, lsst::afw::math::LinearCombinationKernel, lsst::afw::math::DeltaFunctionKernel, lsst::afw::math::AnalyticKernel, lsst::afw::math::FixedKernel, lsst::afw::image::PhotoCalib, lsst::afw::geom::SkyWcs, lsst::meas::modelfit::Mixture, lsst::afw::detection::Footprint, lsst::afw::geom::Transform< FromEndpoint, ToEndpoint >, lsst::afw::geom::Transform< afw::geom::Point2Endpoint, afw::geom::GenericEndpoint >, lsst::afw::geom::polygon::Polygon, lsst::afw::image::Filter, lsst::afw::math::ChebyshevBoundedField, lsst::afw::image::VisitInfo, lsst::meas::algorithms::CoaddPsf, lsst::afw::cameraGeom::DetectorCollection, lsst::afw::cameraGeom::Camera, lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >, lsst::meas::algorithms::CoaddBoundedField, lsst::afw::math::PixelAreaBoundedField, lsst::afw::image::CoaddInputs, lsst::afw::detection::GaussianPsf, lsst::afw::math::TransformBoundedField, lsst::afw::math::ProductBoundedField, lsst::meas::algorithms::KernelPsf, lsst::meas::algorithms::DoubleGaussianPsf, lsst::meas::algorithms::SingleGaussianPsf, lsst::meas::extensions::psfex::PsfexPsf, lsst::afw::math::Chebyshev1Function2< ReturnT >, lsst::afw::math::PolynomialFunction2< ReturnT >, lsst::afw::math::DoubleGaussianFunction2< ReturnT >, and lsst::afw::math::GaussianFunction2< ReturnT >.

Definition at line 38 of file

38  {
39  assert(!isPersistable());
40  throw LSST_EXCEPT(pex::exceptions::LogicError,
41  "afw::table-based persistence is not supported for this object.");
42 }

◆ writeFits() [1/3]

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

Write the object to an already-open FITS object.

[in]fitsfileOpen FITS object to write to.

Definition at line 18 of file

18  {
19  OutputArchive archive;
20  archive.put(this);
21  archive.writeFits(fitsfile);
22 }

◆ 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.

[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.

Definition at line 29 of file

29  {
30  fits::Fits fitsfile(manager, mode, fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
31  writeFits(fitsfile);
32 }

◆ writeFits() [3/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.

[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.

Definition at line 24 of file

24  {
25  fits::Fits fitsfile(fileName, mode, fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
26  writeFits(fitsfile);
27 }

Friends And Related Function Documentation

◆ io::InputArchive

friend class io::InputArchive

Definition at line 146 of file Persistable.h.

◆ io::OutputArchive

friend class io::OutputArchive

Definition at line 145 of file Persistable.h.

◆ PersistableFacade

template<typename T >
friend class PersistableFacade

Definition at line 149 of file Persistable.h.

The documentation for this class was generated from the following files:
void writeFits(std::string const &fileName, std::string const &mode="w") const
Write the object to a regular FITS file.
STL class.
virtual bool isPersistable() const noexcept
Return true if this particular object can be persisted using afw::table::io.
Definition: Persistable.h:102
Definition: fits.h:308
Definition: fits.h:307
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48