|
welder 0.1.0
Bindings for annotated C++ types, from C++26 reflection
|
welder trampoline-generator rod (header-only, text-emitting). More...
#include <cstddef>#include <meta>#include <ostream>#include <string>#include <utility>#include <welder/welder.hpp>#include <welder/rods/python/trampolines/document.hpp>Go to the source code of this file.
Classes | |
| struct | welder::rods::trampolines::rod |
| The trampoline-generator rod: a stateless welder::rod that, instead of registering a live module, appends a compilable trampoline struct (plus its trampoline_for registration) for every welded virtual type it visits. More... | |
| struct | welder::rods::trampolines::rod::module_handle |
| A copyable handle onto the growing document that the driver threads through every emission primitive (the rod's module_type). More... | |
| struct | welder::rods::trampolines::rod::class_handle |
| The class handle the driver threads to the per-member hooks. More... | |
| struct | welder::rods::trampolines::rod::enum_handle |
| The enum handle. More... | |
| struct | welder::rods::trampolines::rod::session |
| No deferred module state. More... | |
Namespaces | |
| namespace | welder |
| namespace | welder::rods |
| namespace | welder::rods::trampolines |
welder trampoline-generator rod (header-only, text-emitting).
A Python subclass can only override a welded type's virtual methods when the type is bound with a trampoline — a hand-written C++ subclass that captures each virtual call and forwards it to Python (see the guide's inheritance chapter and <welder/rods/python/trampoline.hpp>). welder cannot synthesize that subclass as a live class (P2996 has no member-declaration injection), but it can emit one as source text** and let the consuming translation unit compile it. This rod does exactly that: it reflects a welded namespace and writes a .hpp of ready-to-compile trampolines — the Python analogue of the LuaCATS stub rod, and it plugs the same generic driver (<welder/welder.hpp>) so type discovery, weld/policy resolution and inheritance handling are reused verbatim.
The generated trampolines are backend-neutral — they use welder's neutral WELDER_PY_TRAMPOLINE / WELDER_PY_OVERRIDE macros, so one generated header compiles under either Python rod (pybind11 or nanobind); the consuming TU includes the active backend's trampoline.hpp first. Each override splices the base virtual's own reflected return/parameter types, so signatures match by construction (see <welder/rods/python/trampolines/document.hpp> for the rendering core and its one limitation, C-variadic virtuals).
Requires the welder vocabulary first (#include <welder/vocabulary.hpp>). Drive it by hand:
or through the generator-main() macro (module.hpp):
Definition in file rod.hpp.