#include <component.h>

Public Member Functions

 LM_DISABLE_CONSTRUCT (ComponentFactory)

Static Public Member Functions

static auto LoadPlugin (const std::string &path) -> bool
static auto LoadPlugins (const std::string &directory) -> void
static auto UnloadPlugins () -> void
template<typename InterfaceType >
static auto Create (const std::string &key) -> std::unique_ptr< InterfaceType, ReleaseFuncPointerType >
 Create an instance by the key. More...
template<typename InterfaceType >
static auto Create () -> std::unique_ptr< InterfaceType, ReleaseFuncPointerType >
template<typename InterfaceType >
static auto Clone (InterfaceType *p) -> std::unique_ptr< InterfaceType, ReleaseFuncPointerType >

Detailed Description

Component factory.

Instance factory class for component creation. All components are instantiated with this class.

Member Function Documentation

template<typename InterfaceType >
static auto ComponentFactory::Create ( const std::string &  key) -> std::unique_ptr<InterfaceType, ReleaseFuncPointerType>

Create an instance by the key.

Creates an instance of the implementation given a key of the implementation type specified by LM_COMPONENT_REGISTER_IMPL macro. Example:

#include <lightmetrica/film.h>
# Create an instance of Film_HDR
const auto film = ComponentFactory::Create<Film>("film::hdr");
# Now we can use the instance
Template Parameters
InterfaceTypeInterface type of the instance (e.g., Film).
keyKey of the implementation (e.g., film::hdr).