PLCnext API Documentation 25.0.2.69
Public Types | Public Member Functions | Protected Member Functions | List of all members
Arp::System::Commons::Extensibility::SharedModuleLibrary< TModuleInterface > Class Template Referenceabstract

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.
 
SharedModuleLibraryoperator= (const SharedModuleLibrary &arg)=delete
 Copy-assignment operator.
 
SharedModuleLibraryoperator= (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 StringGetFullPath () 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...
 

Detailed Description

template<typename TModuleInterface>
class Arp::System::Commons::Extensibility::SharedModuleLibrary< TModuleInterface >

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)

Member Function Documentation

◆ CreateModule() [1/2]

template<typename TModuleInterface >
template<typename TModule >
SharedModuleLibrary< TModuleInterface >::ModuleInterfacePtr Arp::System::Commons::Extensibility::SharedModuleLibrary< TModuleInterface >::CreateModule

Creates a module by type

Template Parameters
TModuleInterfaceType of the module to be created
Returns
owning pointer to the module

This function uses the CommonTypeName of TModule to create the module instance.

◆ CreateModule() [2/2]

template<typename TModuleInterface >
SharedModuleLibrary< TModuleInterface >::ModuleInterfacePtr Arp::System::Commons::Extensibility::SharedModuleLibrary< TModuleInterface >::CreateModule ( const String moduleName) const

Creates a module by name

Parameters
moduleNamename of the module to be created
Returns
owning pointer to the module

As a convention use the CommonTypeName as the module name.

◆ GetModuleLibraryFactoryFunctionName()

template<typename TModuleInterface >
virtual String Arp::System::Commons::Extensibility::SharedModuleLibrary< TModuleInterface >::GetModuleLibraryFactoryFunctionName ( ) const
protectedpure virtual

Returns the name of the factory function for the module library

see ModuleLibraryBase for an example

◆ Load()

template<typename TModuleInterface >
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.


The documentation for this class was generated from the following file: