PLCnext API Documentation 25.0.2.69
RscGuid.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/Base/Rsc/Commons/Rsc.hpp"
9#include "Arp/Base/Commons/Configuration/Uuid.hpp"
10#include <array>
11
12namespace Arp::Base::Rsc::Commons
13{
14
15// Type imports
19
21class ARP_EXPORT RscGuid
22{
23public: // construction
24 RscGuid(void);
25 RscGuid(const Uuid& uuid);
26
27public: // static operations
28 static RscGuid Parse(const String& input);
29 static bool TryParse(const String& input, RscGuid& result);
30 static constexpr size_t GetDataSize(void);
31
32public: // setter/getter operations
33 void SetData(byte* pData, size_t dataSize);
34 const byte* GetData(void)const;
35
36public: // operations
37 Uuid ToUuid(void)const;
38 String ToString(void)const;
39 void Read(RscReader& reader);
40 void Write(RscWriter& writer)const;
41
42public: // compare operators
43 friend ARP_EXPORT bool operator==(const RscGuid& left, const RscGuid& right)noexcept;
44 friend ARP_EXPORT bool operator!=(const RscGuid& left, const RscGuid& right)noexcept;
45
46private: // static fields
47 static constexpr size_t bufferSize = 16;
48
49private: // fields
50 std::array<byte, bufferSize> buffer{};
51};
52
54// inline methods of class RscGuid
55
58constexpr size_t RscGuid::GetDataSize()
59{
60 return bufferSize;
61}
62
63} // end of namespace Arp::Base::Rsc::Commons
This class represents a Universal Unique ID.
Definition: Uuid.hpp:16
This class represents the Arp String. The implementation is based on std::string.
Definition: String.hpp:39
A RSC wrapper class to marshal objects of type Uuid.
Definition: RscGuid.hpp:22
static constexpr size_t GetDataSize(void)
Gets the size of the internal buffer to store the Uuid.
Definition: RscGuid.hpp:58
RscGuid(void)
The default constructor constructs an empty instance of type RscGuid.
Reads marshaled data of RSC services.
Definition: RscReader.hpp:34
Writes marshalled data of RSC services.
Definition: RscWriter.hpp:34
@ Write
Specifies write access to the file. Data can be written to the file and the file pointer can be moved...
@ Read
Specifies read access to the file. Data can be read from the file and the file pointer can be moved....