PLCnext API Documentation  21.0.0.35466
CustomAttribute.hpp
1 //
3 // Copyright PHOENIX CONTACT Electronics GmbH
4 //
6 #pragma once
7 #include "Arp/System/Core/Arp.h"
8 
9 #include "Arp/System/Rsc/Services/IRscSerializable.hpp"
10 #include "Arp/System/Rsc/Services/RscReader.hpp"
11 #include "Arp/System/Rsc/Services/RscString.hxx"
12 #include "Arp/System/Rsc/Services/RscWriter.hpp"
13 
14 using namespace Arp::System::Rsc::Services;
15 
16 namespace Arp { namespace Plc { namespace Commons { namespace Meta
17 {
18 
21 {
22 public: // typedefs
23 
24 public: // construction/destruction
26  CustomAttribute(void) = default;
28  CustomAttribute(const String& name, RscVariant<256> value);
30  CustomAttribute(const CustomAttribute& arg) = default;
32  CustomAttribute(CustomAttribute&& arg) = default;
34  CustomAttribute& operator=(const CustomAttribute& arg) = default;
36  CustomAttribute& operator=(CustomAttribute&& arg) = default;
38  ~CustomAttribute(void) = default;
39 
40 public: // setter/getter operations
43  const String& GetName()const;
44 
48  const RscVariant<256>& GetValue()const;
49 
52  size_t GetCacheSize(void)const;
53 
54 public: // IRscSerializable operations
55  void Serialize(RscWriter& writer)const override;
56  void Deserialize(RscReader& reader)override;
57  static size_t GetFieldCount(void);
58 
59 protected: // operations
60 
61 private: // static methods
62 
63 private: // methods
64 
65 private: // fields
66  String name;
67  RscVariant<256> value;
68 
69 private: // static fields
70 
71 };
72 
74 // inline methods of class CustomAttribute
75 
76 inline const String& CustomAttribute::GetName()const
77 {
78  return this->name;
79 }
80 
81 inline const RscVariant<256>& CustomAttribute::GetValue()const
82 {
83  return this->value;
84 }
85 
86 inline size_t CustomAttribute::GetFieldCount(void)
87 {
88  return 2;
89 }
90 
91 inline size_t CustomAttribute::GetCacheSize(void)const
92 {
93  size_t cacheSize = 0;
94  cacheSize += this->name.Capacity();
95  cacheSize += sizeof(this->value);
96 
97  return cacheSize;
98 }
99 
100 }}}} // end of namespace Arp::Plc::Meta
Reads data from Rsc
Definition: RscReader.hpp:23
Writes data to Rsc.
Definition: RscWriter.hpp:32
Namespace for classes and interfaces for the Remote Service Call implementation
Definition: IRscReadEnumerator.hxx:9
Marshalls structure or class data types. Serialize and Deserialize have to marshal fields in the same...
Definition: IRscSerializable.hpp:18
Container for individual attributes within the interface DataBrowser
Definition: CustomAttribute.hpp:20
Root namespace for the PLCnext API