PLCnext API Documentation 23.6.0.37
CustomAttribute.hpp
1
2//
3// Copyright PHOENIX CONTACT Electronics GmbH
4//
6#pragma once
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
14using namespace Arp::System::Rsc::Services;
15
16namespace Arp { namespace Plc { namespace Commons { namespace Meta
17{
18
21{
22public: // typedefs
23
24public: // construction/destruction
26 CustomAttribute(void) = default;
30 CustomAttribute(const CustomAttribute& arg) = default;
38 ~CustomAttribute(void) override = default;
39
40public: // setter/getter operations
43 const String& GetName()const;
44
48 const RscVariant<256>& GetValue()const;
49
52 size_t GetCacheSize(void)const;
53
54public: // IRscSerializable operations
55 void Serialize(RscWriter& writer)const override;
56 void Deserialize(RscReader& reader)override;
57 static size_t GetFieldCount(void);
58
59protected: // operations
60
61private: // static methods
62
63private: // methods
64
65private: // fields
66 String name;
67 RscVariant<256> value;
68
69private: // static fields
70
71};
72
74// inline methods of class CustomAttribute
75
76inline const String& CustomAttribute::GetName()const
77{
78 return this->name;
79}
80
82{
83 return this->value;
84}
85
86inline size_t CustomAttribute::GetFieldCount(void)
87{
88 return 2;
89}
90
91inline 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
Container for individual attributes within the interface DataBrowser
Definition: CustomAttribute.hpp:21
CustomAttribute(const CustomAttribute &arg)=default
Copy constructor.
CustomAttribute(CustomAttribute &&arg)=default
Move constructor.
CustomAttribute & operator=(CustomAttribute &&arg)=default
Move assignment operator
CustomAttribute(const String &name, RscVariant< 256 > value)
Constructs an CustomAttribute instance.
CustomAttribute(void)=default
Constructs an CustomAttribute instance.
const String & GetName() const
Name of the respective attribute this instance object include.
Definition: CustomAttribute.hpp:76
const RscVariant< 256 > & GetValue() const
Attribute value.
Definition: CustomAttribute.hpp:81
~CustomAttribute(void) override=default
Destructs this instance and frees all resources.
size_t GetCacheSize(void) const
Get the cache size
Definition: CustomAttribute.hpp:91
CustomAttribute & operator=(const CustomAttribute &arg)=default
Copy assignment operator.
void Serialize(RscWriter &writer) const override
Serializes the datatype. All fields of the datatype have to be serialized in use of RscWriter.
void Deserialize(RscReader &reader) override
Deserializes the datatype. All fields of the datatype have to be deserialized in use of RscReader.
Marshalls structure or class data types. Serialize and Deserialize have to marshal fields in the same...
Definition: IRscSerializable.hpp:20
Reads data from Rsc
Definition: RscReader.hpp:27
Writes data to Rsc.
Definition: RscWriter.hpp:32
size_type Capacity() const
Rceturns the capacity of this string.
Definition: BasicString.hxx:1079
Namespace for classes and interfaces for the Remote Service Call implementation
Root namespace for the PLCnext API