Class PersistableFactory

Inheritance Relationships

Derived Type

Class Documentation

class PersistableFactory

A base class for factory classes used to reconstruct objects from records.

Classes that inherit from Persistable should also subclass PersistableFactory, and instantiate exactly one instance of the derived factory with static duration (usually the class and instance are both defined in an anonymous namespace in a source file).

Subclassed by lsst::meas::algorithms::KernelPsfFactory< T, K >

Public Functions

PersistableFactory(std::string const &name)

Constructor for the factory.

This should be called only once, and only on an object with static duration, as a pointer to the object will be put in a singleton registry.

The name must be globally unique with respect to all Persistables and be the same as Persistable::getPersistenceName(); the Python module that a Persistable may also declare is not used to resolve names, but rather just to import the module that may install the necessary factory in the registry.

virtual std::shared_ptr<Persistable> read(InputArchive const &archive, CatalogVector const &catalogs) const = 0

Construct a new object from the given InputArchive and vector of catalogs.

virtual ~PersistableFactory()
PersistableFactory(const PersistableFactory&)
PersistableFactory &operator=(const PersistableFactory&)
PersistableFactory(PersistableFactory&&)
PersistableFactory &operator=(PersistableFactory&&)

Public Static Functions

static PersistableFactory const &lookup(std::string const &name, std::string const &module = "")

Return the factory that has been registered with the given name.

If the lookup fails and module is not an empty string, we will attempt to import a Python module with that name (this will only work when the C++ is being called from Python) and try again.

Protected Types

typedef io::InputArchive InputArchive
typedef io::CatalogVector CatalogVector