PLCnext API Documentation 23.6.0.37
ModuleLibraryBase.hxx
1
2//
3// Copyright PHOENIX CONTACT Electronics GmbH
4//
6#pragma once
8#include "Arp/System/Core/AppDomain.hpp"
9#include "Arp/System/Commons/Diagnostics/Logging/LogManager.hpp"
10#include "Arp/System/Commons/Extensibility/ModuleFactory.hxx"
11
12namespace Arp { namespace System { namespace Commons { namespace Extensibility
13{
14
15
16
32template<typename TModuleInterface>
34{
35protected: // construction/destruction
37 explicit ModuleLibraryBase(AppDomain& appDomain);
39 ModuleLibraryBase(const ModuleLibraryBase& arg) = default;
41 ModuleLibraryBase(ModuleLibraryBase&& arg) noexcept = default;
45 ModuleLibraryBase& operator=(ModuleLibraryBase&& arg) noexcept = default;
47 virtual ~ModuleLibraryBase(void) noexcept = default;
48
49
50public: // operations
54
55protected:
59
60private: // fields
62};
63
64template<typename TModuleInterface>
66{
68
69 // just assign the as argument passed appDomain to the appDomain singleton of this library (only
70 // important for DLLs)
71 AppDomain::Assign(appDomain);
72
73 // must assign other appDomain explicitly to log engine, because log4cplus uses own static
74 // variables (e.g. defaultContext)
75 LogManager::AssignAppDomain(appDomain);
76}
77
78template<typename TModuleInterface>
80{
81 return this->factory;
82}
83
84template<typename TModuleInterface>
86{
87 return this->factory;
88}
89
90}}}} // namespace Arp::System::Commons::Extensibility
This class represents a single application domain for each process and is implemented as singleton.
Definition: AppDomain.hpp:119
static void Assign(AppDomain &other)
Assgins the current AppdDomain singleton from the as argument passed other.
Definition: AppDomain.hpp:279
Factory class for extension modules
Definition: ModuleFactory.hxx:20
Base class for a library providing extension modules
Definition: ModuleLibraryBase.hxx:34
ModuleLibraryBase(const ModuleLibraryBase &arg)=default
Copy constructor.
virtual ~ModuleLibraryBase(void) noexcept=default
Destructs this instance and frees all resources.
ModuleLibraryBase(ModuleLibraryBase &&arg) noexcept=default
Move constructor.
ModuleLibraryBase(AppDomain &appDomain)
Constructs an ModuleLibraryBase instance.
Definition: ModuleLibraryBase.hxx:65
ModuleLibraryBase & operator=(ModuleLibraryBase &&arg) noexcept=default
Move-assignment operator.
ModuleLibraryBase & operator=(const ModuleLibraryBase &arg)=default
Copy-assignment operator.
const ModuleFactory< TModuleInterface > & GetFactory() const
Returns a const reference to the ModuleFactory
Definition: ModuleLibraryBase.hxx:79
@ System
System components used by the System, Device, Plc or Io domains.
Namespace for logging classes
Definition: LogAdapter.hpp:20
Root namespace for the PLCnext API