![]() |
ImFusion SDK 4.3
|
#include <ImFusion/CT/GenericFactory.h>
Generic factory class for registering polymorphic types. More...
Generic factory class for registering polymorphic types.
Usage:
In this situation you can register DerivedItems as follow: 1) Using the direct constructor:
2) Using a builder function:
Public Types | |
| using | CreatorRegistry = std::unordered_map<std::string, detail::Creator<Base, Params...>*> |
| template<typename Derived> | |
| using | BuilderFunc = typename detail::CreatorImpl<Derived, Base, Params...>::BuilderFunc |
| template<typename Derived> | |
| using | CompatibleFunc = typename detail::CreatorImpl<Derived, Base, Params...>::CompatibleFunc |
Public Member Functions | |
| virtual std::unique_ptr< Base > | create (const std::string &name, Params &&... params) const |
| virtual bool | isCompatible (const std::string &name, const Params &... params) const |
| virtual std::vector< std::string > | availableTypes () const |
| virtual std::vector< std::string > | compatibleTypes (const Params &... params) const |
| virtual bool | hasType (const std::string &name) const |
| template<typename Derived> | |
| void | registerType (const std::string &name, BuilderFunc< Derived > builder, CompatibleFunc< Derived > compatibleFunc=CompatibleFunc< Derived >{}) |
| Register a creator function associated to a specific key. | |
| template<typename Derived, typename = typename std::enable_if<std::is_constructible<Derived, Params...>::value>::type> | |
| void | registerType (const std::string &name) |
| Sfinae based register function for registration of object that can be directly constructed from Params... | |
Protected Attributes | |
| CreatorRegistry | m_registry |