| | |
| | | };
|
| | |
|
| | | ///////////////////////////////////////////////////////////
|
| | |
|
| | | template <size_t... I, class T>
|
| | | template <size_t... I, class T, typename enable_if<(sizeof...(I) > 0)>::type* = nullptr>
|
| | | auto crop(T&& t) -> decltype(make_tuple(get<I>(std::forward<T>(t))...)){
|
| | | return make_tuple(get<I>(std::forward<T>(t))...);
|
| | | }
|
| | |
| | | return m;
|
| | | }
|
| | |
|
| | | template <size_t... Is, class F, class... Args>
|
| | | template <size_t... Is, class F, class... Args, typename enable_if<(sizeof...(Args) > 0)>::type* = nullptr>
|
| | | Msg to_bus(client* cli, F&& f, Args&&... args){
|
| | | Msg mesg;
|
| | | if (std::forward<F>(f)(cli->bus, std::forward<Args>(args)...))
|
| | |
| | | return mesg;
|
| | | }
|
| | |
|
| | | MsgCR parse(client*, const tuple<>&){ return dummy();}
|
| | | template <class... Args>
|
| | | template <class... Args, typename enable_if<sizeof...(Args) == 2>::type* = nullptr>
|
| | | MsgCR parse(client* cli, const tuple<Args...>& tp){
|
| | | MsgCR msg(dummy());
|
| | | MsgCommonReply m;
|
| | |
| | | MsgCR to_center(client* cli, F&& f, Args&&... args){
|
| | | MsgCR msg(dummy());
|
| | | auto vmsg = std::move(to_bus<Is...>(cli, std::forward<F>(f), std::forward<Args>(args)...));
|
| | | if (!vmsg.empty())
|
| | | msg = std::move(parse(cli, vmsg.at(0)));
|
| | | if (!vmsg.empty()) msg = std::move(parse(cli, vmsg.at(0)));
|
| | | return msg;
|
| | | }
|
| | |
|