EnablePolymorphicObject< ConcreteObject, PolymorphicBase > Class Template Reference

EnablePolymorphicObject&lt; ConcreteObject, PolymorphicBase &gt; Class Template Reference#

Reference API: gko::EnablePolymorphicObject< ConcreteObject, PolymorphicBase > Class Template Reference
Reference API
gko::EnablePolymorphicObject< ConcreteObject, PolymorphicBase > Class Template Reference

#include <ginkgo/core/base/polymorphic_object.hpp>

Inherits gko::EnableAbstractPolymorphicObject< AbstractObject, PolymorphicBase >.

Inherited by gko::EnableLinOp< StencilMatrix< ValueType > >, gko::EnableLinOp< BlockOperator >, gko::EnableLinOp< Combination< default_precision > >, gko::EnableLinOp< Composition< default_precision > >, gko::EnableLinOp< Perturbation< default_precision > >, gko::EnableLinOp< Matrix< default_precision, int32, int64 > >, gko::EnableLinOp< Vector< double > >, gko::EnableLinOp< Schwarz< default_precision, int32, int64 > >, gko::EnableLinOp< Factorization< ValueType, IndexType > >, gko::EnableLinOp< ScaledReordered< default_precision, int32 > >, gko::EnableLinOp< Direct< ValueType, IndexType > >, gko::EnableLinOp< Composition< gko::default_precision > >, gko::EnableLinOp< Coo< default_precision, int32 > >, gko::EnableLinOp< Csr< default_precision, int32 > >, gko::EnableLinOp< Dense< default_precision > >, gko::EnableLinOp< Diagonal< default_precision > >, gko::EnableLinOp< Ell< default_precision, int32 > >, gko::EnableLinOp< Fbcsr< default_precision, int32 > >, gko::EnableLinOp< Fft >, gko::EnableLinOp< Fft2 >, gko::EnableLinOp< Fft3 >, gko::EnableLinOp< Hybrid< default_precision, int32 > >, gko::EnableLinOp< Identity< default_precision > >, gko::EnableLinOp< Permutation< int32 > >, gko::EnableLinOp< RowGatherer< int32 > >, gko::EnableLinOp< ScaledPermutation< default_precision, int32 > >, gko::EnableLinOp< Sellp< default_precision, int32 > >, gko::EnableLinOp< SparsityCsr< default_precision, int32 > >, gko::EnableLinOp< FixedCoarsening< default_precision, int32 > >, gko::EnableLinOp< Pgm< default_precision, int32 > >, gko::EnableLinOp< Ic< solver::LowerTrs<>, int32 > >, gko::EnableLinOp< Ilu< solver::LowerTrs<>, solver::UpperTrs<>, false, int32 > >, gko::EnableLinOp< Isai< IsaiType, ValueType, IndexType > >, gko::EnableLinOp< Jacobi< default_precision, int32 > >, gko::EnableLinOp< Bicg< default_precision > >, gko::EnableLinOp< Bicgstab< default_precision > >, gko::EnableLinOp< CbGmres< default_precision > >, gko::EnableLinOp< Cg< default_precision > >, gko::EnableLinOp< Cgs< default_precision > >, gko::EnableLinOp< Fcg< default_precision > >, gko::EnableLinOp< Gcr< default_precision > >, gko::EnableLinOp< Gmres< default_precision > >, gko::EnableLinOp< Idr< default_precision > >, gko::EnableLinOp< Ir< default_precision > >, gko::EnableLinOp< LowerTrs< default_precision, int32 > >, gko::EnableLinOp< Minres< default_precision > >, gko::EnableLinOp< Multigrid >, gko::EnableLinOp< UpperTrs< default_precision, int32 > >, gko::EnableLinOp< Dense< value_type > >, gko::EnableLinOp< Dense< ValueType > >, gko::batch::EnableBatchLinOp< Csr< default_precision, int32 > >, gko::batch::EnableBatchLinOp< Dense< default_precision > >, gko::batch::EnableBatchLinOp< Ell< default_precision, int32 > >, gko::batch::EnableBatchLinOp< Identity< default_precision > >, gko::batch::EnableBatchLinOp< Jacobi< default_precision, int32 > >, gko::batch::EnableBatchLinOp< Bicgstab< default_precision >, BatchLinOp >, gko::batch::EnableBatchLinOp< Cg< default_precision >, BatchLinOp >, gko::batch::EnableBatchLinOp< ConcreteSolver, BatchLinOp >, gko::stop::ResidualNormBase< default_precision >, gko::EnableLinOp< ConcreteLinOp, PolymorphicBase >, gko::batch::EnableBatchLinOp< ConcreteBatchLinOp, PolymorphicBase >, gko::batch::MultiVector< ValueType >, gko::experimental::distributed::Partition< LocalIndexType, GlobalIndexType >, gko::experimental::reorder::Amd< IndexType >, gko::experimental::reorder::Mc64< ValueType, IndexType >, gko::matrix::IdentityFactory< ValueType >, gko::preconditioner::GaussSeidel< ValueType, IndexType >, gko::preconditioner::Sor< ValueType, IndexType >, and gko::reorder::Rcm< ValueType, IndexType >.

