Ginkgo: gko::EnableDefaultFactory< ConcreteFactory, ProductType, ParametersType, PolymorphicBase > Class Template Reference

| Ginkgo Generated from branch based on main. Ginkgo version 1.11.0 A numerical linear algebra library targeting many-core architectures

Loading...
Searching...
No Matches
gko::EnableDefaultFactory< ConcreteFactory, ProductType, ParametersType, PolymorphicBase > Class Template Reference

This mixin provides a default implementation of a concrete factory. More...

`#include <ginkgo/core/base/abstract_factory.hpp>`

Inheritance diagram for gko::EnableDefaultFactory< ConcreteFactory, ProductType, ParametersType, PolymorphicBase >:
[legend]
Collaboration diagram for gko::EnableDefaultFactory< ConcreteFactory, ProductType, ParametersType, PolymorphicBase >:
[legend]

## Public Types
using | product_type = ProductType
using | parameters_type = ParametersType
using | polymorphic_base = PolymorphicBase
using | abstract_product_type
using | components_type = typename PolymorphicBase::components_type
Public Types inherited from gko::EnablePolymorphicAssignment< ConcreteFactory >
using | result_type

## Public Member Functions
template<typename... Args>
std::unique_ptr< product_type > | generate (Args &&... args) const
const parameters_type & | get_parameters () const noexcept
| Returns the parameters of the factory.
Public Member Functions inherited from gko::EnablePolymorphicAssignment< ConcreteFactory >
void | convert_to (result_type *result) const override
void | move_to (result_type *result) override

## Static Public Member Functions
static parameters_type | create ()
| Creates a new ParametersType object which can be used to instantiate a new ConcreteFactory.

## Friends
class | EnablePolymorphicObject< ConcreteFactory, PolymorphicBase >

## Detailed Description

template<typename ConcreteFactory, typename ProductType, typename ParametersType, typename PolymorphicBase>
class gko::EnableDefaultFactory< ConcreteFactory, ProductType, ParametersType, PolymorphicBase >

This mixin provides a default implementation of a concrete factory.

It implements all the methods of AbstractFactory and PolymorphicObject. Its implementation of the generate_impl() method delegates the creation of the product by calling the ProductType::ProductType(const ConcreteFactory *, const components_type &) constructor. The factory also supports parameters by using the ParametersType structure, which is defined by the user.

For a simple example, see IntFactory in core/test/base/abstract_factory.cpp.

Template Parameters

  ConcreteFactory | the concrete factory which is being implemented [CRTP parameter]
  ProductType | the concrete type of products which this factory produces, has to be a subclass of PolymorphicBase::abstract_product_type
  ParametersType | a type representing the parameters of the factory, has to inherit from the enable_parameters_type mixin
  PolymorphicBase | parent of ConcreteFactory in the polymorphic hierarchy, has to be a subclass of AbstractFactory

## Member Typedef Documentation

## ◆ abstract_product_type

template<typename ConcreteFactory, typename ProductType, typename ParametersType, typename PolymorphicBase>

using gko::EnableDefaultFactory< ConcreteFactory, ProductType, ParametersType, PolymorphicBase >::abstract_product_type

Initial value:
typename PolymorphicBase::abstract_product_type

## Member Function Documentation

## ◆ create()

template<typename ConcreteFactory, typename ProductType, typename ParametersType, typename PolymorphicBase>

parameters_type gko::EnableDefaultFactory< ConcreteFactory, ProductType, ParametersType, PolymorphicBase >::create | ( |  | ) |
| inlinestatic

Creates a new ParametersType object which can be used to instantiate a new ConcreteFactory.

This method does not construct the factory directly, but returns a new parameters_type object, which can be used to set the parameters of the factory. Once the parameters have been set, the parameters_type::on() method can be used to obtain an instance of the factory with those parameters.

Returns
  a default parameters_type object

## ◆ get_parameters()

template<typename ConcreteFactory, typename ProductType, typename ParametersType, typename PolymorphicBase>

const parameters_type & gko::EnableDefaultFactory< ConcreteFactory, ProductType, ParametersType, PolymorphicBase >::get_parameters | ( |  | ) | const
| inlinenoexcept

Returns the parameters of the factory.

Returns
  the parameters of the factory

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

- ginkgo/core/base/abstract_factory.hpp