5#include <nlohmann/json_fwd.hpp>
71 {
"BOOL", 0x0001, 1,
false},
72 {
"BOOLEAN", 0x0001, 1,
false},
74 {
"SINT", 0x0002, 8,
true},
75 {
"INT", 0x0003, 16,
true},
76 {
"INT24", 0x0010, 24,
true},
77 {
"DINT", 0x0004, 32,
true},
78 {
"INT40", 0x0012, 40,
true},
79 {
"INT48", 0x0013, 48,
true},
80 {
"INT56", 0x0014, 56,
true},
81 {
"LINT", 0x0015, 64,
true},
83 {
"USINT", 0x0005, 8,
false},
84 {
"UINT", 0x0006, 16,
false},
85 {
"UINT24", 0x0016, 24,
false},
86 {
"UDINT", 0x0007, 32,
false},
87 {
"UINT40", 0x0018, 40,
false},
88 {
"UINT48", 0x0019, 48,
false},
89 {
"UINT56", 0x001A, 56,
false},
90 {
"ULINT", 0x001B, 64,
false},
92 {
"REAL", 0x0008, 32,
false},
93 {
"LREAL", 0x0011, 64,
false},
98 {
"BYTE", 0x001E, 8,
false},
99 {
"WORD", 0x001F, 16,
false},
100 {
"DWORD", 0x0020, 32,
false},
101 {
"BITARR8", 0x002D, 8,
false},
102 {
"BITARR16", 0x002E, 16,
false},
103 {
"BITARR32", 0x002F, 32,
false},
104 {
"BIT1", 0x0030, 1,
false},
105 {
"BIT2", 0x0031, 2,
false},
106 {
"BIT3", 0x0032, 3,
false},
107 {
"BIT4", 0x0033, 4,
false},
108 {
"BIT5", 0x0034, 5,
false},
109 {
"BIT6", 0x0035, 6,
false},
110 {
"BIT7", 0x0036, 7,
false},
111 {
"BIT8", 0x0037, 8,
false},
112 {
"BIT9", 0x0038, 9,
false},
113 {
"BIT10", 0x0039, 10,
false},
114 {
"BIT11", 0x003A, 11,
false},
115 {
"BIT12", 0x003B, 12,
false},
116 {
"BIT13", 0x003C, 13,
false},
117 {
"BIT14", 0x003D, 14,
false},
118 {
"BIT15", 0x003E, 15,
false},
119 {
"BIT16", 0x003F, 16,
false},
121 {
"GUID", 0x001D, 128,
false},
122 {
"TIME_OF_DAY", 0x000C, 48,
false},
123 {
"TIME_DIFFERENCE", 0x000D, 48,
false},
124 {
"DOMAIN", 0x000F, 0,
false},
127 {
"STRING", 0x0009, 0,
false},
128 {
"OCTET_STRING", 0x000A, 0,
false},
129 {
"UNICODE_STRING", 0x000B, 0,
false},
213 return "std::string";
215 return "std::vector<uint8_t>";
217 return "std::vector<uint8_t>";
236void to_json(nlohmann::json& j,
const PrimitiveType& type);
uint16_t bitSize
Definition esi_entry.cc:286
void to_json(nlohmann::json &j, const EniNetwork &network)
Serialises a network as JSON, for a client that renders rather than replays it.
Definition eni.cc:907
ObjectCode
CoE object code (ETG.1000.6 §5 Table 41 "Object Code").
Definition esi_data_type.h:29
@ Array
Subindex 0 is the entry count; 1..N share one element type.
@ Var
A single value: no subindices beyond 0.
@ Record
Subindex 0 is the entry count; 1..N each have their own type.
std::optional< PrimitiveType > resolvePrimitiveType(std::string_view esiName)
Resolves an ESI type name to its CoE code, width and signedness.
Definition esi_data_type.cc:65
constexpr auto kPrimitiveTypes
Catalogue of the ESI primitive types, keyed by their IEC 61131-3 name.
Definition esi_data_type.h:70
bool isStringTypeName(std::string_view esiName)
True when esiName is a parameterised string type — STRING(n) / OCTET_STRING(n) / UNICODE_STRING(n).
Definition esi_data_type.cc:56
constexpr std::string_view objectCodeName(ObjectCode code)
Returns the ESI/CiA spelling of code — "VAR", "ARRAY" or "RECORD".
Definition esi_data_type.h:36
std::string_view arrayElementTypeName(std::string_view esiName)
Returns the element type name of an "ARRAY [a..b] OF T" composition, else empty.
Definition esi_data_type.cc:43
constexpr std::string_view cxxTypeName(ValueKind kind)
The C++ spelling of kind — "int32_t", "std::string", "std::vector<uint8_t>".
Definition esi_data_type.h:189
ValueKind resolveValueKind(uint16_t dataType, uint16_t bitSize)
Resolves the C++ type an entry holds, from its ETG.1020 code and declared width.
Definition esi_data_type.cc:98
ValueKind
The C++ type an entry's value maps to.
Definition esi_data_type.h:167
@ String
STRING(n) / UNICODE_STRING(n).
@ Uint32
UDINT, DWORD, BITARR32.
@ Uint16
UINT, WORD, BITARR16, BIT9..BIT16.
@ Uint8
USINT, BYTE, BITARR8, BIT1..BIT8.
@ Bytes
Everything else, including any type/width contradiction.
@ Bool
BOOL — carried in a uint8_t, as CoE does.
One primitive type: its ESI spelling and the CoE numbering it maps onto.
Definition esi_data_type.h:57
uint16_t bitSize
Bit width; 0 for types whose width comes from a parameter.
Definition esi_data_type.h:60
std::string_view name
Canonical ESI name (the base name for parameterised types).
Definition esi_data_type.h:58
uint16_t code
ETG.1020 data type code.
Definition esi_data_type.h:59
bool isSigned
True for two's-complement signed integers.
Definition esi_data_type.h:61