LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Member Functions | Protected Types | Protected Member Functions | Static Private 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::detection::Footprint lsst::afw::detection::Psf lsst::afw::geom::polygon::Polygon lsst::afw::image::ApCorrMap lsst::afw::image::Calib lsst::afw::image::CoaddInputs 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)
 

Static Private Member Functions

static boost::shared_ptr
< Persistable
_readFits (std::string const &fileName, int hdu=0)
 
static boost::shared_ptr
< Persistable
_readFits (fits::MemFileManager &manager, int hdu=0)
 
static boost::shared_ptr
< Persistable
_readFits (fits::Fits &fitsfile)
 

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 74 of file Persistable.h.

Member Typedef Documentation

Definition at line 114 of file Persistable.h.

Constructor & Destructor Documentation

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

Definition at line 109 of file Persistable.h.

109 {}
lsst::afw::table::io::Persistable::Persistable ( )
inlineprotected

Definition at line 142 of file Persistable.h.

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

Definition at line 144 of file Persistable.h.

144 {}

Member Function Documentation

static boost::shared_ptr< Persistable > lsst::afw::table::io::Persistable::_readFits ( std::string const &  fileName,
int  hdu = 0 
)
staticprivate
static boost::shared_ptr< Persistable > lsst::afw::table::io::Persistable::_readFits ( fits::MemFileManager manager,
int  hdu = 0 
)
staticprivate
static boost::shared_ptr< Persistable > lsst::afw::table::io::Persistable::_readFits ( fits::Fits fitsfile)
staticprivate
virtual std::string lsst::afw::table::io::Persistable::getPersistenceName ( ) const
protectedvirtual
virtual std::string lsst::afw::table::io::Persistable::getPythonModule ( ) const
protectedvirtual
virtual bool lsst::afw::table::io::Persistable::isPersistable ( ) const
inlinevirtual
void lsst::afw::table::io::Persistable::operator= ( Persistable const &  other)
inlineprotected

Definition at line 146 of file Persistable.h.

146 {}
virtual void lsst::afw::table::io::Persistable::write ( OutputArchiveHandle handle) const
protectedvirtual
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.
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.
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

friend class io::InputArchive
friend

Definition at line 151 of file Persistable.h.

friend class io::OutputArchive
friend

Definition at line 150 of file Persistable.h.

template<typename T >
friend class PersistableFacade
friend

Definition at line 153 of file Persistable.h.


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