PLCnext API Documentation 23.6.0.37
ThreadConfigs.hpp
1
2//
3// Copyright PHOENIX CONTACT Electronics GmbH
4//
6#pragma once
8#include "Arp/System/Commons/Xml/IXmlSerializable.hpp"
9#include "Arp/System/Commons/Configuration/ThreadConfig.hpp"
10
11#include <list>
12
13namespace Arp { namespace System { namespace Commons { namespace Configuration
14{
15
16using namespace Arp::System::Commons::Xml;
17
18class ThreadConfigs : public IXmlSerializable, private Loggable<ThreadConfigs>
19{
20public: // typedefs
21 using Items = std::list<ThreadConfig>;
22
23public: // construction/destruction
25 ThreadConfigs(void) = default;
27 ThreadConfigs(const ThreadConfigs& arg) = delete;
31 ~ThreadConfigs(void) = default;
32
33public: // 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
38public: // operations
39 void Clear(void);
40
41public: // IXmlSerializable operations
42 void ReadXml(XmlReader& reader, XmlSerializationContext& context)override;
43 void WriteXml(XmlWriter& writer, XmlSerializationContext& context)override;
44
45private: // static fields
46 static const char* XmlElementName;
47
48private: // fields
49 Items items;
50};
51
53// inline methods of class ThreadConfigs
54inline void ThreadConfigs::Clear()
55{
56 this->items.clear();
57}
58
59inline ThreadConfigs::Items& ThreadConfigs::GetItems()
60{
61 return this->items;
62}
63
64}}}} // end of namespace Arp::System::Commons::Configuration
void ReadXml(XmlReader &reader, XmlSerializationContext &context) override
ReadXML must be implemented by all classes which should read its context from xml files
ThreadConfigs(void)=default
Constructs an ThreadConfigs instance.
~ThreadConfigs(void)=default
Destructs this instance and frees all resources.
ThreadConfigs(const ThreadConfigs &arg)=delete
Copy constructor.
ThreadConfigs(ThreadConfigs &&arg)=delete
Move constructor.
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:19
@ 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