![]() |
Ginkgo
Generated from pipelines/2662685947 branch based on develop. Ginkgo version 2.0.0
A numerical linear algebra library targeting many-core architectures
|
The AbstractFactory is a generic interface template that enables easy implementation of the abstract factory design pattern. More...
#include <ginkgo/core/base/abstract_factory.hpp>
Public Types | |
| using | abstract_product_type = AbstractProductType |
| using | components_type = ComponentsType |
Public Member Functions | |
| template<typename... Args> | |
| std::unique_ptr< abstract_product_type > | generate (Args &&... args) const |
| Creates a new product from the given components. More... | |
Public Member Functions inherited from gko::PolymorphicObject | |
| PolymorphicObject & | operator= (const PolymorphicObject &) |
| std::shared_ptr< const Executor > | get_executor () const noexcept |
| Returns the Executor of the object. More... | |
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) |
The AbstractFactory is a generic interface template that enables easy implementation of the abstract factory design pattern.
The interface provides the AbstractFactory::generate() method that can produce products of type AbstractProductType using an object of ComponentsType (which can be constructed on the fly from parameters to its constructors). The generate() method is not declared as virtual, as this allows subclasses to hide the method with a variant that preserves the compile-time type of the objects. Instead, implementers should override the generate_impl() method, which is declared virtual.
Implementers of concrete factories should consider using the EnableDefaultFactory mixin to obtain default implementations of utility methods of PolymorphicObject and AbstractFactory.
| AbstractProductType | the type of products the factory produces |
| ComponentsType | the type of components the factory needs to produce the product |
|
inline |
Creates a new product from the given components.
The method will create an ComponentsType object from the arguments of this method, and pass it to the generate_impl() function which will create a new AbstractProductType.
| Args | types of arguments passed to the constructor of ComponentsType |
| args | arguments passed to the constructor of ComponentsType |
1.8.16