PLCnext API Documentation  21.0.0.35466
ThreadConfigs.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 #include "Arp/System/Commons/Configuration/ThreadConfig.hpp"
10 
11 #include <list>
12 
13 namespace Arp { namespace System { namespace Commons { namespace Configuration
14 {
15 
16 using namespace Arp::System::Commons::Xml;
17 
18 class ThreadConfigs : public IXmlSerializable, private Loggable<ThreadConfigs>
19 {
20 public: // typedefs
21  using Items = std::list<ThreadConfig>;
22 
23 public: // construction/destruction
25  ThreadConfigs(void) = default;
27  ThreadConfigs(const ThreadConfigs& arg) = delete;
29  ThreadConfigs(ThreadConfigs&& arg) = delete;
31  ~ThreadConfigs(void) = default;
32 
33 public: // setter/getter operations
34  Items& GetItems();
35  bool TryGetThreadConfig(const String& threadName, ThreadConfig::ConstPtr& threadConfig)const;
36  const ThreadConfig& GetThreadConfig(const String& threadName)const;
37 
38 public: // operations
39  void Clear(void);
40 
41 public: // IXmlSerializable operations
42  void ReadXml(XmlReader& reader, XmlSerializationContext& context)override;
43  void WriteXml(XmlWriter& writer, XmlSerializationContext& context)override;
44 
45 private: // static fields
46  static const char* XmlElementName;
47 
48 private: // fields
49  Items items;
50 };
51 
53 // inline methods of class ThreadConfigs
54 inline void ThreadConfigs::Clear()
55 {
56  this->items.clear();
57 }
58 
59 inline ThreadConfigs::Items& ThreadConfigs::GetItems()
60 {
61  return this->items;
62 }
63 
64 }}}} // end of namespace Arp::System::Commons::Configuration
Namespace for classes to read XML files
Definition: ConfigHeader.hpp:11
Class to write an XML File
Definition: XmlWriter.hpp:20
Interface for all classes which should be serializable for xml
Definition: IXmlSerializable.hpp:17
Root namespace for the PLCnext API
Class to read an XML File. Non buffered reader, can only read forward
Definition: XmlReader.hpp:22
System components used by the System, Device, Plc or Io domains.
XML context used during XML reading and writing to hold the context information
Definition: XmlSerializationContext.hpp:25