PLCnext API Documentation  21.9.0.40
IComponent.hpp
1 //
3 // Copyright PHOENIX CONTACT Electronics GmbH
4 //
6 #pragma once
7 #include "Arp/System/Core/Arp.h"
8 #include "Arp/System/Acf/ILibrary.hpp"
9 #include "Arp/System/Acf/ComponentCategory.hpp"
10 #include <map>
11 #include <memory>
12 
13 namespace Arp { namespace System { namespace Acf
14 {
15 
16 // forwards
17 class IApplication;
18 class IControllerComponent; // for doxygen only
19 
81 {
82 public: // typedefs
84  typedef std::shared_ptr<IComponent> Ptr;
86  typedef std::map<String, IComponent::Ptr> Dictionary;
87 
88 protected: // construction/destruction
90  IComponent(void) = default;
92  virtual ~IComponent(void) = default;
93 
94 public: // abstract property getter to override
96  virtual IApplication& GetApplication(void)const = 0;
98  virtual ILibrary& GetLibrary(void)const = 0;
101  virtual String GetFullName(void)const = 0;
105  virtual Version GetVersion(void)const = 0;
108  virtual ComponentCategory GetComponentCategory(void)const = 0;
115  virtual uint32 GetStartOrder(void) const = 0;
118  virtual bool IsSingleton(void)const = 0;
121  virtual bool IsRequired(void)const = 0;
122 
123 public: // abstract operations to override
126  virtual void Initialize(void) = 0;
129  virtual void SubscribeServices(void) = 0;
132  virtual void LoadSettings(const String& settingsPath) = 0;
135  virtual void SetupSettings(void) = 0;
138  virtual void PublishServices(void) = 0;
141  virtual void LoadConfig(void) = 0;
144  virtual void SetupConfig(void) = 0;
150  virtual void ResetConfig(void) = 0;
157  virtual void Dispose(void) = 0;
164  virtual void PowerDown(void) = 0;
165 
166 private: // methods
167  IComponent(const IComponent& arg) = delete;
168  IComponent& operator=(const IComponent& arg) = delete;
169 };
170 
172 // inline methods of class IComponent
173 
174 }}} // end of namesapce Arp::System::Acf
virtual void PublishServices(void)=0
Publishes components services.
virtual String GetFullName(void) const =0
Gets the full qualified name of this component
std::shared_ptr< IComponent > Ptr
The pointer type of this interface.
Definition: IComponent.hpp:84
virtual void ResetConfig(void)=0
Resets components project configuration.
Any Acf Library shall implement this interface.
Definition: ILibrary.hpp:21
std::uint32_t uint32
The Arp unsigned integer type of 4 byte size.
Definition: PrimitiveTypes.hpp:35
This is the most important basic interface of the Arp platform. Any component shall implement this in...
Definition: IComponent.hpp:80
virtual void Dispose(void)=0
Disposes component.
virtual ~IComponent(void)=default
The default destructor.
This interface shall be implemented by the application class.
Definition: IApplication.hpp:18
virtual void LoadSettings(const String &settingsPath)=0
Loads components firmware settings.
This class represents the version of a special SDK or Arp build.
Definition: BasicVersion.hpp:34
virtual void SubscribeServices(void)=0
Subscribes services required by this component.
virtual uint32 GetStartOrder(void) const =0
Gets the start order of this component.
virtual bool IsSingleton(void) const =0
Determines if this component is a singleton, that is, it&#39;s instantiated only once on the entire syste...
Root namespace for the PLCnext API
std::map< String, IComponent::Ptr > Dictionary
A map of components where the key is the name of the component.
Definition: IComponent.hpp:86
virtual Version GetVersion(void) const =0
Gets the version of this component which defaults to the build version of the related library...
virtual ILibrary & GetLibrary(void) const =0
Gets the library instance of this component.
IComponent(void)=default
The default constructor.
ComponentCategory
This enumeration determines the category of a component.
Definition: ComponentCategory.hpp:14
virtual void PowerDown(void)=0
This operation is called on a power breakdown event and executes component specific actions when powe...
virtual void Initialize(void)=0
Initializes this component: creates singletons, makes any registrations, creates any resources not de...
virtual IApplication & GetApplication(void) const =0
Gets the applicatopn instance of the actual process which loaded this component.
virtual void SetupConfig(void)=0
Sets up components configuration which was loaded in LoadConfig.
virtual bool IsRequired(void) const =0
Determines if this component is required.
System components used by the System, Device, Plc or Io domains.
virtual void LoadConfig(void)=0
Loads components project configuration.
virtual void SetupSettings(void)=0
Sets up components settings which were loaded in LoadSettings.
virtual ComponentCategory GetComponentCategory(void) const =0
Gets the ComponentCategory of this component.