Lumiera  0.pre.03
»edit your freedom«
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 262 of file multifact.hpp.

Public Types

using Product = typename _Conf::WrappedProduct
 

Public Member Functions

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

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...
 

Protected Types

using Creator = typename _Fab::FactoryFunc
 

Protected Member Functions

Creator & selectProducer (ID const &id)
 

Private Types

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

Private Attributes

_Fab funcTable_
 

Member Function Documentation

◆ operator()()

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 296 of file multifact.hpp.

+ 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: