lsst.daf.persistence  13.0-40-g460649b+5
Public Member Functions | Static Public Member Functions | 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:

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

Static Public Member Functions

static FormatterRegistrygetInstance (void)
 Get a reference to the singleton instance of the FormatterRegistry. More...
 

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: