plcopen 0.22.0
载入中...
搜索中...
未找到
pins.h
浏览该文件的文档.
1#pragma once
2
3#include <array>
4#include <cstddef>
5#include <cstdint>
6#include <string_view>
7
9#include "st/types.h"
10
11// FB pin metadata is generated from the checked-in IEC/PLCopen authorities.
12// Pin ids are bytecode operands and are stable zero-based ordinals within an
13// FB. Native registration remains independent: unresolved adapters keep their
14// declared pin/type surface without becoming registered native accessors.
15
16namespace plcopen::core::st
17{
18
19struct PinDesc
20{
21 std::string_view lower_name; // canonical IEC pin name, ASCII lower case
26 // Compatibility for existing semantic call sites. in_out accepts input,
27 // while direction retains its distinct read/write contract.
28 bool is_input = false;
29};
30
31constexpr TypeId pin_type_id(const PinDesc &pin) noexcept
32{
33 return pin.type_id;
34}
35
36constexpr bool pin_accepts_input(const PinDesc &pin) noexcept
37{
38 return pin.direction == generated::StBindingPinDirection::input ||
40}
41
42constexpr bool pin_produces_output(const PinDesc &pin) noexcept
43{
44 return pin.direction == generated::StBindingPinDirection::output ||
46}
47
49{
50 const PinDesc *pins = nullptr;
51 std::uint16_t count = 0;
52};
53
55
56constexpr PinTable pin_table(FbType type) noexcept
57{
59}
60
61constexpr std::size_t fb_size(FbType type) noexcept
62{
64}
65
66constexpr std::size_t fb_align(FbType type) noexcept
67{
69}
70
71// Maximum alignment of the generated native FB set. Existing load-layout
72// callers retain this aggregate bound; per-FB consumers use fb_align().
73inline constexpr std::size_t kFbAlign = 8;
74
75static_assert(fb_size(FbType::count) == 0U);
76static_assert(fb_align(FbType::count) == 0U);
77
78} // namespace plcopen::core::st
constexpr PinTable st_binding_pin_table(StBindingFbType type) noexcept
constexpr std::size_t st_binding_native_size(StBindingFbType type) noexcept
constexpr std::size_t st_binding_native_align(StBindingFbType type) noexcept
std::uint32_t TypeId
constexpr std::size_t kFbAlign
定义 pins.h:73
constexpr bool pin_accepts_input(const PinDesc &pin) noexcept
定义 pins.h:36
constexpr PinTable pin_table(FbType type) noexcept
定义 pins.h:56
constexpr bool pin_produces_output(const PinDesc &pin) noexcept
定义 pins.h:42
constexpr std::size_t fb_align(FbType type) noexcept
定义 pins.h:66
constexpr TypeId pin_type_id(const PinDesc &pin) noexcept
定义 pins.h:31
constexpr std::size_t fb_size(FbType type) noexcept
定义 pins.h:61
constexpr TypeId invalid_type_id
generated::StBindingFbType FbType
generated::StBindingPinDirection direction
定义 pins.h:24
std::string_view lower_name
定义 pins.h:21