|
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.
|
std::unique_ptr< ConcreteFactory > | create_default (std::shared_ptr< const Executor > exec) const |
std::unique_ptr< ConcreteFactory > | clone (std::shared_ptr< const Executor > exec) const |
ConcreteFactory * | copy_from (const PolymorphicObject *other) |
ConcreteFactory * | move_from (ptr_param< PolymorphicObject > other) |
ConcreteFactory * | clear () |
void | convert_to (result_type *result) const override |
void | move_to (result_type *result) override |
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 |
template<typename ConcreteFactory, typename ProductType, typename ParametersType, typename PolymorphicBase>
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