@@ -127,28 +127,26 @@ template <typename... Fields>
127
127
using index_spec = decltype (stdx::make_indexed_tuple<get_field_type>(
128
128
temp_index<Fields, 512 , 256 >{}...));
129
129
130
- template <template <typename , typename , typename , typename ...> typename ParentT ,
131
- typename IndexSpec, typename CallbacksT , typename BaseMsgT ,
132
- typename ... ExtraCallbackArgsT >
130
+ template <template <typename , typename , typename , typename ...> typename Parent ,
131
+ typename IndexSpec, typename Callbacks , typename MsgBase ,
132
+ typename ... ExtraCallbackArgs >
133
133
struct indexed_builder_base {
134
- CallbacksT callbacks;
134
+ Callbacks callbacks;
135
135
136
136
template <typename ... Ts> [[nodiscard]] constexpr auto add (Ts... ts) {
137
137
auto new_callbacks =
138
138
stdx::tuple_cat (callbacks, separate_sum_terms (ts)...);
139
139
using new_callbacks_t = decltype (new_callbacks);
140
- return ParentT <IndexSpec, new_callbacks_t , BaseMsgT ,
141
- ExtraCallbackArgsT ...>{new_callbacks};
140
+ return Parent <IndexSpec, new_callbacks_t , MsgBase ,
141
+ ExtraCallbackArgs ...>{new_callbacks};
142
142
}
143
143
144
- using callback_func_t = auto (*)(BaseMsgT const &,
145
- ExtraCallbackArgsT ... args) -> bool ;
144
+ using callback_func_t = auto (*)(MsgBase const &,
145
+ ExtraCallbackArgs ... args) -> bool ;
146
146
147
147
template <typename BuilderValue, std::size_t I>
148
- constexpr static auto invoke_callback (BaseMsgT const &data,
149
- ExtraCallbackArgsT... args) -> bool {
150
- // FIXME: incomplete message callback invocation...
151
- // 1) bit_cast message argument
148
+ constexpr static auto invoke_callback (MsgBase const &data,
149
+ ExtraCallbackArgs... args) -> bool {
152
150
constexpr auto cb = IndexSpec{}.apply ([&]<typename ... Indices>(
153
151
Indices...) {
154
152
constexpr auto orig_cb =
@@ -164,15 +162,14 @@ struct indexed_builder_base {
164
162
" Indexed callback has matcher that is never matched!" );
165
163
}
166
164
167
- auto view = typename CB::msg_t ::view_t {data};
168
-
169
- if (cb.matcher (view)) {
165
+ using msg_t = typename CB::msg_t ;
166
+ if (msg::call_with_message<msg_t >(cb.matcher , data)) {
170
167
CIB_INFO (
171
168
" Incoming message matched [{}], because [{}] (collapsed to "
172
169
" [{}]), executing callback" ,
173
170
stdx::ct_string_to_type<cb.name , sc::string_constant>(),
174
171
orig_cb.matcher .describe (), cb.matcher .describe ());
175
- cb.callable (view , args...);
172
+ msg::call_with_message< msg_t >( cb.callable , data , args...);
176
173
return true ;
177
174
}
178
175
return false ;
0 commit comments