PLCnext API Documentation 25.0.2.69
IoComponentBase.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/Base/Core/PimplPtr.hxx"
9#include "Arp/Base/Core/Endianness.hpp"
10#include "Arp/Base/Acf/Commons/ComponentBase.hpp"
11#include "Arp/Plc/Domain/Commons/IPlcComponent.hpp"
12#include "Arp/Plc/Meta/Commons/IIoMetaComponent.hpp"
13
14namespace Arp::Io::Commons
15{
16// forwards
17class IoLibraryBase;
18class DataManager;
19
20// type imports
27
45class ARP_EXPORT IoComponentBase
46 : public ComponentBase
47 , public IPlcComponent
48 , public IIoMetaComponent
49{
50public: // Impl forward declaration
51 class Impl;
52
53public: // canonical construction/destruction/assignment
54 IoComponentBase(const IoComponentBase& arg) = delete;
56 IoComponentBase& operator=(const IoComponentBase& arg) = delete;
58 ~IoComponentBase(void)override;
59
60public: // construction
62 IoLibraryBase& library,
63 const String& fullName,
64 Endianness endianness = Endianness::Current,
65 uint32 startOrderOffset = 0);
66
67public: // setter/getter operations
68 Endianness GetDefaultEndianness(void)const;
69
70public: // IComponent operations
71 void Initialize(void)final;
72 void SubscribeServices(void)final;
73 void LoadSettings(const String& settingsPath)final;
74 void SetupSettings(void)final;
75 void PublishServices(void)final;
76 void LoadConfig(void)final;
77 void SetupConfig(void)final;
78 void ResetConfig(void)final;
79 void Dispose(void)final;
80 void PowerDown(void)final;
81
82public: // IPlcComponent operations
83 DcgResultInfo LoadPlc(bool isChanging)final;
84 DcgResultInfo SetupPlc(bool isChanging, PlcStartKind startKind)final;
85 void StartPlc(PlcStartKind startKind)final;
86 void StopPlc(void)final;
87 void ResetPlc(bool isChanging, bool onError)final;
88 void UnloadPlc(bool isChanging, bool onError)final;
89
90public: // IIoMetaComponent operations
91 VariableRegistry& GetVariableRegistry(void)final;
92
93protected: // getter/setter
94 DataManager& GetDataManager(void);
95
96protected: // Templated operations to override for specialized IComponent implementations
97 virtual void InitializeInternal(void);
98 virtual void SubscribeServicesInternal(void);
99 virtual void LoadSettingsInternal(const String& settingsPath);
100 virtual void SetupSettingsInternal(void);
101 virtual void PublishServicesInternal(void);
102 virtual void LoadConfigInternal(void);
103 virtual void SetupConfigInternal(void);
104 virtual void ResetConfigInternal(void);
105 virtual void DisposeInternal(void);
106 virtual void PowerDownInternal(void);
107
108protected: // Templated operations for specializing IPlcComponent operations
109 virtual DcgResultInfo LoadPlcInternal(bool isChanging);
110 virtual DcgResultInfo SetupPlcInternal(bool isChanging, PlcStartKind startKind);
111 virtual void StartPlcInternal(PlcStartKind startKind);
112 virtual void StopPlcInternal(void);
113 virtual void ResetPlcInternal(bool isChanging, bool onError);
114 virtual void UnloadPlcInternal(bool isChanging, bool onError);
115
116public: // Impl operations
117 Impl& GetImpl(void);
118 const Impl& GetImpl(void)const;
119
120private: // Impl usings
121 using Pimpl = PimplPtr<Impl>;
122
123private: // Impl fields
124 Pimpl pimpl;
125};
126
127} // end of namespace Arp::Io::Commons::Io
Use this class as base class of all Acf components.
Definition: ComponentBase.hpp:20
Adapter class to implement PImpl idiom.
Definition: PimplPtr.hxx:15
This class represents the Arp String. The implementation is based on std::string.
Definition: String.hpp:39
This class is used to store and to manage fieldbus frame buffer objects.
Definition: DataManager.hpp:59
This class shall be used as a base class for all IO components.
Definition: IoComponentBase.hpp:49
~IoComponentBase(void) override
THe default destructor.
IoComponentBase & operator=(IoComponentBase &&arg) noexcept
The move assignment operator.
IoComponentBase(IoComponentBase &&arg) noexcept
The move constructor.
Base class for libraries of IO components
Definition: IoLibraryBase.hpp:18
This class is used to return the result of a PLC operation concerning download-changes (Dcg).
Definition: DcgResultInfo.hpp:21
This is the most important interface of the PLC domain. It is used to load and unload the PLC project...
Definition: IPlcComponent.hpp:29
Interface for all components providing IO related meta data
Definition: IIoMetaComponent.hpp:24
This class is used to register IO variables
Definition: VariableRegistry.hpp:20
std::uint32_t uint32
The Arp unsigned integer type of 4 byte size.
Definition: PrimitiveTypes.hpp:33
Namespace for interface types of the IO domain
PlcStartKind
Determines which kind of start operation is initiated using PlcManager::StartPlc(PlcStartKind startKi...
Definition: PlcStartKind.hpp:18
DcgResult
The result of a PLC download-changes operation.
Definition: DcgResult.hpp:19