template<class Base = Storable>
class lsst::afw::typehandling::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
-
| Base | the exact (most specific) class being wrapped |
- See also
- pybind11 documentation
Definition at line 54 of file python.h.
template<class Base = Storable>
template<typename... Args>
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
-
| Args | Variadic type specification |
- Parameters
-
| ...args | Arguments to forward to the Base class constructor. |
Definition at line 193 of file python.h.
template<class Base = Storable>
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
-
| UnsupportedOperationException | Thrown 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.
template<class Base = Storable>
|
|
inlineoverridevirtualnoexcept |
Compare this object to another Storable.
Subclasses that implement equality comparison must override this method to give results consistent with operator== for all inputs that are accepted by both.
- Returns
- This implementation returns whether the two objects are the same.
- Warning
- This method compares an object to any type of Storable, although cross-class comparisons should usually return false. If cross-class comparisons are valid, implementers should take care that they are symmetric and will give the same result no matter what the compile-time types of the left- and right-hand sides are.
- See also
- singleClassEquals
- Note
- When called on Python classes, this method delegates to __eq__ if it exists.
Reimplemented from lsst::afw::typehandling::Storable.
Definition at line 88 of file python.h.
template<class T>
| bool lsst::afw::typehandling::Storable::singleClassEquals |
( |
T const & | lhs, |
|
|
Storable const & | rhs ) |
|
inlinestaticprotectedinherited |
Test if a Storable is of a particular class and equal to another object.
This method template simplifies implementations of equals that delegate to operator== without supporting cross-class comparisons.
- Template Parameters
-
| T | The class expected of the two objects to be compared. |
- Parameters
-
| lhs,rhs | The objects to compare. Note that rhs need not be a T, while lhs must be. |
- Returns
- true if rhs is a T and lhs == rhs; false otherwise.
- Exception Safety
- Provides the same level of exception safety as operator==. Most implementations of operator== do not throw.
- Note
- This method template calls operator== with both arguments of compile-time type T const&. Its use is not recommended if there would be any ambiguity as to which operator== gets picked by overload resolution.
This method template is typically called from equals as:
bool MyType::equals(Storable const& other) const noexcept {
return singleClassEquals(*this, other);
}
Definition at line 151 of file Storable.h.