Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
MultiFact< SIG, ID, Wrapper > Class Template Reference

#include "lib/multifact.hpp"

Description

template<typename SIG, typename ID, template< class > class Wrapper = PassAsIs>
class lib::factory::MultiFact< SIG, ID, Wrapper >

Factory for creating a family of objects by ID.

The actual factory functions are to be installed from the usage site through calls to defineProduction . Each generated object will be treated by the Wrapper template, allowing for the generation of smart-ptrs. The embedded class Singleton allows to build a family of singleton objects; it is to be instantiated at the call site and acts as singleton factory, accessible through a MultiFact instance as frontend.

Definition at line 258 of file multifact.hpp.

Classes

class  Singleton
 Convenience shortcut for automatically setting up a production line, to fabricate a singleton instance of the given implementation target type (IMP) More...
 

Public Types

using Product = _Conf::WrappedProduct
 

Public Member Functions

template<typename... ARGS>
Product operator() (ID const &id, ARGS &&...args)
 Core operation of the factory: Select a production line and invoke the fabrication function.
 
template<typename... ARGS>
Product invokeFactory (ID const &id, ARGS &&...args)
 more legible alias for the function operator
 
template<typename FUNC >
void defineProduction (ID id, FUNC &&fun)
 to set up a production line, associated with a specific ID
 
bool empty () const
 
bool contains (ID id) const
 

Protected Types

using Creator = _Fab::FactoryFunc
 

Protected Member Functions

CreatorselectProducer (ID const &id)
 

Private Types

using _Conf = FabConfig< SIG, Wrapper >
 
using SIG_Fab = _Conf::SIG_Fab
 
using _Fab = Fab< SIG_Fab, ID >
 

Private Attributes

_Fab funcTable_
 

Member Typedef Documentation

◆ _Conf

template<typename SIG , typename ID , template< class > class Wrapper = PassAsIs>
using _Conf = FabConfig<SIG,Wrapper>
private

Definition at line 261 of file multifact.hpp.

◆ SIG_Fab

template<typename SIG , typename ID , template< class > class Wrapper = PassAsIs>
using SIG_Fab = _Conf::SIG_Fab
private

Definition at line 262 of file multifact.hpp.

◆ _Fab

template<typename SIG , typename ID , template< class > class Wrapper = PassAsIs>
using _Fab = Fab<SIG_Fab,ID>
private

Definition at line 263 of file multifact.hpp.

◆ Creator

template<typename SIG , typename ID , template< class > class Wrapper = PassAsIs>
using Creator = _Fab::FactoryFunc
protected

Definition at line 269 of file multifact.hpp.

◆ Product

template<typename SIG , typename ID , template< class > class Wrapper = PassAsIs>
using Product = _Conf::WrappedProduct

Definition at line 279 of file multifact.hpp.

Member Function Documentation

◆ selectProducer()

template<typename SIG , typename ID , template< class > class Wrapper = PassAsIs>
Creator & selectProducer ( ID const &  id)
inlineprotected

Definition at line 272 of file multifact.hpp.

References MultiFact< SIG, ID, Wrapper >::funcTable_, and Fab< SIG, ID >::select().

Referenced by MultiFact< SIG, ID, Wrapper >::operator()().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator()()

template<typename SIG , typename ID , template< class > class Wrapper = PassAsIs>
template<typename... ARGS>
Product operator() ( ID const &  id,
ARGS &&...  args 
)
inline

Core operation of the factory: Select a production line and invoke the fabrication function.

Parameters
idselect the actual pre installed fabrication function to use
argsadditional arguments to pass to the fabrication.
Note
the template parameter #SIG defines the raw or nominal signature of the fabrication, and especially the number of arguments
Returns
the created product, after passing through the #Wrapper functor

Definition at line 292 of file multifact.hpp.

References MultiFact< SIG, ID, Wrapper >::selectProducer().

Referenced by MultiFact< SIG, ID, Wrapper >::invokeFactory().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ invokeFactory()

template<typename SIG , typename ID , template< class > class Wrapper = PassAsIs>
template<typename... ARGS>
Product invokeFactory ( ID const &  id,
ARGS &&...  args 
)
inline

more legible alias for the function operator

Definition at line 305 of file multifact.hpp.

References MultiFact< SIG, ID, Wrapper >::operator()().

Referenced by QueryDispatcher::handle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ defineProduction()

template<typename SIG , typename ID , template< class > class Wrapper = PassAsIs>
template<typename FUNC >
void defineProduction ( ID  id,
FUNC &&  fun 
)
inline

to set up a production line, associated with a specific ID

Definition at line 316 of file multifact.hpp.

References Fab< SIG, ID >::defineProduction(), and MultiFact< SIG, ID, Wrapper >::funcTable_.

Referenced by MultiFact_test::fed_a_custom_finishing_functor(), MultiFact_test::pass_additional_arguments(), MultiFact_test::produce_simple_values(), MultiFact_test::produce_smart_pointers(), and MultiFactArgument_test::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ empty()

template<typename SIG , typename ID , template< class > class Wrapper = PassAsIs>
bool empty ( ) const
inline

Definition at line 350 of file multifact.hpp.

References Fab< SIG, ID >::empty(), and MultiFact< SIG, ID, Wrapper >::funcTable_.

+ Here is the call graph for this function:

◆ contains()

template<typename SIG , typename ID , template< class > class Wrapper = PassAsIs>
bool contains ( ID  id) const
inline

Definition at line 351 of file multifact.hpp.

References Fab< SIG, ID >::contains(), and MultiFact< SIG, ID, Wrapper >::funcTable_.

Referenced by steam::control::anonymous_namespace{handling-patterns.hpp}::getPatternInstance(), QueryDispatcher::handle(), and MultiFact_test::produce_simple_values().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ funcTable_

template<typename SIG , typename ID , template< class > class Wrapper = PassAsIs>
_Fab funcTable_
private
+ Inheritance diagram for MultiFact< SIG, ID, Wrapper >:
+ Collaboration diagram for MultiFact< SIG, ID, Wrapper >:

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