RINGMesh
Version 5.0.0
A programming library for geological model meshes
|
#include <factory.h>
Public Types | |
using | Creator = typename std::add_pointer< std::unique_ptr< BaseClass >(const Args &...) >::type |
using | FactoryStore = std::map< Key, Creator > |
Static Public Member Functions | |
template<typename DerivedClass > | |
static void | register_creator (const Key &key) |
static std::unique_ptr< BaseClass > | create (const Key &key, const Args &... args) |
static std::vector< Key > | list_creators () |
static bool | has_creator (const Key &key) |
Static Private Member Functions | |
template<typename DerivedClass > | |
static std::unique_ptr< BaseClass > | create_function_impl (Args &&... args) |
Static Private Attributes | |
static FactoryStore | store_ |
Generic factory Example of use with A the base class and B, C derived classes // Instantiation using MyFactory = Factory< std::string, A, int, double >; // Registration MyFactory::register_creator< B >( "B" ); // B constructor takes an int and a double MyFactory::register_creator< C >( "C" ); // C constructor takes an int and a double // Creation std::unique_ptr< A > c = MyFactory::create( "C", 2, 8.6 );
using RINGMesh::Factory< Key, BaseClass, Args >::Creator = typename std::add_pointer< std::unique_ptr< BaseClass >( const Args&... ) >::type |
using RINGMesh::Factory< Key, BaseClass, Args >::FactoryStore = std::map< Key, Creator > |
|
inlinestatic |
|
inlinestaticprivate |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
staticprivate |