|
| 1 | +extra_includes: |
| 2 | +- memory |
| 3 | +- optional |
| 4 | +- string |
| 5 | +- utility |
| 6 | +- pybind11/typing.h |
| 7 | +- rpy/PyTelemetryTable.h |
| 8 | +- wpi/telemetry/TelemetryBackend.hpp |
| 9 | +- wpystruct.h |
| 10 | + |
| 11 | +classes: |
| 12 | + wpi::telemetry::TelemetryRegistry: |
| 13 | + force_no_default_constructor: true |
| 14 | + methods: |
| 15 | + SetReportWarning: |
| 16 | + no_release_gil: true |
| 17 | + param_override: |
| 18 | + func: |
| 19 | + name: callback |
| 20 | + x_type: std::optional<py::typing::Callable<void(std::string_view, std::string_view)>> |
| 21 | + default: std::nullopt |
| 22 | + cpp_code: | |
| 23 | + [](std::optional<py::typing::Callable< |
| 24 | + void(std::string_view, std::string_view)>> callback) { |
| 25 | + if (!callback) { |
| 26 | + wpi::telemetry::TelemetryRegistry::SetReportWarning(nullptr); |
| 27 | + return; |
| 28 | + } |
| 29 | +
|
| 30 | + auto callbackOwner = std::shared_ptr<py::function>{ |
| 31 | + new py::function{std::move(*callback)}, [](py::function* callback) { |
| 32 | + py::gil_scoped_acquire gil; |
| 33 | + delete callback; |
| 34 | + }}; |
| 35 | + wpi::telemetry::TelemetryRegistry::SetReportWarning( |
| 36 | + [callbackOwner](std::string_view path, std::string_view msg) { |
| 37 | + py::gil_scoped_acquire gil; |
| 38 | + (*callbackOwner)(std::string{path}, std::string{msg}); |
| 39 | + }); |
| 40 | + } |
| 41 | + GetReportWarning: |
| 42 | + ignore: true |
| 43 | + ReportWarning: |
| 44 | + RegisterBackend: |
| 45 | + cpp_code: | |
| 46 | + [](std::string_view prefix, |
| 47 | + std::shared_ptr<wpi::telemetry::TelemetryBackend> backend) { |
| 48 | + wpi::telemetry::TelemetryRegistry::RegisterBackend( |
| 49 | + prefix, std::move(backend)); |
| 50 | + } |
| 51 | + GetBackend: |
| 52 | + GetEntry: |
| 53 | + GetTable: |
| 54 | + no_release_gil: true |
| 55 | + cpp_code: | |
| 56 | + [](std::string_view path) { |
| 57 | + return wpi::telemetry::python::PyTelemetryTable{ |
| 58 | + wpi::telemetry::TelemetryRegistry::GetTable(path)}; |
| 59 | + } |
| 60 | + Reset: |
| 61 | + HasSchema: |
| 62 | + AddSchema: |
| 63 | + overloads: |
| 64 | + TelemetryBackend&, std::string_view, std::string_view, std::span<const uint8_t>: |
| 65 | + TelemetryBackend&, std::string_view, std::string_view, std::string_view: |
| 66 | + AddProtobufSchema: |
| 67 | + ignore: true |
| 68 | + AddStructSchema: |
| 69 | + no_release_gil: true |
| 70 | + param_override: |
| 71 | + info: |
| 72 | + name: type |
| 73 | + cpp_code: | |
| 74 | + [](TelemetryBackend &backend, const py::type &type) { |
| 75 | + WPyStructInfo info(type); |
| 76 | + return TelemetryRegistry::AddStructSchema<WPyStruct, WPyStructInfo>(backend, info); |
| 77 | + } |
0 commit comments