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
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
lsst::daf::persistence::Formatter Class Referenceabstract

Abstract base class for all formatters. More...

#include <Formatter.h>

Inheritance diagram for lsst::daf::persistence::Formatter:
lsst::daf::base::Citizen lsst.afw.detection::PsfFormatter 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 > lsst.afw::formatters::TanWcsFormatter lsst.afw::formatters::WcsFormatter lsst::daf::persistence::PropertySetFormatter

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 ()
 
Citizenoperator= (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)
 

Detailed Description

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.

Member Typedef Documentation

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.

Definition at line 81 of file Formatter.h.

Constructor & Destructor Documentation

lsst::daf::persistence::Formatter::~Formatter ( void  )
virtual

Minimal destructor.

Definition at line 74 of file Formatter.cc.

74  {
75 }
lsst::daf::persistence::Formatter::Formatter ( std::type_info const &  type)
explicitprotected

Constructor.

Parameters
[in]typetypeid() of subclass

Definition at line 68 of file Formatter.cc.

68  :
70 }
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56

Member Function Documentation

Formatter::Ptr lsst::daf::persistence::Formatter::lookupFormatter ( std::string const &  name,
lsst::pex::policy::Policy::Ptr  policy 
)
static

Lookup Formatter subclass by name of Persistable subclass.

Parameters
[in]nameName of Persistable subclass
[in]policyPolicy for configuring the Formatter
Returns
Shared pointer to Formatter instance

Returned pointer is not owned and should not be deleted.

Definition at line 84 of file Formatter.cc.

85  {
87 }
table::Key< std::string > name
Definition: ApCorrMap.cc:71
static FormatterRegistry & getInstance(void)
Formatter::Ptr lookupFormatter(std::type_info const &persistableType, lsst::pex::policy::Policy::Ptr policy)
Formatter::Ptr lsst::daf::persistence::Formatter::lookupFormatter ( std::type_info const &  type,
lsst::pex::policy::Policy::Ptr  policy 
)
static

Lookup Formatter subclass by its type_info from typeid().

Parameters
[in]typestd::type_info of Formatter subclass from typeid()
[in]policyPolicy for configuring the Formatter
Returns
Shared pointer to Formatter instance

Definition at line 94 of file Formatter.cc.

95  {
96  return FormatterRegistry::getInstance().lookupFormatter(type, policy);
97 }
static FormatterRegistry & getInstance(void)
Formatter::Ptr lookupFormatter(std::type_info const &persistableType, lsst::pex::policy::Policy::Ptr policy)
virtual lsst::daf::base::Persistable* lsst::daf::persistence::Formatter::read ( Storage::Ptr  storage,
lsst::daf::base::PropertySet::Ptr  additionalData 
)
pure virtual
virtual void lsst::daf::persistence::Formatter::update ( lsst::daf::base::Persistable persistable,
Storage::Ptr  storage,
lsst::daf::base::PropertySet::Ptr  additionalData 
)
pure virtual

Update an existing Persistable instance with information from an additional Storage instance.

Parameters
[in,out]persistablePointer to the Persistable instance.
[in]storageShared pointer to the additional Storage instance.
[in]additionalDataAdditional 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.

virtual void lsst::daf::persistence::Formatter::write ( lsst::daf::base::Persistable const *  persistable,
Storage::Ptr  storage,
lsst::daf::base::PropertySet::Ptr  additionalData 
)
pure virtual

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