lsst.daf.persistence  14.0-14-g87d16e8+7
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
lsst::daf::persistence::FormatterRegistry Class Reference

Class that registers all Formatter subclasses. More...

#include <FormatterRegistry.h>

Inheritance diagram for lsst::daf::persistence::FormatterRegistry:
lsst::daf::base::Citizen

Public Types

typedef unsigned long memId
 
typedef memId(* memNewCallback) (const memId cid)
 
typedef memId(* memCallback) (const Citizen *ptr)
 

Public Member Functions

void registerFormatter (std::string const &persistableName, std::type_info const &persistableType, Formatter::FactoryPtr factory)
 Register a factory for a Formatter subclass using the name and type of the Persistable subclass it formats. More...
 
Formatter::Ptr lookupFormatter (std::type_info const &persistableType, lsst::pex::policy::Policy::Ptr policy)
 Create a new instance of a Formatter subclass given the typeid() of its corresponding Persistable subclass. More...
 
Formatter::Ptr lookupFormatter (std::string const &persistableName, lsst::pex::policy::Policy::Ptr policy)
 Create a new instance of a Formatter subclass given the string name of its corresponding Persistable subclass. More...
 
std::string repr () const
 
void markPersistent (void)
 
memId getId () const
 

Static Public Member Functions

static FormatterRegistrygetInstance (void)
 Get a reference to the singleton instance of the FormatterRegistry. More...
 
static bool hasBeenCorrupted ()
 
static memId getNextMemId ()
 
static int init ()
 
static int census (int, memId startingMemId=0)
 
static void census (std::ostream &stream, memId startingMemId=0)
 
static const std::vector< const Citizen *> * census ()
 
static int census (int, memId startingMemId=0)
 
static void census (std::ostream &stream, memId startingMemId=0)
 
static const std::vector< const Citizen *> * census ()
 
static memId setNewCallbackId (memId id)
 
static memId setNewCallbackId (memId id)
 
static memId setDeleteCallbackId (memId id)
 
static memId setDeleteCallbackId (memId id)
 
static memNewCallback setNewCallback (memNewCallback func)
 
static memCallback setDeleteCallback (memCallback func)
 
static memCallback setCorruptionCallback (memCallback func)
 

Public Attributes

 magicSentinel
 

Detailed Description

Class that registers all Formatter subclasses.

Allows lookup by Persistable type_info or name.

Definition at line 53 of file FormatterRegistry.h.

Member Function Documentation

◆ getInstance()

FormatterRegistry & lsst::daf::persistence::FormatterRegistry::getInstance ( void  )
static

Get a reference to the singleton instance of the FormatterRegistry.

Returns
Reference to the singleton

Uses function-scoped static to ensure proper initialization.

Definition at line 56 of file FormatterRegistry.cc.

◆ lookupFormatter() [1/2]

Formatter::Ptr lsst::daf::persistence::FormatterRegistry::lookupFormatter ( std::type_info const &  persistableType,
lsst::pex::policy::Policy::Ptr  policy 
)

Create a new instance of a Formatter subclass given the typeid() of its corresponding Persistable subclass.

Parameters
[in]persistableTypetypeid() of the Persistable subclass
[in]policyPolicy containing all Formatter policies
Returns
Shared pointer to an instance of the subclass

Definition at line 81 of file FormatterRegistry.cc.

◆ lookupFormatter() [2/2]

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

Create a new instance of a Formatter subclass given the string name of its corresponding Persistable subclass.

Parameters
[in]persistableNameName of the Persistable subclass
[in]policyPolicy containing all Formatter policies
Returns
Shared pointer to an instance of the subclass

Definition at line 99 of file FormatterRegistry.cc.

◆ registerFormatter()

void lsst::daf::persistence::FormatterRegistry::registerFormatter ( std::string const &  persistableName,
std::type_info const &  persistableType,
Formatter::FactoryPtr  factory 
)

Register a factory for a Formatter subclass using the name and type of the Persistable subclass it formats.

Parameters
[in]persistableNameName of the Persistable subclass
[in]persistableTypetypeid() of the Persistable subclass
[in]factoryFactory function for the Formatter, taking a Policy

Definition at line 67 of file FormatterRegistry.cc.


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