PLCnext API Documentation  22.9.0.33
ThreadConfig.hpp
1 //
3 // Copyright PHOENIX CONTACT Electronics GmbH
4 //
6 #pragma once
7 #include "Arp/System/Core/Arp.h"
8 #include "Arp/System/Commons/Xml/IXmlSerializable.hpp"
9 
10 namespace Arp { namespace System { namespace Commons { namespace Threading
11 {
12 // Forwards
13 class ThreadSettings;
14 }}}} // end of Arp::System::Commons::Threading
15 
16 namespace Arp { namespace System { namespace Commons { namespace Configuration
17 {
18 
19 using namespace Arp::System::Commons::Xml;
20 
21 class ThreadConfig : public IXmlSerializable, private Loggable<ThreadConfig>
22 {
23 public: // typedefs
24  using ConstPtr = const ThreadConfig*;
25 
26 public: // construction/destruction
28  ThreadConfig(void) = default;
30  ThreadConfig(const ThreadConfig& arg) = default;
32  ThreadConfig(ThreadConfig&& arg) = default;
34  ~ThreadConfig(void) = default;
35 
36 public: // operations
39 
40 public: // setter/getter operations
41  const String& GetName()const;
42  size_t GetPriority()const;
43  size_t GetCpuAffinity()const;
44  size_t GetStackSize()const;
45 
46 public: // IXmlSerializable operations
47  void ReadXml(XmlReader& reader, XmlSerializationContext& context)override;
48  void WriteXml(XmlWriter& writer, XmlSerializationContext& context)override;
49 
50 private: // fields
51  String name;
52  size_t priority;
53  size_t cpuAffinity;
54  size_t stackSize;
55 };
56 
58 // inline methods of class ThreadConfig
59 inline const String& ThreadConfig::GetName()const
60 {
61  return this->name;
62 }
63 
64 inline size_t ThreadConfig::GetPriority()const
65 {
66  return this->priority;
67 }
68 
69 inline size_t ThreadConfig::GetCpuAffinity()const
70 {
71  return this->cpuAffinity;
72 }
73 
74 inline size_t ThreadConfig::GetStackSize()const
75 {
76  return this->stackSize;
77 }
78 
79 }}}} // end of namespace Arp::System::Commons::Configuration
ThreadConfig(const ThreadConfig &arg)=default
Copy constructor.
void ReadXml(XmlReader &reader, XmlSerializationContext &context) override
ReadXML must be implemented by all classes which should read its context from xml files
~ThreadConfig(void)=default
Destructs this instance and frees all resources.
ThreadConfig(void)=default
Constructs an ThreadConfig instance.
ThreadConfig(ThreadConfig &&arg)=default
Move constructor.
ThreadSettings CreateThreadSettings() const
Returns an ThreadSettings instance.
Container class for adaptable thread settings.
Definition: ThreadSettings.hpp:13
Interface for all classes which should be serializable for xml
Definition: IXmlSerializable.hpp:18
Class to read an XML File. Non buffered reader, can only read forward
Definition: XmlReader.hpp:25
XML context used during XML reading and writing to hold the context information
Definition: XmlSerializationContext.hpp:26
Class to write an XML File
Definition: XmlWriter.hpp:21
@ System
System components used by the System, Device, Plc or Io domains.
Namespace for classes to read XML files
Definition: ConfigHeader.hpp:12
Root namespace for the PLCnext API