PLCnext API Documentation  22.9.0.33
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 More...
 

Public Member Functions

 SharedModuleLibrary (const String &path)
 Constructs an SharedModuleLibrary instance. More...
 
 SharedModuleLibrary (const SharedModuleLibrary &arg)=delete
 Copy constructor. More...
 
 SharedModuleLibrary (SharedModuleLibrary &&arg)=delete
 Move constructor. More...
 
SharedModuleLibraryoperator= (const SharedModuleLibrary &arg)=delete
 Copy-assignment operator. More...
 
SharedModuleLibraryoperator= (SharedModuleLibrary &&arg)=delete
 Move-assignment operator. More...
 
virtual ~SharedModuleLibrary (void)=default
 Destructs this instance and frees all resources. More...
 
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 More...
 
String GetFileName () const
 Returns the file name of the library (without directory) More...
 
bool Exists () const
 Returns true if the library file exists. More...
 
bool IsLoaded () const
 Returns true if the library is loaded More...
 
void Load ()
 Loads the library More...
 
void Unload ()
 Unload the library More...
 

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 Typedef Documentation

◆ ModuleInterfacePtr

template<typename TModuleInterface >
using Arp::System::Commons::Extensibility::SharedModuleLibrary< TModuleInterface >::ModuleInterfacePtr = std::unique_ptr<TModuleInterface>

owning pointer to a module

Constructor & Destructor Documentation

◆ SharedModuleLibrary() [1/3]

template<typename TModuleInterface >
Arp::System::Commons::Extensibility::SharedModuleLibrary< TModuleInterface >::SharedModuleLibrary ( const String path)
explicit

Constructs an SharedModuleLibrary instance.

◆ SharedModuleLibrary() [2/3]

template<typename TModuleInterface >
Arp::System::Commons::Extensibility::SharedModuleLibrary< TModuleInterface >::SharedModuleLibrary ( const SharedModuleLibrary< TModuleInterface > &  arg)
delete

Copy constructor.

◆ SharedModuleLibrary() [3/3]

template<typename TModuleInterface >
Arp::System::Commons::Extensibility::SharedModuleLibrary< TModuleInterface >::SharedModuleLibrary ( SharedModuleLibrary< TModuleInterface > &&  arg)
delete

Move constructor.

◆ ~SharedModuleLibrary()

template<typename TModuleInterface >
virtual Arp::System::Commons::Extensibility::SharedModuleLibrary< TModuleInterface >::~SharedModuleLibrary ( void  )
virtualdefault

Destructs this instance and frees all resources.

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

param name="moduleName">name of the module to be created

Returns
owning pointer to the module

As a convention use the CommonTypeName as the module name.

◆ Exists()

template<typename TModuleInterface >
bool Arp::System::Commons::Extensibility::SharedModuleLibrary< TModuleInterface >::Exists

Returns true if the library file exists.

◆ GetFileName()

template<typename TModuleInterface >
String Arp::System::Commons::Extensibility::SharedModuleLibrary< TModuleInterface >::GetFileName

Returns the file name of the library (without directory)

◆ GetFullPath()

template<typename TModuleInterface >
const String & Arp::System::Commons::Extensibility::SharedModuleLibrary< TModuleInterface >::GetFullPath

Returns the full path to the library file

◆ 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

◆ IsLoaded()

template<typename TModuleInterface >
bool Arp::System::Commons::Extensibility::SharedModuleLibrary< TModuleInterface >::IsLoaded

Returns true if the library is loaded

◆ 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.

◆ operator=() [1/2]

template<typename TModuleInterface >
SharedModuleLibrary& Arp::System::Commons::Extensibility::SharedModuleLibrary< TModuleInterface >::operator= ( const SharedModuleLibrary< TModuleInterface > &  arg)
delete

Copy-assignment operator.

◆ operator=() [2/2]

template<typename TModuleInterface >
SharedModuleLibrary& Arp::System::Commons::Extensibility::SharedModuleLibrary< TModuleInterface >::operator= ( SharedModuleLibrary< TModuleInterface > &&  arg)
delete

Move-assignment operator.

◆ Unload()

template<typename TModuleInterface >
void Arp::System::Commons::Extensibility::SharedModuleLibrary< TModuleInterface >::Unload ( void  )

Unload the library


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