PLCnext API Documentation  22.9.0.33
RscVersion.hpp
1 //
3 // Copyright PHOENIX CONTACT Electronics GmbH
4 //
6 #pragma once
7 #include "Arp/System/Core/Arp.h"
8 
9 namespace Arp { namespace System { namespace Rsc { namespace Services
10 {
11 // forwards
12 class RscReader;
13 class RscWriter;
14 
21 {
22 public: // construction/destruction
24  RscVersion(void) = default;
30  RscVersion(int32 major, int32 minor, int32 revision, int32 build);
33  RscVersion(const Version& version);
35  RscVersion(const RscVersion& arg) = default;
37  RscVersion(RscVersion&& arg) = default;
39  RscVersion& operator=(const RscVersion& arg) = default;
41  ~RscVersion(void) = default;
42 
43 public: // property operations
45  int32 GetMajor(void)const;
47  int32 GetMinor(void)const;
49  int32 GetRevision(void)const;
51  int32 GetBuild(void)const;
52 
53 public: // operations
56  Version ToVersion(void)const;
57 
60  String ToString(void)const;
61 
62 public: // RscValueAdapter operations
65  void Read(RscReader& reader);
68  void Write(RscWriter& writer)const;
69 
70 private: // fields
71  int32 majorVersion = 0;
72  int32 minorVersion = 0;
73  int32 revisionVersion = 0;
74  int32 buildVersion = 0;
75 };
76 
78 // inline methods of class RscVersion
79 inline RscVersion::RscVersion(int32 major, int32 minor, int32 revision, int32 build)
80  : majorVersion(major)
81  , minorVersion(minor)
82  , revisionVersion(revision)
83  , buildVersion(build)
84 {
85 }
86 
87 inline RscVersion::RscVersion(const Version& version)
88  : RscVersion(version.GetMajor(), version.GetMinor(), version.GetPatch(), version.GetBuild())
89 {
90 }
91 
93 {
94  return this->majorVersion;
95 }
96 
98 {
99  return this->minorVersion;
100 }
101 
103 {
104  return this->revisionVersion;
105 }
106 
108 {
109  return this->buildVersion;
110 }
111 
113 {
114  return Version((uint8)this->majorVersion, (uint8)this->minorVersion, (uint8)this->revisionVersion, this->buildVersion);
115 }
116 
117 }}}} // end of namespace Arp::System::Rsc::Services
This class represents the version of a special SDK or Arp build.
Definition: BasicVersion.hpp:35
Reads data from Rsc
Definition: RscReader.hpp:26
Specifies a version with 4 version numbers and is marshalled to .NET type System.Version.
Definition: RscVersion.hpp:21
RscVersion(const RscVersion &arg)=default
Copy constructor.
Version ToVersion(void) const
Converts this instance into a Arp::Version.
Definition: RscVersion.hpp:112
String ToString(void) const
Converts this instance into a String.
int32 GetBuild(void) const
Gets the build version.
Definition: RscVersion.hpp:107
int32 GetMinor(void) const
Gets the minor version.
Definition: RscVersion.hpp:97
RscVersion(void)=default
Constructs a zero'ed RscVersion instance.
RscVersion & operator=(const RscVersion &arg)=default
Assignment operator.
~RscVersion(void)=default
Destructs this instance and frees all resources.
int32 GetRevision(void) const
Gets the revision version.
Definition: RscVersion.hpp:102
int32 GetMajor(void) const
Gets the major version.
Definition: RscVersion.hpp:92
RscVersion(RscVersion &&arg)=default
Move constructor.
void Write(RscWriter &writer) const
Writes this instance to the given RscWriter.
void Read(RscReader &reader)
Reads this instance from the given RscReader.
Writes data to Rsc.
Definition: RscWriter.hpp:31
std::uint8_t uint8
The Arp unsigned integer type of 1 byte size.
Definition: PrimitiveTypes.hpp:27
std::int32_t int32
The Arp integer type of 4 byte size.
Definition: PrimitiveTypes.hpp:37
@ System
System components used by the System, Device, Plc or Io domains.
Root namespace for the PLCnext API