PLCnext API Documentation 25.0.2.69
ProgramProviderBase.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/System/Core/event.hxx"
9#include "Arp/Plc/Commons/Esm/IProgramProvider.hpp"
10#include <map>
11
12namespace Arp { namespace Plc { namespace Commons { namespace Esm
13{
14
16{
17public: // typedefs/usings
18 using Programs = std::map<String, IProgram::Ptr>; // [ProgramName, ProgramPtr]
19
20private: // typedefs/usings
21 using ProgramTypes = std::map<String, String>; // [ProgramName, ProgramTypeName]
22
23public: // construction/destruction
25 ProgramProviderBase(void) = default;
31 ~ProgramProviderBase(void) = default;
32
33public: // events
34 event<IProgram::Ptr> ProgramAdded;
35 event<IProgram::Ptr> ProgramRemoved;
36
37public: // setter/getter operations
38 Programs& GetPrograms(void);
39 const Programs& GetPrograms(void)const;
40
41public: // operations
42 bool RemoveProgram(IProgram& program);
43
44public: // IProgramProvider operations to override
45 IProgram::Ptr CreateProgram(const String& programName, const String& programType)override;
46 void Reset(void)override;
47
48protected: // abstract operations to override (templated method design pattern)
49 virtual IProgram::Ptr CreateProgramInternal(const String& programName, const String& programType) = 0;
50
51protected: // operations
52
53private: // methods
54
55private: // fields
56 Programs programs;
57 ProgramTypes programTypes;
58};
59
60}}}} // end of namespace Arp::Plc::Commons::Esm
This class represents the Arp String. The implementation is based on std::string.
Definition: String.hpp:39
Use this class to register and invoke several delegates (function pointer in OOP design).
Definition: event.hxx:32
Interface to realizes an program provider.
Definition: IProgramProvider.hpp:17
Interface to implement PLC program to be executed in realtime context.
Definition: IProgram.hpp:19
std::shared_ptr< IProgram > Ptr
Shared pointer type of IProgram.
Definition: IProgram.hpp:22
Definition: ProgramProviderBase.hpp:16
~ProgramProviderBase(void)=default
Destructs this instance and frees all resources.
IProgram::Ptr CreateProgram(const String &programName, const String &programType) override
Creates an instance of an program type.
Definition: ProgramProviderBase.cpp:12
ProgramProviderBase(const ProgramProviderBase &arg)=default
Copy constructor.
ProgramProviderBase(void)=default
Constructs an ProgramProviderBase instance.
ProgramProviderBase & operator=(const ProgramProviderBase &arg)=default
Assignment operator.
void Reset(void) override
Resets the program provider.
Definition: ProgramProviderBase.cpp:56
Root namespace for the PLCnext API