Mirror reflection library 0.5.13
|
Helper class for more convenient instantiation of the invoker template. More...
#include <mirror/invoker.hpp>
Classes | |
struct | invoker |
This meta-function creates an invoker creating the Product . More... |
Helper class for more convenient instantiation of the invoker template.
This template class can be used for a convenient creation of invokers of the same kind but calling different functions. If one wants to use the same kind of invoker (i.e. using the same Manufacturer
, Suppliers
and Enumerator
templates and the same SourceTraits
parameter) to call different functions, this template can be used in the following way:
// implement the class which will be passed as the SourceTraits parameter class my_factory_param { ... some implementation ... }; // implement the parameter manufacturer template template <class Product, class Param> class my_manufacturer { ... some implementation ... }; // implement the parameter supplier(s) template template <class Product, class Param> class my_suppliers { ... some implementation ... }; // use the invoker_maker template to define a custom invoker maker typedef invoker_maker< my_manufacturer, my_suppliers, my_factory_param > my_maker; // use the maker to create some factories my_maker::invoker<my_function_1>::type my_fn_1_invoker; my_maker::invoker<my_function_2>::type my_fn_2_invoker; my_maker::invoker<my_function_3>::type my_fn_3_invoker; my_class x; my_fn_1_invoker.call_on(x); my_fn_2_invoker.call_on(x); my_fn_3_invoker.call_on(x);
Manufacturer | a class template which knows how to construct the parametes for the constructors. this template can for example use this factory template recursivelly for elaborated types and specify how to construct and initialize instances of the native C++ types. |
Suppliers | a class template which knows how to get existing instances to be supplied as parameters to the constructors. |
Enumerator | a class template which knows how to get enumerated values from external representations, like their names or values. |
SourceTraits | a parameter for the Manufacturer and Suppliers templates, which can be used for further configuration and fine-tuning of the generated factory. |