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