PLCnext API Documentation 23.6.0.37
IProgram.hpp
1
2//
3// Copyright PHOENIX CONTACT Electronics GmbH
4//
6#pragma once
8#include "Arp/System/Core/event.hxx"
9
10namespace Arp { namespace Plc { namespace Commons { namespace Esm
11{
12
19{
20public: // usings
22 using Ptr = std::shared_ptr<IProgram>;
24 using EventHandler = delegate<void(void)>;
25
26public: // construction/destruction
28 IProgram(void) = default;
30 virtual ~IProgram(void) = default;
31
32public: // Events
37
38public: // abstract operations
41 virtual const String& GetFullName(void)const = 0;
44 virtual const String& GetTaskName()const = 0;
47 virtual void SetTaskName(const String& value) = 0;
49 virtual void SetInitialValues(void) = 0;
52 virtual void Execute(void) = 0;
54 virtual void AbortRequest(void) = 0;
56 virtual bool IsAbortRequested(void)const = 0;
57
58private: // deleted methods (non-copyable)
59 IProgram(const IProgram& arg) = delete;
60 IProgram& operator=(const IProgram& arg) = delete;
61};
62
63}}}} // end of namespace Arp::Plc::Commons::Esm
Interface to implement PLC program to be executed in realtime context.
Definition: IProgram.hpp:19
virtual ~IProgram(void)=default
Destructs this instance and frees all resouces.
virtual void SetInitialValues(void)=0
Sets all variables of this program to its initial values.
virtual bool IsAbortRequested(void) const =0
Determines if this program is requested to abort.
virtual void SetTaskName(const String &value)=0
Set the task name in which is this program will be executed.
virtual void Execute(void)=0
Executes this program.
IProgram(void)=default
Constructs an IProgram instance.
delegate< void(void)> EventHandler
The Event handler type is executed by the events Executing and Executed.
Definition: IProgram.hpp:24
event< void > Executed
The Executed event is executed after this program is executed by the Execute operation.
Definition: IProgram.hpp:36
virtual void AbortRequest(void)=0
Requests an abort of program execution.
std::shared_ptr< IProgram > Ptr
Shared pointer type of IProgram.
Definition: IProgram.hpp:22
event< void > Executing
The Executing event is invoked before this program is executed by the Execute operation.
Definition: IProgram.hpp:34
virtual const String & GetFullName(void) const =0
Returns the program name with full namespace.
virtual const String & GetTaskName() const =0
Returns the task name in which is this program will be executed.
Use this class to register and invoke several delegates (function pointer in OOP design).
Definition: event.hxx:193
Root namespace for the PLCnext API