| 139 | |
| 140 | template <std::size_t Idx, typename C> |
| 141 | void setup_callback(const avnd::field_reflection<Idx, C>& out) |
| 142 | { |
| 143 | if constexpr(requires { avnd::get_name<C>(); }) |
| 144 | { |
| 145 | using call_type = decltype(C::call); |
| 146 | if constexpr(avnd::function_view_ish<call_type>) |
| 147 | { |
| 148 | /* not easily doable... |
| 149 | class_def.def_property( |
| 150 | c_str(C::name()) |
| 151 | , [] (T& t) { return avnd::pfr::get<Idx>(t.outputs).call; } |
| 152 | , [] (T& t, call_type cb) { avnd::pfr::get<Idx>(t.outputs).call = std::move(cb); } |
| 153 | ); |
| 154 | */ |
| 155 | } |
| 156 | else if constexpr(avnd::function_ish<call_type>) |
| 157 | { |
| 158 | class_def.def_property( |
| 159 | c_str(avnd::get_name<C>()), |
| 160 | [](T& t) { return avnd::pfr::get<Idx>(t.outputs).call; }, |
| 161 | [](T& t, call_type cb) { |
| 162 | avnd::pfr::get<Idx>(t.outputs).call = std::move(cb); |
| 163 | }); |
| 164 | } |
| 165 | } |
| 166 | } |
| 167 | }; |
| 168 | } |