8 #ifndef __NANO_RPC_CORE_CLIENT_H__
9 #define __NANO_RPC_CORE_CLIENT_H__
35 template <
typename TPacker>
47 template <
typename ... TArgs>
50 return call(
hash_id(name), std::forward<TArgs>(args) ... );
53 template <
typename ... TArgs>
56 auto data = std::make_tuple(std::forward<TArgs>(args) ... );
60 .pack(version::core::protocol::value)
67 auto response = packer.from_buffer(std::move(
buffer));
70 version::core::protocol::value_type
protocol{};
71 response = response.unpack(
protocol);
72 if (
protocol != version::core::protocol::value)
74 throw exception::client{
"[nanorpc::core::client::call] Unsupported protocol version \"" +
81 response = response.unpack(
type);
83 throw exception::client{
"[nanorpc::core::client::call] Bad response type."};
88 response = response.unpack(
status);
92 response = response.unpack(message);
93 throw exception::logic{message};
97 return {std::move(response)};
113 template <
typename T>
117 throw exception::client{
"[nanorpc::core::client::result::as] No data."};
124 throw exception::client{
"[nanorpc::core::client::result::as] No data."};
133 return linb::any_cast<Type>(*
value_);
136 template <
typename T>
162 #endif // !__NANO_RPC_CORE_CLIENT_H__