PLCnext API Documentation 25.6.0.37
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::Configuration
15{
16class TicConfiguration;
17}
18
19namespace Arp::Io::Commons
20{
21// forwards
22class IoLibraryBase;
23class DataManager;
24
25// type imports
32
50class ARP_EXPORT IoComponentBase
51 : public ComponentBase
52 , public IPlcComponent
53 , public IIoMetaComponent
54{
55public: // Impl forward declaration
56 class Impl;
57
58public: // usings
60
61public: // canonical construction/destruction/assignment
62 IoComponentBase(const IoComponentBase& arg) = delete;
64 IoComponentBase& operator=(const IoComponentBase& arg) = delete;
66 ~IoComponentBase(void)override;
67
68public: // construction
70 IoLibraryBase& library,
71 const String& fullName,
72 Endianness endianness = Endianness::Current,
73 uint32 startOrderOffset = 0);
74
75public: // setter/getter operations
76 Endianness GetDefaultEndianness(void)const;
77
78public: // IComponent operations
79 void Initialize(void)final;
80 void SubscribeServices(void)final;
81 void LoadSettings(const String& settingsPath)final;
82 void SetupSettings(void)final;
83 void PublishServices(void)final;
84 void LoadConfig(void)final;
85 void SetupConfig(void)final;
86 void ResetConfig(void)final;
87 void Dispose(void)final;
88 void PowerDown(void)final;
89
90public: // IPlcComponent operations
91 DcgResultInfo LoadPlc(bool isChanging)final;
92 DcgResultInfo SetupPlc(bool isChanging, PlcStartKind startKind)final;
93 void StartPlc(PlcStartKind startKind)final;
94 void StopPlc(void)final;
95 void ResetPlc(bool isChanging, bool onError)final;
96 void UnloadPlc(bool isChanging, bool onError)final;
97
98public: // IIoMetaComponent operations
99 VariableRegistry& GetVariableRegistry(void)final;
100
101protected: // getter/setter
102 DataManager& GetDataManager(void);
103
104public: // operations
105 DcgResultInfo Setup(const TicConfiguration& configuration, bool isChanging = false);
106
107protected: // Templated operations to override for specialized IComponent implementations
108 virtual void InitializeInternal(void);
109 virtual void SubscribeServicesInternal(void);
110 virtual void LoadSettingsInternal(const String& settingsPath);
111 virtual void SetupSettingsInternal(void);
112 virtual void PublishServicesInternal(void);
113 virtual void LoadConfigInternal(void);
114 virtual void SetupConfigInternal(void);
115 virtual void ResetConfigInternal(void);
116 virtual void DisposeInternal(void);
117 virtual void PowerDownInternal(void);
118
119protected: // Templated operations for specializing IPlcComponent operations
120 virtual DcgResultInfo LoadPlcInternal(bool isChanging);
121 virtual DcgResultInfo SetupPlcInternal(bool isChanging, PlcStartKind startKind);
122 virtual void StartPlcInternal(PlcStartKind startKind);
123 virtual void StopPlcInternal(void);
124 virtual void ResetPlcInternal(bool isChanging, bool onError);
125 virtual void UnloadPlcInternal(bool isChanging, bool onError);
126
127public: // Impl operations
128 Impl& GetImpl(void);
129 const Impl& GetImpl(void)const;
130
131private: // Impl usings
132 using Pimpl = PimplPtr<Impl>;
133
134private: // Impl fields
135 Pimpl pimpl;
136};
137
138} // 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 reads and stores a complete Tic hierarchy defined by a Tic links file.
Definition: TicConfiguration.hpp:38
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:54
~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:21
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