Ginkgo  Generated from pipelines/2662685947 branch based on develop. Ginkgo version 2.0.0
A numerical linear algebra library targeting many-core architectures
Public Types | Public Member Functions | List of all members
gko::EnableCloneable< ConcreteType > Class Template Reference

This mixin is used to enable a default Cloneable::clone() implementation and similar for objects that have implemented copy and move constructors. More...

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

Inheritance diagram for gko::EnableCloneable< ConcreteType >:
[legend]
Collaboration diagram for gko::EnableCloneable< ConcreteType >:
[legend]

Public Types

using result_type = ConcreteType
 
- Public Types inherited from gko::ConvertibleTo< ConcreteType >
using result_type = ConcreteType
 

Public Member Functions

std::unique_ptr< ConcreteType > clone (std::shared_ptr< const Executor > exec) const
 Creates a clone of the object. More...
 
std::unique_ptr< ConcreteType > clone () const
 Creates a clone of the object. More...
 
void convert_to (result_type *result) const override
 Converts the implementer to an object of type result_type. More...
 
void move_to (result_type *result) override
 Converts the implementer to an object of type result_type by moving data from this object. More...
 
std::unique_ptr< ConcreteType > create_default () const
 
std::unique_ptr< ConcreteType > create_default (std::shared_ptr< const Executor > exec) const
 
- Public Member Functions inherited from gko::ConvertibleTo< ConcreteType >
void convert_to (ptr_param< result_type > result) const
 
void move_to (ptr_param< result_type > result)
 
- Public Member Functions inherited from gko::Cloneable
std::unique_ptr< Cloneableclone (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< Cloneableclone () const
 
Cloneablecopy_from (ptr_param< const Cloneable > other)
 
Cloneablemove_from (ptr_param< Cloneable > other)
 
std::unique_ptr< Cloneablecreate_default (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< Cloneablecreate_default () const
 

Detailed Description

template<typename ConcreteType>
class gko::EnableCloneable< ConcreteType >

This mixin is used to enable a default Cloneable::clone() implementation and similar for objects that have implemented copy and move constructors.

Note
The ConcreteType must have public constructors, or this class as a friend class.
Template Parameters
ConcreteTypethe concrete type from which the copy_from is being enabled [CRTP parameter]

Member Function Documentation

◆ clone() [1/2]

template<typename ConcreteType>
std::unique_ptr<ConcreteType> gko::EnableCloneable< ConcreteType >::clone ( ) const
inline

Creates a clone of the object.

This is a shorthand for clone(std::shared_ptr<const Executor>) that uses the executor of this object to construct the new object.

Returns
A clone of the LinOp.

◆ clone() [2/2]

template<typename ConcreteType>
std::unique_ptr<ConcreteType> gko::EnableCloneable< ConcreteType >::clone ( std::shared_ptr< const Executor exec) const
inline

Creates a clone of the object.

This is the polymorphic equivalent of the executor copy constructor decltype(*this)(exec, this).

Parameters
execthe executor where the clone will be created
Returns
A clone of the LinOp.

◆ convert_to()

template<typename ConcreteType>
void gko::EnableCloneable< ConcreteType >::convert_to ( result_type *  result) const
inlineoverridevirtual

Converts the implementer to an object of type result_type.

Parameters
resultthe object used to store the result of the conversion

Implements gko::ConvertibleTo< ConcreteType >.

◆ move_to()

template<typename ConcreteType>
void gko::EnableCloneable< ConcreteType >::move_to ( result_type *  result)
inlineoverridevirtual

Converts the implementer to an object of type result_type by moving data from this object.

This method is used when the implementer is a temporary object, and move semantics can be used.

Parameters
resultthe object used to emplace the result of the conversion
Note
ConvertibleTo::move_to can be implemented by simply calling ConvertibleTo::convert_to. However, this operation can often be optimized by exploiting the fact that implementer's data can be moved to the result.

Implements gko::ConvertibleTo< ConcreteType >.


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