PLCnext API Documentation 23.6.0.37
|
Factory class for extension modules More...
#include <ModuleFactory.hxx>
Public Types | |
using | ModuleInterfacePtr = std::unique_ptr< TModuleInterface > |
using | FactoryFunction = std::function< ModuleInterfacePtr()> |
using | FactoryFunctions = std::vector< std::pair< String, FactoryFunction > > |
Public Member Functions | |
ModuleFactory (void)=default | |
Constructs an ModuleFactory instance. | |
ModuleFactory (const ModuleFactory &arg)=default | |
Copy constructor. | |
ModuleFactory (ModuleFactory &&arg) noexcept=default | |
Move constructor. | |
ModuleFactory & | operator= (const ModuleFactory &arg)=default |
Copy-assignment operator. | |
ModuleFactory & | operator= (ModuleFactory &&arg) noexcept=default |
Move-assignment operator. | |
virtual | ~ModuleFactory (void) noexcept=default |
Destructs this instance and frees all resources. | |
ModuleInterfacePtr | Create (const String &moduleName) const |
Creates a module instance More... | |
std::vector< String > | GetModuleNames () const |
Returns all known module names | |
void | AddFactoryFunction (const String &moduleName, FactoryFunction function) |
Adds a factory function More... | |
Factory class for extension modules
TModuleInterface | Type of the base class for the modules |
This class is used as an internal factory used by the ModuleLibraryBase.
void Arp::System::Commons::Extensibility::ModuleFactory< TModuleInterface >::AddFactoryFunction | ( | const String & | moduleName, |
FactoryFunction | function | ||
) |
Adds a factory function
moduleName | Name of the module, typically the common type name |
function | Function pointer to the factory function |
Throws an exception if the name is already present.
ModuleFactory< TModuleInterface >::ModuleInterfacePtr Arp::System::Commons::Extensibility::ModuleFactory< TModuleInterface >::Create | ( | const String & | moduleName | ) | const |
Creates a module instance
moduleName | Name of the module, typically the common type name |