PLCnext API Documentation 23.6.0.37
DataType.hpp
1
2//
3// Copyright PHOENIX CONTACT Electronics GmbH
4//
6#pragma once
8#include "Arp/System/Core/Enum.hxx"
9#include <type_traits>
10
11namespace Arp { namespace Plc { namespace Commons
12{
13
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 Complex = 254,
109
110 // Flags > 0x00FF
113 Pointer = (1 << 9),
116 Array = (1 << 10),
119 Enum = (1 << 11),
122 Reference = (1 << 12),
123
124 // masks
126 BaseTypeMask = 0x00FF,
127};
128
130// global stream operators of enum DataType for logging and parsing
131ARP_CXX_SYMBOL_EXPORT std::ostream& operator<<(std::ostream& os, DataType value);
132ARP_CXX_SYMBOL_EXPORT std::istream& operator>>(std::istream& is, DataType& value);
133
135// global logical operators of enum DataType
136constexpr DataType operator|(DataType lhs, DataType rhs)
137{
138 return static_cast<DataType>(static_cast<uint32>(lhs) | static_cast<uint32>(rhs));
139}
140
141constexpr DataType operator&(DataType lhs, DataType rhs)
142{
143 return static_cast<DataType>(static_cast<uint32>(lhs) & static_cast<uint32>(rhs));
144}
145
146constexpr DataType operator~(DataType arg)
147{
148 return static_cast<DataType>(~static_cast<uint32>(arg));
149}
150
151
152inline DataType& operator&=(DataType& lhs, DataType rhs)
153{
154 lhs = lhs & rhs;
155 return lhs;
156}
157
158inline DataType& operator|=(DataType& lhs, DataType rhs)
159{
160 lhs = lhs | rhs;
161 return lhs;
162}
163
164}}} // end of namespace Arp::Plc::Commons
The class contains date and time informations.
Definition: DateTime.hpp:46
Adapter class for enums to make them loggable and parsable from e.g. XML files.
Definition: Enum.hxx:23
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:36
DataType
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)
@ Component
summary>Library
@ IecString
summary>.NET/C# String type, only for internal use (not supported yet)
@ IecWString
summary>Limit of elementary types.
@ Library
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)
@ Program
summary>Component
@ 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.
@ Subsystem
summary>Program
@ Char8
summary>Char16 - Arp C++ data type (2 Byte)
@ UInt32
summary>Int32 - Arp C++ data type (4 Byte)
Root namespace for the PLCnext API