Commit 6925b79
committed
hal: C++ API (hal.hh) and pybind11 bindings on the new HAL API
Reintroduce a C++ interface for HAL, built strictly on the public C
API and the user-land query API: no hal_priv.h, no direct shared
memory access, no re-implemented library internals.
- hal.hh: type-safe, header-only C++ layer in linuxcnc::hal. Typed
pin/param handles via traits<T> over the rtapi_ types (compile-time
accessor selection), runtime-typed pin_t variant and anypin for
name-based access, component class with add_pin for the
struct-member idiom, and ULAPI by-name query/set functions when the
query API is present.
Handles re-read the shmem slot on every access so hal_link() slot
rewrites stay visible (C pointer-variable semantics). Handles are
move-only; HAL objects are unique. Query callback paths are
exception-free; errors are reported after the library releases the
HAL mutex.
- halpybind.cc: pybind11 module (halpp.so) exposing component, Pin,
enums and the by-name functions. Built alongside _hal/hal.py,
replacing nothing. Library init/exit at import; string set values
delegate to setps_common_cb for halcmd-consistent parsing.
- taskclass converted to the new API (it was the only hal.hh user).
- HAL_PORT intentionally exempted until the API break: the port
handle type and creation semantics are still in flux.
- tests/halpp: Python and native C++ smoke suites.
Based on the pybind11 branch by rene-dev, re-based on the new HAL API.1 parent a1edf0d commit 6925b79
7 files changed
Lines changed: 926 additions & 142 deletions
File tree
- debian
- src
- emc/task
- hal
- tests/halpp
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
59 | 61 | | |
| 62 | + | |
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
31 | 44 | | |
32 | 45 | | |
| 46 | + | |
0 commit comments