Motion Master 6.0.0-alpha.86
Next-generation motion control software
Loading...
Searching...
No Matches
esi_data_type.h File Reference
#include <array>
#include <cstdint>
#include <nlohmann/json_fwd.hpp>
#include <optional>
#include <string_view>
Include dependency graph for esi_data_type.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mm::etg::PrimitiveType
 One primitive type: its ESI spelling and the CoE numbering it maps onto. More...
 

Namespaces

namespace  mm
 
namespace  mm::etg
 

Enumerations

enum class  mm::etg::ObjectCode : uint16_t { mm::etg::Var = 0x07 , mm::etg::Array = 0x08 , mm::etg::Record = 0x09 }
 CoE object code (ETG.1000.6 ยง5 Table 41 "Object Code"). More...
 
enum class  mm::etg::ValueKind : uint8_t {
  mm::etg::Bool , mm::etg::Int8 , mm::etg::Int16 , mm::etg::Int32 ,
  mm::etg::Int64 , mm::etg::Uint8 , mm::etg::Uint16 , mm::etg::Uint32 ,
  mm::etg::Uint64 , mm::etg::Real32 , mm::etg::Real64 , mm::etg::String ,
  mm::etg::Bytes
}
 The C++ type an entry's value maps to. More...
 

Functions

constexpr std::string_view mm::etg::objectCodeName (ObjectCode code)
 Returns the ESI/CiA spelling of code โ€” "VAR", "ARRAY" or "RECORD".
 
std::optional< PrimitiveTypemm::etg::resolvePrimitiveType (std::string_view esiName)
 Resolves an ESI type name to its CoE code, width and signedness.
 
std::string_view mm::etg::arrayElementTypeName (std::string_view esiName)
 Returns the element type name of an "ARRAY [a..b] OF T" composition, else empty.
 
bool mm::etg::isStringTypeName (std::string_view esiName)
 True when esiName is a parameterised string type โ€” STRING(n) / OCTET_STRING(n) / UNICODE_STRING(n).
 
constexpr std::string_view mm::etg::cxxTypeName (ValueKind kind)
 The C++ spelling of kind โ€” "int32_t", "std::string", "std::vector<uint8_t>".
 
ValueKind mm::etg::resolveValueKind (uint16_t dataType, uint16_t bitSize)
 Resolves the C++ type an entry holds, from its ETG.1020 code and declared width.
 
void mm::etg::to_json (nlohmann::json &j, const PrimitiveType &type)
 Serialises a PrimitiveType to JSON (name, code, bitSize, isSigned).
 

Variables

constexpr auto mm::etg::kPrimitiveTypes
 Catalogue of the ESI primitive types, keyed by their IEC 61131-3 name.