Ginkgo Generated from branch based on main. Ginkgo version 1.9.0
A numerical linear algebra library targeting many-core architectures
 
Loading...
Searching...
No Matches
gko::EnablePolymorphicObject< ConcreteObject, PolymorphicBase > Class Template Reference

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

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

Inherits gko::EnableAbstractPolymorphicObject< ConcreteObject, PolymorphicObject >.

Inherited by gko::experimental::distributed::Partition< LocalIndexType, GlobalIndexType >.

Collaboration diagram for gko::EnablePolymorphicObject< ConcreteObject, PolymorphicBase >:
[legend]

Additional Inherited Members

- Public Member Functions inherited from gko::EnableAbstractPolymorphicObject< ConcreteObject, PolymorphicObject >
std::unique_ptr< ConcreteObject > create_default (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< ConcreteObject > create_default () const
 
std::unique_ptr< ConcreteObject > clone (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< ConcreteObject > clone () const
 
ConcreteObject * copy_from (const PolymorphicObject *other)
 
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, ConcreteObject > * copy_from (std::unique_ptr< Derived > &&other)
 
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, ConcreteObject > * copy_from (const std::unique_ptr< Derived > &other)
 
ConcreteObject * copy_from (const std::shared_ptr< const PolymorphicObject > &other)
 
ConcreteObject * move_from (ptr_param< PolymorphicObject > other)
 
ConcreteObject * clear ()
 
- Public Member Functions inherited from gko::PolymorphicObject
PolymorphicObjectoperator= (const PolymorphicObject &)
 
std::unique_ptr< PolymorphicObjectcreate_default (std::shared_ptr< const Executor > exec) const
 Creates a new "default" object of the same dynamic type as this object.
 
std::unique_ptr< PolymorphicObjectcreate_default () const
 Creates a new "default" object of the same dynamic type as this object.
 
std::unique_ptr< PolymorphicObjectclone (std::shared_ptr< const Executor > exec) const
 Creates a clone of the object.
 
std::unique_ptr< PolymorphicObjectclone () const
 Creates a clone of the object.
 
PolymorphicObjectcopy_from (const PolymorphicObject *other)
 Copies another object into this object.
 
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)
 Moves another object into this object.
 
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)
 Copies another object into this object.
 
PolymorphicObjectcopy_from (const std::shared_ptr< const PolymorphicObject > &other)
 Copies another object into this object.
 
PolymorphicObjectmove_from (ptr_param< PolymorphicObject > other)
 Moves another object into this object.
 
PolymorphicObjectclear ()
 Transforms the object into its default state.
 
std::shared_ptr< const Executorget_executor () const noexcept
 Returns the Executor of the object.
 
- Public Member Functions inherited from gko::log::EnableLogging< PolymorphicObject >
void add_logger (std::shared_ptr< const Logger > logger) override
 Adds a new logger to the list of subscribed loggers.
 
void remove_logger (const Logger *logger) override
 Removes a logger from the list of subscribed loggers.
 
void remove_logger (ptr_param< const Logger > logger)
 
const std::vector< std::shared_ptr< const Logger > > & get_loggers () const override
 Returns the vector containing all loggers registered at this object.
 
void clear_loggers () override
 Remove all loggers registered at this object.
 
- Public Member Functions inherited from gko::log::Loggable
void remove_logger (ptr_param< const Logger > logger)
 

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))
{}
};
This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a ne...
Definition polymorphic_object.hpp:662
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.
This mixin can't be used with concrete types that derive from experimental::distributed::DistributedBase. In that case use experimental::EnableDistributedPolymorphicObject instead.
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

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