PLCnext API Documentation  21.0.0.35466
IpAddress.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 Commons { namespace Net
10 {
11 
13 class IpAddress
14 {
15 public: // typedefs
16 
18  typedef uint32 IpV4Value;
19 
20 public: // construction/destruction
22  IpAddress(void) = default;
23 
27  IpAddress(uint32 ip4address);
28 
30  IpAddress(const IpAddress& arg) = default;
31 
33  IpAddress& operator=(const IpAddress& arg) = default;
34 
36  ~IpAddress(void) = default;
37 
38 public: // operators
39 
43  void operator=(Arp::uint32 ip4Address);
44 
45 public: // static operations
46 
54  static IpAddress Parse(const String& input);
55 
62  static bool TryParse(const String& input, IpAddress& result);
63 
64 public: // setter/getter operations
65 
69  IpV4Value GetIpv4Value(void) const;
70 
71 public: // operations
72  String ToString(void)const;
73 
74 protected: // operations
75 
76 private: // static methods
77 
78 private: // methods
79 
80 private: // fields
81  IpV4Value ipV4Value = 0;
82 
83 private: // static fields
84 };
85 
87 // inline methods of class IpAddress
88 inline IpAddress::IpAddress(uint32 ip4Address) : ipV4Value(ip4Address)
89 {
90 }
91 
93 {
94  return this->ipV4Value;
95 }
96 
97 inline void IpAddress::operator=(Arp::uint32 ip4Address)
98 {
99  this->ipV4Value = ip4Address;
100 }
101 
102 }}}} // end of namespace Arp::System::Commons::Net
std::uint32_t uint32
The Arp unsigned integer type of 4 byte size.
Definition: PrimitiveTypes.hpp:35
IpAddress & operator=(const IpAddress &arg)=default
Assignment operator.
IpV4Value GetIpv4Value(void) const
Returns the ip address in ip v4 address scheme.
Definition: IpAddress.hpp:92
Root namespace for the PLCnext API
uint32 IpV4Value
Value-type-definition for ip addresses using version 4 scheme.
Definition: IpAddress.hpp:18
static IpAddress Parse(const String &input)
Parses an ip address from string bases representation, e.g. "127.0.0.1".
Unified representation for ip address schemes.
Definition: IpAddress.hpp:13
System components used by the System, Device, Plc or Io domains.
~IpAddress(void)=default
Destructs this instance and frees all resources.
static bool TryParse(const String &input, IpAddress &result)
Tries to parse an address from string based representation.
IpAddress(void)=default
Constructs an IpAddress instance.