LSSTApplications
10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
|
Abstract base class for all formatters. More...
#include <Formatter.h>
Public Types | |
typedef boost::shared_ptr < Formatter > | Ptr |
typedef Ptr(* | FactoryPtr )(lsst::pex::policy::Policy::Ptr) |
Public Types inherited from lsst::daf::base::Citizen | |
enum | { magicSentinel = 0xdeadbeef } |
typedef unsigned long | memId |
Type of the block's ID. More... | |
typedef memId(* | memNewCallback )(const memId cid) |
A function used to register a callback. More... | |
typedef memId(* | memCallback )(const Citizen *ptr) |
Public Member Functions | |
virtual | ~Formatter (void) |
virtual void | write (lsst::daf::base::Persistable const *persistable, Storage::Ptr storage, lsst::daf::base::PropertySet::Ptr additionalData)=0 |
virtual lsst::daf::base::Persistable * | read (Storage::Ptr storage, lsst::daf::base::PropertySet::Ptr additionalData)=0 |
virtual void | update (lsst::daf::base::Persistable *persistable, Storage::Ptr storage, lsst::daf::base::PropertySet::Ptr additionalData)=0 |
Public Member Functions inherited from lsst::daf::base::Citizen | |
Citizen (const std::type_info &) | |
Citizen (Citizen const &) | |
~Citizen () | |
Citizen & | operator= (Citizen const &) |
std::string | repr () const |
Return a string representation of a Citizen. More... | |
void | markPersistent (void) |
Mark a Citizen as persistent and not destroyed until process end. More... | |
memId | getId () const |
Return the Citizen's ID. More... | |
Static Public Member Functions | |
static Formatter::Ptr | lookupFormatter (std::string const &persistableType, lsst::pex::policy::Policy::Ptr policy) |
static Formatter::Ptr | lookupFormatter (std::type_info const &persistableType, lsst::pex::policy::Policy::Ptr policy) |
Static Public Member Functions inherited from lsst::daf::base::Citizen | |
static bool | hasBeenCorrupted () |
Check all allocated blocks for corruption. More... | |
static memId | getNextMemId () |
Return the memId of the next object to be allocated. More... | |
static int | init () |
Called once when the memory system is being initialised. More... | |
static int | census (int, memId startingMemId=0) |
How many active Citizens are there? More... | |
static void | census (std::ostream &stream, memId startingMemId=0) |
Print a list of all active Citizens to stream, sorted by ID. More... | |
static const std::vector < const Citizen * > * | census () |
Return a (newly allocated) std::vector of active Citizens sorted by ID. More... | |
static memId | setNewCallbackId (memId id) |
Call the NewCallback when block is allocated. More... | |
static memId | setDeleteCallbackId (memId id) |
Call the current DeleteCallback when block is deleted. More... | |
static memNewCallback | setNewCallback (memNewCallback func) |
Set the NewCallback function. More... | |
static memCallback | setDeleteCallback (memCallback func) |
Set the DeleteCallback function. More... | |
static memCallback | setCorruptionCallback (memCallback func) |
Set the CorruptionCallback function. More... | |
Protected Member Functions | |
Formatter (std::type_info const &type) | |
Abstract base class for all formatters.
Formatters map Persistable subclasses into an appropriate form for output to Storage subclasses and vice versa upon retrieval. They also may use an additional piece of data to select the appropriate data for retrieval.
Subclasses of Formatter must register themselves by creating a static instance of the FormatterRegistration class with the name and type_info of the Persistable class they are formatting and a factory method to create instances of the subclass using a Policy. If they are to be used with boost::serialization, subclasses of Formatter must also implement a public static delegateSerialize() template (or a set of static delegateSerialize() functions for each supported archive type).
Definition at line 79 of file Formatter.h.
typedef Ptr(* lsst::daf::persistence::Formatter::FactoryPtr)(lsst::pex::policy::Policy::Ptr) |
Pointer to a (static) factory function for a Formatter subclass.
Definition at line 85 of file Formatter.h.
typedef boost::shared_ptr<Formatter> lsst::daf::persistence::Formatter::Ptr |
Definition at line 81 of file Formatter.h.
|
virtual |
|
explicitprotected |
Constructor.
[in] | type | typeid() of subclass |
Definition at line 68 of file Formatter.cc.
|
static |
Lookup Formatter subclass by name of Persistable subclass.
[in] | name | Name of Persistable subclass |
[in] | policy | Policy for configuring the Formatter |
Returned pointer is not owned and should not be deleted.
Definition at line 84 of file Formatter.cc.
|
static |
Lookup Formatter subclass by its type_info from typeid().
[in] | type | std::type_info of Formatter subclass from typeid() |
[in] | policy | Policy for configuring the Formatter |
Definition at line 94 of file Formatter.cc.
|
pure virtual |
Read a Persistable instance from a Storage instance.
[in] | storage | Pointer to the Storage instance. |
[in] | additionalData | Additional data used to find the proper instance within the Storage. |
Implemented in lsst.afw::formatters::TanWcsFormatter, lsst.afw::formatters::WcsFormatter, lsst.afw::formatters::DecoratedImageFormatter< ImagePixelT >, lsst.afw::formatters::ExposureFormatter< ImagePixelT, MaskPixelT, VariancePixelT >, lsst.afw::formatters::ImageFormatter< ImagePixelT >, lsst.afw::formatters::MaskedImageFormatter< ImagePixelT, MaskPixelT, VariancePixelT >, lsst.afw::formatters::MaskFormatter< MaskPixelT >, lsst.afw::formatters::KernelFormatter, and lsst.afw.detection::PsfFormatter.
|
pure virtual |
Update an existing Persistable instance with information from an additional Storage instance.
[in,out] | persistable | Pointer to the Persistable instance. |
[in] | storage | Shared pointer to the additional Storage instance. |
[in] | additionalData | Additional data used to find the proper instance within the Storage. |
Implemented in lsst.afw::formatters::TanWcsFormatter, lsst.afw::formatters::WcsFormatter, lsst.afw::formatters::DecoratedImageFormatter< ImagePixelT >, lsst.afw::formatters::ExposureFormatter< ImagePixelT, MaskPixelT, VariancePixelT >, lsst.afw::formatters::ImageFormatter< ImagePixelT >, lsst.afw::formatters::MaskedImageFormatter< ImagePixelT, MaskPixelT, VariancePixelT >, lsst.afw::formatters::MaskFormatter< MaskPixelT >, lsst.afw::formatters::KernelFormatter, and lsst.afw.detection::PsfFormatter.
|
pure virtual |
Write a Persistable instance to a Storage instance.
[in] | persistable | Pointer to the Persistable instance. |
[in] | storage | Shared pointer to the Storage instance. |
[in] | additionalData | Additional data used to find the proper place to put the instance into the Storage. |
Implemented in lsst.afw::formatters::TanWcsFormatter, lsst.afw::formatters::WcsFormatter, lsst.afw::formatters::DecoratedImageFormatter< ImagePixelT >, lsst.afw::formatters::ExposureFormatter< ImagePixelT, MaskPixelT, VariancePixelT >, lsst.afw::formatters::ImageFormatter< ImagePixelT >, lsst.afw::formatters::KernelFormatter, lsst.afw::formatters::MaskedImageFormatter< ImagePixelT, MaskPixelT, VariancePixelT >, lsst.afw::formatters::MaskFormatter< MaskPixelT >, and lsst.afw.detection::PsfFormatter.