PLCnext API Documentation 25.6.0.37
DataType.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/Base/Core/Enum.hxx"
9
11{
12
14enum class DataType : uint32
15{
17 None = 0,
18
19 // Arp C++ primitive data types
21 Void = 1,
23 Bit = 2,
25 Boolean = 3,
27 UInt8 = 4,
29 Int8 = 5,
31 Char8 = 6,
33 Char16 = 7,
35 UInt16 = 8,
37 Int16 = 9,
39 UInt32 = 10,
41 Int32 = 11,
43 UInt64 = 12,
45 Int64 = 13,
47 Float32 = 14,
49 Float64 = 15,
51 Primitive = 32,
52
53 // Arp C++ elemtary data types
55 DateTime = 33,
57 IecTime = 34,
59 IecTime64 = 35,
62 IecDate = 36,
64 IecDate64 = 37,
67 IecDateTime = 38,
69 IecDateTime64 = 39,
72 IecTimeOfDay = 40,
74 IecTimeOfDay64 = 41,
76 StaticString = 42,
78 IecString = 43,
80 ClrString = 44,
82 String = 45,
84 StaticWString = 46,
86 IecWString = 47,
88 Elementary = 64,
89
90 // Complex data types
92 ArrayElement = 65,
94 Struct = 66,
96 Class = 67,
98 FunctionBlock = 68,
100 Subsystem = 69,
102 Program = 70,
104 Component = 71,
106 Library = 72,
108 Node = 73,
110 Complex = 254,
111
112 // Flags > 0x00FF
115 Pointer = (1 << 9),
118 Array = (1 << 10),
121 Enum = (1 << 11),
124 Reference = (1 << 12),
125
126 // masks
128 BaseTypeMask = 0x00FF,
129};
130
132// global stream operators of enum DataType for logging and parsing
133ARP_EXPORT std::ostream& operator<<(std::ostream& os, DataType value);
134ARP_EXPORT std::istream& operator>>(std::istream& is, DataType& value);
135
137// global logical operators of enum DataType
138
144{
145 using U = std::underlying_type_t<DataType>;
146 return static_cast<DataType>(static_cast<U>(lhs) | static_cast<U>(rhs));
147}
148
154{
155 using U = std::underlying_type_t<DataType>;
156 return static_cast<DataType>(static_cast<U>(lhs) & static_cast<U>(rhs));
157}
158
163{
164 using U = std::underlying_type_t<DataType>;
165 return static_cast<DataType>(~static_cast<U>(arg));
166}
167
173{
174 lhs = lhs & rhs;
175 return lhs;
176}
177
183{
184 lhs = lhs | rhs;
185 return lhs;
186}
187
188} // end of namespace Arp::Plc::Meta::Commons
189
191template<> struct fmt::formatter<Arp::Plc::Meta::Commons::DataType> : public fmt::ostream_formatter
192{
193};
194
This class contains date and time informations.
Definition: DateTime.hpp:27
Adapter class for enums to make them loggable and parsable from e.g. XML files.
Definition: Enum.hxx:21
This class represents the Arp String. The implementation is based on std::string.
Definition: String.hpp:39
This class represents a single bit data type.
Definition: Bit.hpp:15
This class represents the counterpart to the data type 'IecString', 'IecWString'. It's the C++ data t...
Definition: StaticString.hxx:19
std::uint32_t uint32
The Arp unsigned integer type of 4 byte size.
Definition: PrimitiveTypes.hpp:33
Namespace for interface types of the Meta component
constexpr DataType & operator&=(DataType &lhs, DataType rhs)
Bitwise AND-assign operation
Definition: DataType.hpp:172
constexpr DataType & operator|=(DataType &lhs, DataType rhs)
Bitwise OR-assign operation
Definition: DataType.hpp:182
constexpr DataType operator&(DataType lhs, DataType rhs)
Bitwise AND operation
Definition: DataType.hpp:153
std::istream & operator>>(std::istream &is, BitSize &value)
Reads the bit size in format XXXX.Y from an input stream with X as byte size and y as bit size.
Definition: BitSize.cpp:153
constexpr DataType operator~(DataType arg)
Bitwise negate operation
Definition: DataType.hpp:162
std::ostream & operator<<(std::ostream &os, const BitSize &value)
Format to ostream
Definition: BitSize.cpp:141
constexpr DataType operator|(DataType lhs, DataType rhs)
Bitwise OR operation
Definition: DataType.hpp:143
DataType
This enum represents the data type of a variable.
Definition: DataType.hpp:15
@ ArrayElement
summary>ArrayOfArray
@ BaseTypeMask
summary>For removing all flags
@ Float32
summary>Float64 - Arp C++ data type (8 Byte)
@ ClrString
summary>C++ String type, only for internal use (not supported yet)
@ Boolean
summary>UInt8 - Arp C++ data type (1 Byte)
@ IecString
summary>.NET/C# String type, only for internal use (not supported yet)
@ IecWString
summary>Limit of elementary types.
@ Node
summary>Limit of complex types.
@ UInt16
summary>Int16 - Arp C++ data type (2 Byte)
@ FunctionBlock
summary>Subsystem
@ Char16
summary>UInt16 - Arp C++ data type (2 Byte)
@ Class
summary>Function Block
@ UInt64
summary>Int64 - Arp C++ data type (8 Byte)
@ UInt8
summary>Int8 - Arp C++ data type (1 Byte)
@ Float64
summary>Limit of primitive types.
@ Char8
summary>Char16 - Arp C++ data type (2 Byte)
@ UInt32
summary>Int32 - Arp C++ data type (4 Byte)
Root namespace for the PLCnext API