lsst.afw g714e0ed6de+de8826df4f
Loading...
Searching...
No Matches
StorableHelper< Base > Class Template Reference

"Trampoline" for Storable to let it be used as a base class in Python. More...

#include <python.h>

Inheritance diagram for StorableHelper< Base >:
lsst::afw::typehandling::Storable lsst::afw::table::io::Persistable lsst::afw::detection::PsfTrampoline< Base >

Public Member Functions

template<typename... Args>
 StorableHelper (Args... args)
 Delegating constructor for wrapped class.
 
std::shared_ptr< Storable > cloneStorable () const override
 Create a new object that is a copy of this one (optional operation).
 
std::string toString () const override
 Create a string representation of this object (optional operation).
 
std::size_t hash_value () const override
 Return a hash of this object (optional operation).
 
bool equals (Storable const &other) const noexcept override
 
bool isPersistable () const noexcept override
 Return true if this particular object can be persisted using afw::table::io.
 
std::string getPersistenceName () const override
 Return the unique name used to persist this object and look up its factory.
 
std::string getPythonModule () const override
 Return the fully-qualified Python module that should be imported to guarantee that its factory is registered.
 
void write (table::io::OutputArchiveHandle &handle) const override
 Write the object to one or more catalogs.
 

Detailed Description

template<class Base = Storable>
class StorableHelper< Base >

"Trampoline" for Storable to let it be used as a base class in Python.

Subclasses of Storable that are wrapped in pybind11 should have a similar helper that subclasses StorableHelper<subclass>. This helper can be skipped if the subclass neither adds any virtual methods nor implements any abstract methods.

Template Parameters
Basethe exact (most specific) class being wrapped
See also
pybind11 documentation

Definition at line 54 of file python.h.

Constructor & Destructor Documentation

◆ StorableHelper()

template<class Base = Storable>
template<typename... Args>
lsst::afw::typehandling::StorableHelper< Base >::StorableHelper ( Args... args)
inlineexplicit

Delegating constructor for wrapped class.

While we would like to simply inherit base class constructors, when doing so, we cannot change their access specifiers. One consequence is that it's not possible to use inheritance to expose a protected constructor to python. The alternative, used here, is to create a new public constructor that delegates to the base class public or protected constructor with the same signature.

Template Parameters
ArgsVariadic type specification
Parameters
...argsArguments to forward to the Base class constructor.

Definition at line 193 of file python.h.

Member Function Documentation

◆ cloneStorable()

template<class Base = Storable>
std::shared_ptr< Storable > lsst::afw::typehandling::StorableHelper< Base >::cloneStorable ( ) const
inlineoverridevirtual

Create a new object that is a copy of this one (optional operation).

This operation is required for Storables that are stored in GenericMap by value, but not for those stored by shared pointer.

Exceptions
UnsupportedOperationExceptionThrown if this object is not cloneable.
Note
If this class supports a clone operation, the two should behave identically except for the formal return type.
When called on Python classes, this method delegates to __deepcopy__ if it exists.

Reimplemented from lsst::afw::typehandling::Storable.

Definition at line 73 of file python.h.

◆ equals()

template<class Base = Storable>
bool lsst::afw::typehandling::StorableHelper< Base >::equals ( Storable const & other) const
inlineoverridenoexcept

Definition at line 88 of file python.h.

◆ getPersistenceName()

template<class Base = Storable>
std::string lsst::afw::typehandling::StorableHelper< Base >::getPersistenceName ( ) const
inlineoverridevirtual

Return the unique name used to persist this object and look up its factory.

Must be less than ArchiveIndexSchema::MAX_NAME_LENGTH characters.

Reimplemented from lsst::afw::table::io::Persistable.

Definition at line 98 of file python.h.

◆ getPythonModule()

template<class Base = Storable>
std::string lsst::afw::typehandling::StorableHelper< Base >::getPythonModule ( ) const
inlineoverridevirtual

Return the fully-qualified Python module that should be imported to guarantee that its factory is registered.

Must be less than ArchiveIndexSchema::MAX_MODULE_LENGTH characters.

Will be ignored if empty.

Reimplemented from lsst::afw::table::io::Persistable.

Definition at line 104 of file python.h.

◆ hash_value()

template<class Base = Storable>
std::size_t lsst::afw::typehandling::StorableHelper< Base >::hash_value ( ) const
inlineoverridevirtual

Return a hash of this object (optional operation).

Exceptions
UnsupportedOperationExceptionThrown if this object is not hashable.
Note
C++ subclass authors are responsible for any associated specializations of std::hash.
When called on Python classes, this method delegates to __hash__ if it exists.

Reimplemented from lsst::afw::typehandling::Storable.

Definition at line 84 of file python.h.

◆ isPersistable()

template<class Base = Storable>
bool lsst::afw::typehandling::StorableHelper< Base >::isPersistable ( ) const
inlineoverridevirtualnoexcept

Return true if this particular object can be persisted using afw::table::io.

Reimplemented from lsst::afw::table::io::Persistable.

Definition at line 92 of file python.h.

◆ toString()

template<class Base = Storable>
std::string lsst::afw::typehandling::StorableHelper< Base >::toString ( ) const
inlineoverridevirtual

Create a string representation of this object (optional operation).

Exceptions
UnsupportedOperationExceptionThrown if this object does not have a string representation.
Note
When called on Python classes, this method delegates to __repr__.

Reimplemented from lsst::afw::typehandling::Storable.

Definition at line 80 of file python.h.

◆ write()

template<typename Base>
void lsst::afw::typehandling::StorableHelper< Base >::write ( table::io::OutputArchiveHandle & handle) const
overridevirtual

Write the object to one or more catalogs.

The handle object passed to this function provides an interface for adding new catalogs and adding nested objects to the same archive (while checking for duplicates). See OutputArchiveHandle for more information.

Reimplemented from lsst::afw::table::io::Persistable.

Definition at line 193 of file python.h.


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