Lumiera  0.pre.03
»edit your freedom«
ConfigSelector< Factory, FUNC, PAR > Class Template Reference

#include "steam/engine/nodewiring-config.hpp"

Description

template<template< class CONF > class Factory, typename FUNC, typename PAR>
class steam::engine::config::ConfigSelector< Factory, FUNC, PAR >

Helper for fabricating ProcNode Wiring configurations.

This object builds a table of factories, holding one factory for each possible node configuration. Provided with the desired configuration encoded as bits, the related factory can be invoked, thus producing a product object for the given configuration.

implementation notes
The actual factory class is templated, so it will be defined at the use site of ConfigSelector. Moreover, this factory usually expects an ctor argument, which will be fed through when creating the ConfigSelector instance. This is one of the reasons why we go through all these complicated factory building: this ctor argument usually brings in a reference to the actual memory allocator. Thus we have to rebuild the ConfigSelector each time we switch and rebuild the ProcNode factories, which in turn happens each time we use a new bulk allocation memory block – typically for each separate segment of the Timeline and processing node graph.

Now the selection of the possible flag configurations, for which Factory instances are created in the table, is governed by the type parameter of the ConfigSelector ctor. This type parameter needs to be a Typelist of Typelists, each representing a flag configuration. The intention is to to drive this selection by the use of template metaprogramming for extracting all currently defined StateProxy object configurations.

Todo:
as the factories live only within the enclosed table (map) we could allocate them in-place. Unfortunately this is non-trivial, because the STL containers employ value semantics and thus do a copy even on insert. Thus, for now we use a shared_ptr to hold the factory heap allocated. —> see Ticket #248

Definition at line 105 of file nodewiring-config.hpp.

Public Member Functions

template<class CONFS >
 ConfigSelector (CONFS const &, PAR factory_ctor_param)
 
FacFunction & operator[] (IxID configFlags)
 

Classes

struct  FactoryHolder
 < impl type erasure More...
 
struct  FactoryTableBuilder
 Helper: a visitor usable with FlagInfo. More...
 

Private Types

typedef std::map< IxID, PFuncConfigTable
 
typedef std::function< FUNC > FacFunction
 
typedef std::shared_ptr< FacFunction > PFunc
 

Private Attributes

ConfigTable possibleConfig_
 Table of factories.
 

Member Function Documentation

◆ operator[]()

FacFunction& operator[] ( IxID  configFlags)
inline
Parameters
configFlagsretrieve the factory corresponding to the given config

Definition at line 167 of file nodewiring-config.hpp.

+ Inheritance diagram for ConfigSelector< Factory, FUNC, PAR >:
+ Collaboration diagram for ConfigSelector< Factory, FUNC, PAR >:

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