Protected Member Functions

std::unique_ptr< PolymorphicObjectcreate_default_impl (std::shared_ptr< const Executor > exec) const override
 
PolymorphicObjectcopy_from_impl (const PolymorphicObject *other) override
 
PolymorphicObjectcopy_from_impl (std::unique_ptr< PolymorphicObject > other) override
 
PolymorphicObjectmove_from_impl (PolymorphicObject *other) override
 
PolymorphicObjectmove_from_impl (std::unique_ptr< PolymorphicObject > other) override
 
PolymorphicObjectclear_impl () override
 
- Protected Member Functions inherited from gko::PolymorphicObject
 PolymorphicObject (std::shared_ptr< const Executor > exec)
 
 PolymorphicObject (const PolymorphicObject &other)
 
- Protected Member Functions inherited from gko::log::EnableLogging< PolymorphicObject >
void log (Params &&... params) const
 

Additional Inherited Members

- Public Member Functions inherited from gko::EnableAbstractPolymorphicObject< AbstractObject, PolymorphicBase >
std::unique_ptr< AbstractObject > create_default (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< AbstractObject > create_default () const
 
std::unique_ptr< AbstractObject > clone (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< AbstractObject > clone () const
 
AbstractObject * copy_from (const PolymorphicObject *other)
 
template<typename Derived >
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, AbstractObject > * copy_from (std::unique_ptr< Derived > &&other)
 
template<typename Derived >
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, AbstractObject > * copy_from (const std::unique_ptr< Derived > &other)
 
AbstractObject * copy_from (const std::shared_ptr< const PolymorphicObject > &other)
 
AbstractObject * move_from (ptr_param< PolymorphicObject > other)
 
AbstractObject * clear ()
 
- Public Member Functions inherited from gko::PolymorphicObject
PolymorphicObjectoperator= (const PolymorphicObject &)
 
std::unique_ptr< PolymorphicObjectcreate_default (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< PolymorphicObjectcreate_default () const
 
std::unique_ptr< PolymorphicObjectclone (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< PolymorphicObjectclone () const
 
PolymorphicObjectcopy_from (const PolymorphicObject *other)
 
template<typename Derived , typename Deleter >
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, PolymorphicObject > * copy_from (std::unique_ptr< Derived, Deleter > &&other)
 
template<typename Derived , typename Deleter >
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, PolymorphicObject > * copy_from (const std::unique_ptr< Derived, Deleter > &other)
 
PolymorphicObjectcopy_from (const std::shared_ptr< const PolymorphicObject > &other)
 
PolymorphicObjectmove_from (ptr_param< PolymorphicObject > other)
 
PolymorphicObjectclear ()
 
std::shared_ptr< const Executorget_executor () const noexcept
 
- Public Member Functions inherited from gko::log::EnableLogging< PolymorphicObject >
void add_logger (std::shared_ptr< const Logger > logger) override
 
void remove_logger (const Logger *logger) override
 
void remove_logger (ptr_param< const Logger > logger)
 
const std::vector< std::shared_ptr< const Logger > > & get_loggers () const override
 
void clear_loggers () override
 
- Public Member Functions inherited from gko::log::Loggable
void remove_logger (ptr_param< const Logger > logger)
 
- Protected Attributes inherited from gko::log::EnableLogging< PolymorphicObject >
std::vector< std::shared_ptr< const Logger > > loggers_
 

Detailed Description

template<typename ConcreteObject, typename PolymorphicBase = PolymorphicObject>
class gko::EnablePolymorphicObject< ConcreteObject, PolymorphicBase >

This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a new concrete polymorphic object.

The mixin changes parameter and return types of appropriate public methods of PolymorphicObject in the same way EnableAbstractPolymorphicObject does. In addition, it also provides default implementations of PolymorphicObject's virtual methods by using the executor default constructor and the assignment operator of ConcreteObject. Consequently, the following is a minimal example of PolymorphicObject:

++
struct MyObject : EnablePolymorphicObject<MyObject> {
MyObject(std::shared_ptr<const Executor> exec)
: EnablePolymorphicObject<MyObject>(std::move(exec))
{}
};
Definition polymorphic_object.hpp:668
STL namespace.

In a way, this mixin can be viewed as an extension of default constructor/destructor/assignment operators.

Note
This mixin does not enable copying the polymorphic object to the object of the same type (i.e. it does not implement the ConvertibleTo<ConcreteObject> interface). To enable a default implementation of this interface see the EnablePolymorphicAssignment mixin.
Template Parameters
ConcreteObjectthe concrete type which is being implemented [CRTP parameter]
PolymorphicBaseparent of ConcreteObject in the polymorphic hierarchy, has to be a subclass of polymorphic object

Member Function Documentation

◆ clear_impl()

template<typename ConcreteObject , typename PolymorphicBase = PolymorphicObject>
PolymorphicObject * gko::EnablePolymorphicObject< ConcreteObject, PolymorphicBase >::clear_impl ( )
inlineoverrideprotectedvirtual

Implementers of PolymorphicObject should implement this function instead of clear().

Returns
this

Implements gko::PolymorphicObject.

References gko::PolymorphicObject::get_executor().

◆ copy_from_impl() [1/2]

template<typename ConcreteObject , typename PolymorphicBase = PolymorphicObject>
PolymorphicObject * gko::EnablePolymorphicObject< ConcreteObject, PolymorphicBase >::copy_from_impl ( const PolymorphicObject other)
inlineoverrideprotectedvirtual

Implementers of PolymorphicObject should implement this function instead of copy_from(const PolymorphicObject *).

Parameters
otherthe object to copy
Returns
this

Implements gko::PolymorphicObject.

◆ copy_from_impl() [2/2]

template<typename ConcreteObject , typename PolymorphicBase = PolymorphicObject>
PolymorphicObject * gko::EnablePolymorphicObject< ConcreteObject, PolymorphicBase >::copy_from_impl ( std::unique_ptr< PolymorphicObject other)
inlineoverrideprotectedvirtual

Implementers of PolymorphicObject should implement this function instead of copy_from(std::unique_ptr<PolymorphicObject>).

Parameters
otherthe object to move from
Returns
this

Implements gko::PolymorphicObject.

◆ create_default_impl()

template<typename ConcreteObject , typename PolymorphicBase = PolymorphicObject>
std::unique_ptr< PolymorphicObject > gko::EnablePolymorphicObject< ConcreteObject, PolymorphicBase >::create_default_impl ( std::shared_ptr< const Executor exec) const
inlineoverrideprotectedvirtual

Implementers of PolymorphicObject should override this function instead of create_default().

Parameters
execthe executor where the object will be created
Returns
a polymorphic object of the same type as this

Implements gko::PolymorphicObject.

◆ move_from_impl() [1/2]

template<typename ConcreteObject , typename PolymorphicBase = PolymorphicObject>
PolymorphicObject * gko::EnablePolymorphicObject< ConcreteObject, PolymorphicBase >::move_from_impl ( PolymorphicObject other)
inlineoverrideprotectedvirtual

Implementers of PolymorphicObject should implement this function instead of move_from(PolymorphicObject *).

Parameters
otherthe object to move from
Returns
this

Implements gko::PolymorphicObject.

◆ move_from_impl() [2/2]

template<typename ConcreteObject , typename PolymorphicBase = PolymorphicObject>
PolymorphicObject * gko::EnablePolymorphicObject< ConcreteObject, PolymorphicBase >::move_from_impl ( std::unique_ptr< PolymorphicObject other)
inlineoverrideprotectedvirtual

Implementers of PolymorphicObject should implement this function instead of move_from(std::unique_ptr<PolymorphicObject>).

Parameters
otherthe object to move from
Returns
this

Implements gko::PolymorphicObject.


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