PLCnext API Documentation 23.6.0.37
SecurityToken.hpp
1
2//
3// Copyright PHOENIX CONTACT Electronics GmbH
4//
6#pragma once
8namespace Arp { namespace System { namespace Security
9{
10
11class ARP_CXX_SYMBOL_EXPORT SecurityToken
12{
13public: // usings
14 using Value = uint32;
15
16public: // static fields
17 const static Value None = 0;
18 const static size_t Size = sizeof(Value);
19
20public: // construction
21 SecurityToken(Value value = None);
22 SecurityToken(const SecurityToken& arg);
23 SecurityToken(SecurityToken&& arg) = default;
24 SecurityToken& operator=(const SecurityToken& arg);
25 SecurityToken& operator=(SecurityToken&& arg) = default;
26 ~SecurityToken() = default;
27
28public: // global operators
29 friend bool operator<(const SecurityToken& lhs, const SecurityToken& rhs);
30 friend bool operator==(const SecurityToken& lhs, const SecurityToken& rhs);
31
32public: // getter/setter
33 bool HasValue(void)const;
34 Value GetValue(void)const;
35
36private: // fields
37 Value value;
38};
39
41// inline methods of class SecurityToken
42inline SecurityToken::SecurityToken(Value valueArg)
43 : value(valueArg)
44{
45}
46
47inline SecurityToken::SecurityToken(const SecurityToken& arg)
48 : value(arg.value)
49{
50}
51
52inline SecurityToken& SecurityToken::operator=(const SecurityToken& arg)
53{
54 this->value = arg.value;
55 return *this;
56}
57
58inline bool SecurityToken::HasValue()const
59{
60 return this->value != None;
61}
62
63inline SecurityToken::Value SecurityToken::GetValue()const
64{
65 return this->value;
66}
67
69// inline global operators of class SecurityToken
70inline bool operator<(const SecurityToken& lhs, const SecurityToken& rhs)
71{
72 return lhs.GetValue() < rhs.GetValue();
73}
74
75inline bool operator==(const SecurityToken& lhs, const SecurityToken& rhs)
76{
77 return lhs.GetValue() == rhs.GetValue();
78}
79
80}}} // end of namespace Arp::System::Security
Definition: SecurityToken.hpp:12
std::uint32_t uint32
The Arp unsigned integer type of 4 byte size.
Definition: PrimitiveTypes.hpp:36
@ System
System components used by the System, Device, Plc or Io domains.
Root namespace for the PLCnext API