| 83 | |
| 84 | template <auto Idx, typename M> |
| 85 | void setup_message(avnd::field_reflection<Idx, M>) |
| 86 | { |
| 87 | using func_type = decltype(avnd::message_get_func<M>()); |
| 88 | if constexpr(std::is_member_function_pointer_v<func_type>) |
| 89 | { |
| 90 | constexpr auto func = avnd::message_get_func<M>(); |
| 91 | using refl = avnd::function_reflection<func>; |
| 92 | using class_type = typename refl::class_type; |
| 93 | if constexpr(std::is_same_v<class_type, M>) |
| 94 | { |
| 95 | auto synth_fun = []<typename... Args>(boost::mp11::mp_list<Args...>) { |
| 96 | return [](Args... args) { M{}(args...); }; |
| 97 | }; |
| 98 | class_def.def(c_str(avnd::get_name<M>()), synth_fun(typename refl::arguments{})); |
| 99 | } |
| 100 | else |
| 101 | { |
| 102 | class_def.def(c_str(avnd::get_name<M>()), func); |
| 103 | } |
| 104 | } |
| 105 | else if constexpr(requires { avnd::function_reflection<M::func()>::count; }) |
| 106 | { |
| 107 | // TODO other cases: see pd |
| 108 | class_def.def_static(c_str(avnd::get_name<M>()), avnd::message_get_func<M>()); |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | explicit processor(pybind11::module_& m) |
| 113 | : class_def(m, c_str(avnd::get_c_identifier<T>())) |