| 1 |
|
| #pragma once |
| 2 |
|
| #include "function.h" |
| 3 |
|
| #include <tuple> |
| 4 |
|
| #include <utility> |
| 5 |
|
| #include <panda/CallbackDispatcher.h> |
| 6 |
|
| |
| 7 |
|
| namespace xs { namespace callback_dispatcher { |
| 8 |
|
| using panda::function; |
| 9 |
|
| using panda::CallbackDispatcher; |
| 10 |
|
| using xs::func::ConverterIn; |
| 11 |
|
| using xs::func::ConverterOut; |
| 12 |
|
| |
| 13 |
|
| struct XSCallbackDispatcher { |
| 14 |
0 |
| virtual ~XSCallbackDispatcher () {} |
| 15 |
|
| |
| 16 |
|
| virtual void add (const Sub& cv) = 0; |
| 17 |
|
| virtual void prepend (const Sub& cv) = 0; |
| 18 |
|
| virtual void add_event_listener (const Sub& cv) = 0; |
| 19 |
|
| virtual void prepend_event_listener (const Sub& cv) = 0; |
| 20 |
|
| virtual void remove (const Sub& cv) = 0; |
| 21 |
|
| virtual void remove_event_listener (const Sub& cv) = 0; |
| 22 |
|
| virtual Sv call (SV** args, size_t items) = 0; |
| 23 |
|
| virtual void remove_all () = 0; |
| 24 |
|
| virtual bool has_listeners () = 0; |
| 25 |
|
| |
| 26 |
|
| template <typename Ret, class...Args, class...Rest> |
| 27 |
|
| static XSCallbackDispatcher* create (CallbackDispatcher<Ret(Args...)>&, Rest&&...); |
| 28 |
|
| }; |
| 29 |
|
| |
| 30 |
|
| template <class T, class OutArg, class InArg, typename OutF = std::decay_t<OutArg>, typename InF = std::decay_t<InArg>> |
| 31 |
|
| std::pair<ConverterOut<T, OutF>, ConverterIn<T, InF>> create_converter_pair (const std::pair<OutArg, InArg>& p) { |
| 32 |
|
| return { ConverterOut<T, OutF>(p.first), ConverterIn<T, InF>(p.second) }; |
| 33 |
|
| } |
| 34 |
|
| |
| 35 |
|
| template <class T, class OutArg, class InArg, typename OutF = std::decay_t<OutArg>, typename InF = std::decay_t<InArg>> |
| 36 |
8 |
| std::pair<ConverterOut<T, OutF>, ConverterIn<T, InF>> create_converter_pair (std::pair<OutArg, InArg>& p) { |
| 37 |
8 |
| return { ConverterOut<T, OutF>(p.first), ConverterIn<T, InF>(p.second) }; |
| 38 |
|
| } |
| 39 |
|
| |
| 40 |
|
| template <class T, class OutArg, class InArg, typename OutF = std::decay_t<OutArg>, typename InF = std::decay_t<InArg>> |
| 41 |
13 |
| std::pair<ConverterOut<T, OutF>, ConverterIn<T, InF>> create_converter_pair (std::pair<OutArg, InArg>&& p) { |
| 42 |
13 |
| return { ConverterOut<T, OutF>(std::move(p.first)), ConverterIn<T, InF>(std::move(p.second)) }; |
| 43 |
|
| } |
| 44 |
|
| |
| 45 |
|
| template <class T, class OutArg, typename OutF = std::decay_t<OutArg>> |
| 46 |
0 |
| std::pair<ConverterOut<T, OutF>, ConverterIn<T, std::nullptr_t>> create_converter_pair (OutArg&& arg) { |
| 47 |
0 |
| return { ConverterOut<T, OutF>(std::forward<OutArg>(arg)), ConverterIn<T, std::nullptr_t>(nullptr) }; |
| 48 |
|
| } |
| 49 |
|
| |
| 50 |
|
| template <class Ret, class RetConv, class...Convs> |
| 51 |
|
| struct XSCallbackDispatcherImpl : XSCallbackDispatcher { |
| 52 |
|
| static constexpr size_t ARGS_COUNT = sizeof...(Convs); |
| 53 |
|
| using Dispatcher = CallbackDispatcher<Ret(typename Convs::first_type::type...)>; |
| 54 |
|
| using Event = typename Dispatcher::Event; |
| 55 |
|
| using Callback = typename Dispatcher::Callback; |
| 56 |
|
| using SimpleCallback = typename Dispatcher::SimpleCallback; |
| 57 |
|
| using OptRet = typename Dispatcher::OptionalRet; |
| 58 |
|
| using Tuple = std::tuple<Convs...>; |
| 59 |
|
| using Indices = std::make_index_sequence<ARGS_COUNT>; |
| 60 |
|
| using VoidIn = ConverterIn<void, std::nullptr_t>; |
| 61 |
|
| using IFuncSimple = panda::Ifunction<void, typename Convs::first_type::type...>; |
| 62 |
|
| using IFuncExt = panda::Ifunction<OptRet, Event&, typename Convs::first_type::type...>; |
| 63 |
|
| |
| 64 |
|
| struct EventOut { |
| 65 |
|
| using type = Event&; |
| 66 |
|
| RetConv ret_conv; |
| 67 |
|
| Tuple arg_convs; |
| 68 |
|
| |
| 69 |
|
| // we can't store XSCallbackDispatcher reference in EventOut object, because XSCallbackDispatcher is a temporary wrapper |
| 70 |
|
| // and may no longer exists when EventOut is called |
| 71 |
0 |
| EventOut (XSCallbackDispatcherImpl& d) : ret_conv(d.ret_conv), arg_convs(d.arg_convs) {} |
| 72 |
|
| |
| 73 |
0 |
| Sv out (Event& e) { return _out(e, Indices{}); } |
| 74 |
|
| |
| 75 |
|
| template <std::size_t...I> |
| 76 |
0 |
| Sv _out (Event& e, std::index_sequence<I...>) { |
| 77 |
0 |
| Event* ep = &e; |
| 78 |
0 |
▶ | auto ret = function2sub_with_convs([ep](typename Convs::first_type::type...args) -> OptRet { |
Branch: 13 branches
| Branch | True | False | Total |
| auto ret = function2sub_with_convs([ep](typename Convs::first_type::type...args) -> OptRet { |
0 |
0 |
0 |
| auto ret = function2sub_with_convs([ep](typename Convs::first_type::type...args) -> OptRet { |
0 |
0 |
0 |
| auto ret = function2sub_with_convs([ep](typename Convs::first_type::type...args) -> OptRet { |
5 |
0 |
5 |
| auto ret = function2sub_with_convs([ep](typename Convs::first_type::type...args) -> OptRet { |
4 |
0 |
4 |
| auto ret = function2sub_with_convs([ep](typename Convs::first_type::type...args) -> OptRet { |
1 |
0 |
1 |
| auto ret = function2sub_with_convs([ep](typename Convs::first_type::type...args) -> OptRet { |
2 |
0 |
2 |
| auto ret = function2sub_with_convs([ep](typename Convs::first_type::type...args) -> OptRet { |
2 |
0 |
2 |
| auto ret = function2sub_with_convs([ep](typename Convs::first_type::type...args) -> OptRet { |
1 |
0 |
1 |
| auto ret = function2sub_with_convs([ep](typename Convs::first_type::type...args) -> OptRet { |
0 |
0 |
0 |
| auto ret = function2sub_with_convs([ep](typename Convs::first_type::type...args) -> OptRet { |
0 |
0 |
0 |
| auto ret = function2sub_with_convs([ep](typename Convs::first_type::type...args) -> OptRet { |
0 |
0 |
0 |
| auto ret = function2sub_with_convs([ep](typename Convs::first_type::type...args) -> OptRet { |
0 |
0 |
0 |
| auto ret = function2sub_with_convs([ep](typename Convs::first_type::type...args) -> OptRet { |
9 |
0 |
9 |
|
| 79 |
11 |
| return ep->next(args...); |
| 80 |
0 |
▶ | }, ret_conv.first, std::get<I>(arg_convs).second...); |
Branch: 13 branches
| Branch | True | False | Total |
| }, ret_conv.first, std::get<I>(arg_convs).second...); |
0 |
0 |
0 |
| }, ret_conv.first, std::get<I>(arg_convs).second...); |
0 |
0 |
0 |
| }, ret_conv.first, std::get<I>(arg_convs).second...); |
5 |
0 |
5 |
| }, ret_conv.first, std::get<I>(arg_convs).second...); |
4 |
0 |
4 |
| }, ret_conv.first, std::get<I>(arg_convs).second...); |
1 |
0 |
1 |
| }, ret_conv.first, std::get<I>(arg_convs).second...); |
2 |
0 |
2 |
| }, ret_conv.first, std::get<I>(arg_convs).second...); |
2 |
0 |
2 |
| }, ret_conv.first, std::get<I>(arg_convs).second...); |
1 |
0 |
1 |
| }, ret_conv.first, std::get<I>(arg_convs).second...); |
0 |
0 |
0 |
| }, ret_conv.first, std::get<I>(arg_convs).second...); |
0 |
0 |
0 |
| }, ret_conv.first, std::get<I>(arg_convs).second...); |
0 |
0 |
0 |
| }, ret_conv.first, std::get<I>(arg_convs).second...); |
0 |
0 |
0 |
| }, ret_conv.first, std::get<I>(arg_convs).second...); |
9 |
0 |
9 |
|
| 81 |
0 |
▶ | return Ref::create(ret); |
Branch: 13 branches
| Branch | True | False | Total |
| return Ref::create(ret); |
0 |
0 |
0 |
| return Ref::create(ret); |
0 |
0 |
0 |
| return Ref::create(ret); |
5 |
0 |
5 |
| return Ref::create(ret); |
4 |
0 |
4 |
| return Ref::create(ret); |
1 |
0 |
1 |
| return Ref::create(ret); |
2 |
0 |
2 |
| return Ref::create(ret); |
2 |
0 |
2 |
| return Ref::create(ret); |
1 |
0 |
1 |
| return Ref::create(ret); |
0 |
0 |
0 |
| return Ref::create(ret); |
0 |
0 |
0 |
| return Ref::create(ret); |
0 |
0 |
0 |
| return Ref::create(ret); |
0 |
0 |
0 |
| return Ref::create(ret); |
9 |
0 |
9 |
|
| 82 |
0 |
| } |
| 83 |
|
| }; |
| 84 |
|
| |
| 85 |
|
| template <class RetConvArg, class...ConvArgs> |
| 86 |
0 |
| XSCallbackDispatcherImpl (Dispatcher& d, RetConvArg&& rcarg, ConvArgs&&... cargs) |
| 87 |
0 |
| : dispatcher(d), |
| 88 |
0 |
▶ | ret_conv(create_converter_pair<OptRet>(std::forward<RetConvArg>(rcarg))), |
Branch: 13 branches
| Branch | True | False | Total |
| ret_conv(create_converter_pair<OptRet>(std::forward<RetConvArg>(rcarg))), |
0 |
0 |
0 |
| ret_conv(create_converter_pair<OptRet>(std::forward<RetConvArg>(rcarg))), |
0 |
0 |
0 |
| ret_conv(create_converter_pair<OptRet>(std::forward<RetConvArg>(rcarg))), |
18 |
0 |
18 |
| ret_conv(create_converter_pair<OptRet>(std::forward<RetConvArg>(rcarg))), |
18 |
0 |
18 |
| ret_conv(create_converter_pair<OptRet>(std::forward<RetConvArg>(rcarg))), |
2 |
0 |
2 |
| ret_conv(create_converter_pair<OptRet>(std::forward<RetConvArg>(rcarg))), |
10 |
0 |
10 |
| ret_conv(create_converter_pair<OptRet>(std::forward<RetConvArg>(rcarg))), |
4 |
0 |
4 |
| ret_conv(create_converter_pair<OptRet>(std::forward<RetConvArg>(rcarg))), |
2 |
0 |
2 |
| ret_conv(create_converter_pair<OptRet>(std::forward<RetConvArg>(rcarg))), |
2 |
0 |
2 |
| ret_conv(create_converter_pair<OptRet>(std::forward<RetConvArg>(rcarg))), |
2 |
0 |
2 |
| ret_conv(create_converter_pair<OptRet>(std::forward<RetConvArg>(rcarg))), |
1 |
0 |
1 |
| ret_conv(create_converter_pair<OptRet>(std::forward<RetConvArg>(rcarg))), |
2 |
0 |
2 |
| ret_conv(create_converter_pair<OptRet>(std::forward<RetConvArg>(rcarg))), |
50 |
0 |
50 |
|
| 89 |
0 |
▶ | arg_convs(create_converter_pair<typename Convs::first_type::type>(std::forward<ConvArgs>(cargs))...) |
Branch: 12 branches
| Branch | True | False | Total |
| arg_convs(create_converter_pair<typename Convs::first_type::type>(std::forward<ConvArgs>(cargs))...) |
0 |
0 |
0 |
| arg_convs(create_converter_pair<typename Convs::first_type::type>(std::forward<ConvArgs>(cargs))...) |
0 |
0 |
0 |
| arg_convs(create_converter_pair<typename Convs::first_type::type>(std::forward<ConvArgs>(cargs))...) |
0 |
0 |
0 |
| arg_convs(create_converter_pair<typename Convs::first_type::type>(std::forward<ConvArgs>(cargs))...) |
2 |
0 |
2 |
| arg_convs(create_converter_pair<typename Convs::first_type::type>(std::forward<ConvArgs>(cargs))...) |
10 |
0 |
10 |
| arg_convs(create_converter_pair<typename Convs::first_type::type>(std::forward<ConvArgs>(cargs))...) |
4 |
0 |
4 |
| arg_convs(create_converter_pair<typename Convs::first_type::type>(std::forward<ConvArgs>(cargs))...) |
2 |
0 |
2 |
| arg_convs(create_converter_pair<typename Convs::first_type::type>(std::forward<ConvArgs>(cargs))...) |
2 |
0 |
2 |
| arg_convs(create_converter_pair<typename Convs::first_type::type>(std::forward<ConvArgs>(cargs))...) |
2 |
0 |
2 |
| arg_convs(create_converter_pair<typename Convs::first_type::type>(std::forward<ConvArgs>(cargs))...) |
1 |
0 |
1 |
| arg_convs(create_converter_pair<typename Convs::first_type::type>(std::forward<ConvArgs>(cargs))...) |
2 |
0 |
2 |
| arg_convs(create_converter_pair<typename Convs::first_type::type>(std::forward<ConvArgs>(cargs))...) |
50 |
0 |
50 |
|
| 90 |
0 |
| {} |
| 91 |
|
| |
| 92 |
0 |
| void add (const Sub& sub) override { _add(sub, true, Indices{}); } |
| 93 |
0 |
| void prepend (const Sub& sub) override { _add(sub, false, Indices{}); } |
| 94 |
|
| |
| 95 |
0 |
| void add_event_listener (const Sub& sub) override { _add_event_listener(sub, true, Indices{}); } |
| 96 |
0 |
| void prepend_event_listener (const Sub& sub) override { _add_event_listener(sub, false, Indices{}); } |
| 97 |
|
| |
| 98 |
0 |
| void remove (const Sub& sub) override { _remove(sub, Indices{}); } |
| 99 |
|
| |
| 100 |
0 |
| void remove_event_listener (const Sub& sub) override { _remove_event_listener(sub, Indices{}); } |
| 101 |
|
| |
| 102 |
0 |
| void remove_all () override { |
| 103 |
0 |
| dispatcher.remove_all(); |
| 104 |
0 |
| } |
| 105 |
|
| |
| 106 |
0 |
| bool has_listeners () override { |
| 107 |
0 |
| return dispatcher.has_listeners(); |
| 108 |
|
| } |
| 109 |
|
| |
| 110 |
0 |
| Sv call (SV** svs, size_t items) override { |
| 111 |
0 |
▶ | if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
Branch: 26 branches
| Branch | True | False | Total |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
2 |
10 |
12 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
2 |
0 |
2 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
0 |
1 |
1 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
0 |
0 |
0 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
0 |
0 |
0 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
0 |
0 |
0 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
0 |
1 |
1 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
0 |
0 |
0 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
0 |
1 |
1 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
0 |
0 |
0 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
0 |
1 |
1 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
0 |
0 |
0 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
0 |
1 |
1 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
0 |
0 |
0 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
2 |
2 |
4 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
2 |
0 |
2 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
0 |
1 |
1 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
0 |
0 |
0 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
0 |
10 |
10 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
0 |
0 |
0 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
1 |
6 |
7 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
1 |
0 |
1 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
0 |
0 |
0 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
0 |
0 |
0 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
0 |
0 |
0 |
| if (items != ARGS_COUNT) throw Simple::format("wrong number of arguments for CallbackDispatcher::call(): expected %d, passed %d", ARGS_COUNT, items); |
0 |
0 |
0 |
|
| 112 |
0 |
| return call_impl(svs, Indices{}, (Ret*)nullptr); |
| 113 |
|
| } |
| 114 |
|
| |
| 115 |
|
| private: |
| 116 |
|
| Dispatcher& dispatcher; |
| 117 |
|
| RetConv ret_conv; |
| 118 |
|
| Tuple arg_convs; |
| 119 |
|
| |
| 120 |
|
| template <std::size_t...I> |
| 121 |
0 |
| void _add (const Sub& sub, bool back, std::index_sequence<I...>) { |
| 122 |
0 |
▶ | auto f = xs::func::sub2function_with_convs(sub, VoidIn(nullptr), std::get<I>(arg_convs).first...); |
Branch: 13 branches
| Branch | True | False | Total |
| auto f = xs::func::sub2function_with_convs(sub, VoidIn(nullptr), std::get<I>(arg_convs).first...); |
7 |
0 |
7 |
| auto f = xs::func::sub2function_with_convs(sub, VoidIn(nullptr), std::get<I>(arg_convs).first...); |
1 |
0 |
1 |
| auto f = xs::func::sub2function_with_convs(sub, VoidIn(nullptr), std::get<I>(arg_convs).first...); |
1 |
0 |
1 |
| auto f = xs::func::sub2function_with_convs(sub, VoidIn(nullptr), std::get<I>(arg_convs).first...); |
1 |
0 |
1 |
| auto f = xs::func::sub2function_with_convs(sub, VoidIn(nullptr), std::get<I>(arg_convs).first...); |
1 |
0 |
1 |
| auto f = xs::func::sub2function_with_convs(sub, VoidIn(nullptr), std::get<I>(arg_convs).first...); |
0 |
0 |
0 |
| auto f = xs::func::sub2function_with_convs(sub, VoidIn(nullptr), std::get<I>(arg_convs).first...); |
0 |
0 |
0 |
| auto f = xs::func::sub2function_with_convs(sub, VoidIn(nullptr), std::get<I>(arg_convs).first...); |
0 |
0 |
0 |
| auto f = xs::func::sub2function_with_convs(sub, VoidIn(nullptr), std::get<I>(arg_convs).first...); |
0 |
0 |
0 |
| auto f = xs::func::sub2function_with_convs(sub, VoidIn(nullptr), std::get<I>(arg_convs).first...); |
10 |
0 |
10 |
| auto f = xs::func::sub2function_with_convs(sub, VoidIn(nullptr), std::get<I>(arg_convs).first...); |
1 |
0 |
1 |
| auto f = xs::func::sub2function_with_convs(sub, VoidIn(nullptr), std::get<I>(arg_convs).first...); |
0 |
0 |
0 |
| auto f = xs::func::sub2function_with_convs(sub, VoidIn(nullptr), std::get<I>(arg_convs).first...); |
0 |
0 |
0 |
|
| 123 |
0 |
▶ | dispatcher.add(SimpleCallback(f), back); |
Branch: 26 branches
| Branch | True | False | Total |
| dispatcher.add(SimpleCallback(f), back); |
7 |
0 |
7 |
| dispatcher.add(SimpleCallback(f), back); |
7 |
0 |
7 |
| dispatcher.add(SimpleCallback(f), back); |
1 |
0 |
1 |
| dispatcher.add(SimpleCallback(f), back); |
1 |
0 |
1 |
| dispatcher.add(SimpleCallback(f), back); |
1 |
0 |
1 |
| dispatcher.add(SimpleCallback(f), back); |
1 |
0 |
1 |
| dispatcher.add(SimpleCallback(f), back); |
1 |
0 |
1 |
| dispatcher.add(SimpleCallback(f), back); |
1 |
0 |
1 |
| dispatcher.add(SimpleCallback(f), back); |
1 |
0 |
1 |
| dispatcher.add(SimpleCallback(f), back); |
1 |
0 |
1 |
| dispatcher.add(SimpleCallback(f), back); |
0 |
0 |
0 |
| dispatcher.add(SimpleCallback(f), back); |
0 |
0 |
0 |
| dispatcher.add(SimpleCallback(f), back); |
0 |
0 |
0 |
| dispatcher.add(SimpleCallback(f), back); |
0 |
0 |
0 |
| dispatcher.add(SimpleCallback(f), back); |
0 |
0 |
0 |
| dispatcher.add(SimpleCallback(f), back); |
0 |
0 |
0 |
| dispatcher.add(SimpleCallback(f), back); |
0 |
0 |
0 |
| dispatcher.add(SimpleCallback(f), back); |
0 |
0 |
0 |
| dispatcher.add(SimpleCallback(f), back); |
10 |
0 |
10 |
| dispatcher.add(SimpleCallback(f), back); |
10 |
0 |
10 |
| dispatcher.add(SimpleCallback(f), back); |
1 |
0 |
1 |
| dispatcher.add(SimpleCallback(f), back); |
1 |
0 |
1 |
| dispatcher.add(SimpleCallback(f), back); |
0 |
0 |
0 |
| dispatcher.add(SimpleCallback(f), back); |
0 |
0 |
0 |
| dispatcher.add(SimpleCallback(f), back); |
0 |
0 |
0 |
| dispatcher.add(SimpleCallback(f), back); |
0 |
0 |
0 |
|
| 124 |
0 |
| } |
| 125 |
|
| |
| 126 |
|
| template <std::size_t...I> |
| 127 |
0 |
| void _add_event_listener (const Sub& sub, bool back, std::index_sequence<I...>) { |
| 128 |
0 |
▶ | auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
Branch: 23 branches
| Branch | True | False | Total |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
9 |
0 |
9 |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
0 |
0 |
0 |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
0 |
0 |
0 |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
0 |
0 |
0 |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
0 |
0 |
0 |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
0 |
0 |
0 |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
0 |
0 |
0 |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
0 |
0 |
0 |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
0 |
0 |
0 |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
1 |
0 |
1 |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
1 |
0 |
1 |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
2 |
0 |
2 |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
2 |
0 |
2 |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
2 |
0 |
2 |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
1 |
0 |
1 |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
1 |
0 |
1 |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
4 |
0 |
4 |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
5 |
0 |
5 |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
5 |
0 |
5 |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
0 |
0 |
0 |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
0 |
0 |
0 |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
0 |
0 |
0 |
| auto f = xs::func::sub2function_with_convs(sub, ret_conv.second, EventOut(*this), std::get<I>(arg_convs).first...); |
0 |
0 |
0 |
|
| 129 |
0 |
▶ | dispatcher.add_event_listener(Callback(f), back); |
Branch: 26 branches
| Branch | True | False | Total |
| dispatcher.add_event_listener(Callback(f), back); |
9 |
0 |
9 |
| dispatcher.add_event_listener(Callback(f), back); |
9 |
0 |
9 |
| dispatcher.add_event_listener(Callback(f), back); |
0 |
0 |
0 |
| dispatcher.add_event_listener(Callback(f), back); |
0 |
0 |
0 |
| dispatcher.add_event_listener(Callback(f), back); |
0 |
0 |
0 |
| dispatcher.add_event_listener(Callback(f), back); |
0 |
0 |
0 |
| dispatcher.add_event_listener(Callback(f), back); |
0 |
0 |
0 |
| dispatcher.add_event_listener(Callback(f), back); |
0 |
0 |
0 |
| dispatcher.add_event_listener(Callback(f), back); |
0 |
0 |
0 |
| dispatcher.add_event_listener(Callback(f), back); |
0 |
0 |
0 |
| dispatcher.add_event_listener(Callback(f), back); |
1 |
0 |
1 |
| dispatcher.add_event_listener(Callback(f), back); |
1 |
0 |
1 |
| dispatcher.add_event_listener(Callback(f), back); |
2 |
0 |
2 |
| dispatcher.add_event_listener(Callback(f), back); |
2 |
0 |
2 |
| dispatcher.add_event_listener(Callback(f), back); |
2 |
0 |
2 |
| dispatcher.add_event_listener(Callback(f), back); |
2 |
0 |
2 |
| dispatcher.add_event_listener(Callback(f), back); |
1 |
0 |
1 |
| dispatcher.add_event_listener(Callback(f), back); |
1 |
0 |
1 |
| dispatcher.add_event_listener(Callback(f), back); |
4 |
0 |
4 |
| dispatcher.add_event_listener(Callback(f), back); |
4 |
0 |
4 |
| dispatcher.add_event_listener(Callback(f), back); |
5 |
0 |
5 |
| dispatcher.add_event_listener(Callback(f), back); |
5 |
0 |
5 |
| dispatcher.add_event_listener(Callback(f), back); |
0 |
0 |
0 |
| dispatcher.add_event_listener(Callback(f), back); |
0 |
0 |
0 |
| dispatcher.add_event_listener(Callback(f), back); |
0 |
0 |
0 |
| dispatcher.add_event_listener(Callback(f), back); |
0 |
0 |
0 |
|
| 130 |
0 |
| } |
| 131 |
|
| |
| 132 |
|
| template <std::size_t...I> |
| 133 |
0 |
| void _remove (const Sub& sub, std::index_sequence<I...>) { |
| 134 |
0 |
▶ | dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
Branch: 26 branches
| Branch | True | False | Total |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
2 |
0 |
2 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
2 |
0 |
2 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
2 |
0 |
2 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
2 |
0 |
2 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<void, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
|
| 135 |
0 |
| } |
| 136 |
|
| |
| 137 |
|
| template <std::size_t...I> |
| 138 |
0 |
| void _remove_event_listener (const Sub& sub, std::index_sequence<I...>) { |
| 139 |
0 |
▶ | dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
Branch: 26 branches
| Branch | True | False | Total |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
2 |
0 |
2 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
2 |
0 |
2 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
| dispatcher.remove(xs::func::SubCallerComparator<typename RetConv::second_type::type, Event&, typename Convs::first_type::type...>(sub)); |
0 |
0 |
0 |
|
| 140 |
0 |
| } |
| 141 |
|
| |
| 142 |
|
| template <size_t...I, typename _Ret, typename = std::enable_if_t<!std::is_void<_Ret>::value>> |
| 143 |
11 |
| Sv call_impl (SV** svs, std::index_sequence<I...>, _Ret*) { |
| 144 |
5 |
▶ | auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
Branch: 8 branches
| Branch | True | False | Total |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
1 |
0 |
1 |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
1 |
0 |
1 |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
1 |
0 |
1 |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
1 |
0 |
1 |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
2 |
0 |
2 |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
2 |
0 |
2 |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
1 |
0 |
1 |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
1 |
0 |
1 |
|
| 145 |
|
| (void)args; |
| 146 |
16 |
▶ | return ret_conv.first.out(dispatcher(std::get<I>(args)...)); |
Branch: 10 branches
| Branch | True | False | Total |
| return ret_conv.first.out(dispatcher(std::get<I>(args)...)); |
1 |
0 |
1 |
| return ret_conv.first.out(dispatcher(std::get<I>(args)...)); |
1 |
0 |
1 |
| return ret_conv.first.out(dispatcher(std::get<I>(args)...)); |
1 |
0 |
1 |
| return ret_conv.first.out(dispatcher(std::get<I>(args)...)); |
1 |
0 |
1 |
| return ret_conv.first.out(dispatcher(std::get<I>(args)...)); |
2 |
0 |
2 |
| return ret_conv.first.out(dispatcher(std::get<I>(args)...)); |
2 |
0 |
2 |
| return ret_conv.first.out(dispatcher(std::get<I>(args)...)); |
1 |
0 |
1 |
| return ret_conv.first.out(dispatcher(std::get<I>(args)...)); |
1 |
0 |
1 |
| return ret_conv.first.out(dispatcher(std::get<I>(args)...)); |
6 |
0 |
6 |
| return ret_conv.first.out(dispatcher(std::get<I>(args)...)); |
6 |
0 |
6 |
|
| 147 |
5 |
| } |
| 148 |
|
| |
| 149 |
|
| template <size_t...I> |
| 150 |
0 |
| Sv call_impl (SV** svs, std::index_sequence<I...>, void*) { |
| 151 |
0 |
▶ | auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
Branch: 15 branches
| Branch | True | False | Total |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
10 |
0 |
10 |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
10 |
0 |
10 |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
1 |
0 |
1 |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
1 |
0 |
1 |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
0 |
0 |
0 |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
0 |
0 |
0 |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
1 |
0 |
1 |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
1 |
0 |
1 |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
1 |
0 |
1 |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
1 |
0 |
1 |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
0 |
0 |
0 |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
0 |
0 |
0 |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
0 |
0 |
0 |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
0 |
0 |
0 |
| auto args = std::make_tuple(std::get<I>(arg_convs).second.in(svs[I])...); |
0 |
0 |
0 |
|
| 152 |
|
| (void)args; |
| 153 |
0 |
▶ | dispatcher(std::get<I>(args)...); |
Branch: 8 branches
| Branch | True | False | Total |
| dispatcher(std::get<I>(args)...); |
10 |
0 |
10 |
| dispatcher(std::get<I>(args)...); |
1 |
0 |
1 |
| dispatcher(std::get<I>(args)...); |
0 |
0 |
0 |
| dispatcher(std::get<I>(args)...); |
1 |
0 |
1 |
| dispatcher(std::get<I>(args)...); |
1 |
0 |
1 |
| dispatcher(std::get<I>(args)...); |
10 |
0 |
10 |
| dispatcher(std::get<I>(args)...); |
0 |
0 |
0 |
| dispatcher(std::get<I>(args)...); |
0 |
0 |
0 |
|
| 154 |
0 |
| return {}; |
| 155 |
0 |
| } |
| 156 |
|
| }; |
| 157 |
|
| |
| 158 |
|
| template <class Ret, class...Args, class RetConvArg, class...ConvArgs> |
| 159 |
|
| std::enable_if_t<(sizeof...(ConvArgs) == sizeof...(Args)), XSCallbackDispatcher*> |
| 160 |
0 |
| fill_default_args (CallbackDispatcher<Ret(Args...)>& d, RetConvArg&& rcarg, ConvArgs&&...cargs) { |
| 161 |
|
| using OptRet = typename CallbackDispatcher<Ret(Args...)>::OptionalRet; |
| 162 |
0 |
▶ | return new XSCallbackDispatcherImpl<Ret, |
Branch: 13 branches
| Branch | True | False | Total |
| return new XSCallbackDispatcherImpl<Ret, |
0 |
0 |
0 |
| return new XSCallbackDispatcherImpl<Ret, |
0 |
0 |
0 |
| return new XSCallbackDispatcherImpl<Ret, |
18 |
0 |
18 |
| return new XSCallbackDispatcherImpl<Ret, |
18 |
0 |
18 |
| return new XSCallbackDispatcherImpl<Ret, |
2 |
0 |
2 |
| return new XSCallbackDispatcherImpl<Ret, |
10 |
0 |
10 |
| return new XSCallbackDispatcherImpl<Ret, |
4 |
0 |
4 |
| return new XSCallbackDispatcherImpl<Ret, |
2 |
0 |
2 |
| return new XSCallbackDispatcherImpl<Ret, |
2 |
0 |
2 |
| return new XSCallbackDispatcherImpl<Ret, |
2 |
0 |
2 |
| return new XSCallbackDispatcherImpl<Ret, |
1 |
0 |
1 |
| return new XSCallbackDispatcherImpl<Ret, |
2 |
0 |
2 |
| return new XSCallbackDispatcherImpl<Ret, |
50 |
0 |
50 |
|
| 163 |
|
| decltype(create_converter_pair<OptRet>(std::forward<RetConvArg>(rcarg))), |
| 164 |
|
| decltype(create_converter_pair<Args>(std::forward<ConvArgs>(cargs)))... |
| 165 |
0 |
▶ | >(d, std::forward<RetConvArg>(rcarg), std::forward<ConvArgs>(cargs)...); |
Branch: 13 branches
| Branch | True | False | Total |
| >(d, std::forward<RetConvArg>(rcarg), std::forward<ConvArgs>(cargs)...); |
0 |
0 |
0 |
| >(d, std::forward<RetConvArg>(rcarg), std::forward<ConvArgs>(cargs)...); |
0 |
0 |
0 |
| >(d, std::forward<RetConvArg>(rcarg), std::forward<ConvArgs>(cargs)...); |
0 |
0 |
0 |
| >(d, std::forward<RetConvArg>(rcarg), std::forward<ConvArgs>(cargs)...); |
0 |
0 |
0 |
| >(d, std::forward<RetConvArg>(rcarg), std::forward<ConvArgs>(cargs)...); |
0 |
0 |
0 |
| >(d, std::forward<RetConvArg>(rcarg), std::forward<ConvArgs>(cargs)...); |
0 |
0 |
0 |
| >(d, std::forward<RetConvArg>(rcarg), std::forward<ConvArgs>(cargs)...); |
0 |
0 |
0 |
| >(d, std::forward<RetConvArg>(rcarg), std::forward<ConvArgs>(cargs)...); |
0 |
0 |
0 |
| >(d, std::forward<RetConvArg>(rcarg), std::forward<ConvArgs>(cargs)...); |
0 |
0 |
0 |
| >(d, std::forward<RetConvArg>(rcarg), std::forward<ConvArgs>(cargs)...); |
0 |
0 |
0 |
| >(d, std::forward<RetConvArg>(rcarg), std::forward<ConvArgs>(cargs)...); |
0 |
0 |
0 |
| >(d, std::forward<RetConvArg>(rcarg), std::forward<ConvArgs>(cargs)...); |
0 |
0 |
0 |
| >(d, std::forward<RetConvArg>(rcarg), std::forward<ConvArgs>(cargs)...); |
0 |
0 |
0 |
|
| 166 |
|
| } |
| 167 |
|
| |
| 168 |
|
| template <class Ret, class...Args, class...Rest> |
| 169 |
|
| std::enable_if_t<(sizeof...(Rest) <= sizeof...(Args)), XSCallbackDispatcher*> |
| 170 |
0 |
| fill_default_args (CallbackDispatcher<Ret(Args...)>& d, Rest&&...rest) { |
| 171 |
0 |
▶ | return fill_default_args(d, std::forward<Rest>(rest)..., nullptr); |
Branch: 8 branches
| Branch | True | False | Total |
| return fill_default_args(d, std::forward<Rest>(rest)..., nullptr); |
0 |
0 |
0 |
| return fill_default_args(d, std::forward<Rest>(rest)..., nullptr); |
0 |
0 |
0 |
| return fill_default_args(d, std::forward<Rest>(rest)..., nullptr); |
0 |
0 |
0 |
| return fill_default_args(d, std::forward<Rest>(rest)..., nullptr); |
18 |
0 |
18 |
| return fill_default_args(d, std::forward<Rest>(rest)..., nullptr); |
2 |
0 |
2 |
| return fill_default_args(d, std::forward<Rest>(rest)..., nullptr); |
10 |
0 |
10 |
| return fill_default_args(d, std::forward<Rest>(rest)..., nullptr); |
8 |
0 |
8 |
| return fill_default_args(d, std::forward<Rest>(rest)..., nullptr); |
48 |
0 |
48 |
|
| 172 |
|
| } |
| 173 |
|
| |
| 174 |
|
| template <class Ret, class...Args, class...Rest> |
| 175 |
|
| std::enable_if_t<std::is_void<Ret>::value, XSCallbackDispatcher*> |
| 176 |
0 |
| create_impl (CallbackDispatcher<Ret(Args...)>& d, Rest&&...rest) { |
| 177 |
0 |
▶ | return fill_default_args(d, nullptr, std::forward<Rest>(rest)...); |
Branch: 9 branches
| Branch | True | False | Total |
| return fill_default_args(d, nullptr, std::forward<Rest>(rest)...); |
0 |
0 |
0 |
| return fill_default_args(d, nullptr, std::forward<Rest>(rest)...); |
18 |
0 |
18 |
| return fill_default_args(d, nullptr, std::forward<Rest>(rest)...); |
0 |
0 |
0 |
| return fill_default_args(d, nullptr, std::forward<Rest>(rest)...); |
2 |
0 |
2 |
| return fill_default_args(d, nullptr, std::forward<Rest>(rest)...); |
2 |
0 |
2 |
| return fill_default_args(d, nullptr, std::forward<Rest>(rest)...); |
1 |
0 |
1 |
| return fill_default_args(d, nullptr, std::forward<Rest>(rest)...); |
2 |
0 |
2 |
| return fill_default_args(d, nullptr, std::forward<Rest>(rest)...); |
2 |
0 |
2 |
| return fill_default_args(d, nullptr, std::forward<Rest>(rest)...); |
48 |
0 |
48 |
|
| 178 |
|
| } |
| 179 |
|
| |
| 180 |
|
| template <class Ret, class...Args, class...Rest> |
| 181 |
|
| std::enable_if_t<!std::is_void<Ret>::value, XSCallbackDispatcher*> |
| 182 |
36 |
| create_impl (CallbackDispatcher<Ret(Args...)>& d, Rest&&...rest) { |
| 183 |
36 |
| return fill_default_args(d, std::forward<Rest>(rest)...); |
| 184 |
|
| } |
| 185 |
|
| |
| 186 |
|
| template <class Ret, class...Args, class...Rest> |
| 187 |
0 |
| XSCallbackDispatcher* XSCallbackDispatcher::create (CallbackDispatcher<Ret(Args...)>& d, Rest&&...rest) { |
| 188 |
0 |
| return create_impl(d, std::forward<decltype(rest)>(rest)...); |
| 189 |
|
| } |
| 190 |
|
| }} |
| 191 |
|
| |
| 192 |
|
| namespace xs { |
| 193 |
|
| using XSCallbackDispatcher = callback_dispatcher::XSCallbackDispatcher; |
| 194 |
|
| |
| 195 |
|
| template <> struct Typemap<XSCallbackDispatcher*> : TypemapObject<XSCallbackDispatcher*, XSCallbackDispatcher*, ObjectTypePtr, ObjectStorageMG> { |
| 196 |
0 |
| static panda::string_view package () { return "XS::Framework::CallbackDispatcher"; } |
| 197 |
|
| }; |
| 198 |
|
| |
| 199 |
|
| template <typename Ret, class...Args> struct Typemap<panda::CallbackDispatcher<Ret(Args...)>*> { |
| 200 |
36 |
| static Sv out (panda::CallbackDispatcher<Ret(Args...)>* d, const Sv& = {}) { |
| 201 |
72 |
| return xs::out(XSCallbackDispatcher::create(*d)); |
| 202 |
|
| } |
| 203 |
|
| }; |
| 204 |
|
| } |