PLCnext API Documentation 25.0.2.69
|
Base class for loading a library with modules More...
#include <SharedModuleLibrary.hxx>
Public Types | |
using | ModuleInterfacePtr = std::unique_ptr< TModuleInterface > |
owning pointer to a module | |
Public Member Functions | |
SharedModuleLibrary (const String &path, SharedLibraryMemoryLockOption sharedLibraryMemoryLockOption=SharedLibraryMemoryLockOption::Nothing) | |
Constructs an SharedModuleLibrary instance. | |
SharedModuleLibrary (const SharedModuleLibrary &arg)=delete | |
Copy constructor. | |
SharedModuleLibrary (SharedModuleLibrary &&arg)=delete | |
Move constructor. | |
SharedModuleLibrary & | operator= (const SharedModuleLibrary &arg)=delete |
Copy-assignment operator. | |
SharedModuleLibrary & | operator= (SharedModuleLibrary &&arg)=delete |
Move-assignment operator. | |
virtual | ~SharedModuleLibrary (void)=default |
Destructs this instance and frees all resources. | |
template<typename TModule > | |
ModuleInterfacePtr | CreateModule () const |
Creates a module by type More... | |
ModuleInterfacePtr | CreateModule (const String &moduleName) const |
Creates a module by name More... | |
const String & | GetFullPath () const |
Returns the full path to the library file | |
String | GetFileName () const |
Returns the file name of the library (without directory) | |
bool | Exists () const |
Returns true if the library file exists. | |
bool | IsLoaded () const |
Returns true if the library is loaded | |
void | Load () |
Loads the library More... | |
void | Unload () |
Unload the library | |
Protected Member Functions | |
virtual String | GetModuleLibraryFactoryFunctionName () const =0 |
Returns the name of the factory function for the module library More... | |
Base class for loading a library with modules
This class contains code related to the type of the modules to be created. Implement GetModuleLibraryFactoryFunction() to return the name of the factory function of the module library. (see ModuleLibraryBase for an example)
SharedModuleLibrary< TModuleInterface >::ModuleInterfacePtr Arp::System::Commons::Extensibility::SharedModuleLibrary< TModuleInterface >::CreateModule |
Creates a module by type
TModuleInterface | Type of the module to be created |
This function uses the CommonTypeName of TModule to create the module instance.
SharedModuleLibrary< TModuleInterface >::ModuleInterfacePtr Arp::System::Commons::Extensibility::SharedModuleLibrary< TModuleInterface >::CreateModule | ( | const String & | moduleName | ) | const |
Creates a module by name
moduleName | name of the module to be created |
As a convention use the CommonTypeName as the module name.
|
protectedpure virtual |
Returns the name of the factory function for the module library
see ModuleLibraryBase for an example
void Arp::System::Commons::Extensibility::SharedModuleLibrary< TModuleInterface >::Load |
Loads the library
When the library is loaded LoadModuleLibraryBase is called to get the factory function of the module library object. That object acts as an entry point to the library.