rpc.hpp 0.8.1
Simple RPC Header-Only Library
|
Class defining an interface for serving functions via RPC. More...
#include <rpc.hpp>
Public Types | |
using | adapter_t = Serial |
Public Member Functions | |
server_interface (const server_interface &)=delete | |
server_interface & | operator= (const server_interface &)=delete |
server_interface (server_interface &&) noexcept=default | |
server_interface & | operator= (server_interface &&) noexcept=default |
template<typename Val > | |
std::unordered_map< typename Serial::bytes_t, Val > & | get_func_cache (const std::string &func_name) |
Gets a reference to the server's function cache. More... | |
RPC_HPP_INLINE void | clear_all_cache () noexcept |
Clears the server's function cache. | |
template<typename R , typename... Args> | |
void | bind_cached (std::string func_name, R(*func_ptr)(Args...)) |
Binds a string to a callback, utilizing the server's cache. More... | |
template<typename R , typename... Args, typename F > | |
RPC_HPP_INLINE void | bind_cached (std::string func_name, F &&func) |
Binds a string to a callback, utilizing the server's cache. More... | |
template<typename R , typename... Args> | |
void | bind (std::string func_name, R(*func_ptr)(Args...)) |
Binds a string to a callback. More... | |
template<typename R , typename... Args, typename F > | |
RPC_HPP_INLINE void | bind (std::string func_name, F &&func) |
Binds a string to a callback. More... | |
Serial::bytes_t | dispatch (typename Serial::bytes_t &&bytes) const |
Parses the received serialized data and determines which function to call. More... | |
Protected Member Functions | |
template<typename R , typename... Args> | |
void | dispatch_cached_func (R(*func)(Args...), typename Serial::serial_t &serial_obj) |
Static Protected Member Functions | |
template<typename R , typename... Args> | |
static void | dispatch_func (R(*func)(Args...), typename Serial::serial_t &serial_obj) |
Class defining an interface for serving functions via RPC.
Serial | serial_adapter type that controls how objects are serialized/deserialized |
|
inline |
Binds a string to a callback.
R | Return type of the callback function |
Args | Variadic argument type(s) for the function |
F | Callback type (could be function or lambda or functor) |
func_name | Name to bind the callback to |
func | Callback to run when dispatch is called with bound name |
|
inline |
Binds a string to a callback.
R | Return type of the callback function |
Args | Variadic argument type(s) for the function |
func_name | Name to bind the callback to |
func_ptr | Pointer to callback that runs when dispatch is called with bound name |
|
inline |
Binds a string to a callback, utilizing the server's cache.
R | Return type of the callback function |
Args | Variadic argument type(s) for the function |
F | Callback type (could be function or lambda or functor) |
func_name | Name to bind the callback to |
func | Callback to run when dispatch is called with bound name |
|
inline |
Binds a string to a callback, utilizing the server's cache.
R | Return type of the callback function |
Args | Variadic argument type(s) for the function |
func_name | Name to bind the callback to |
func_ptr | Pointer to callback that runs when dispatch is called with bound name |
|
inline |
Parses the received serialized data and determines which function to call.
bytes | Data to be parsed into a serial object |
|
inline |
Gets a reference to the server's function cache.
Val | Type of the return value for a function |
func_name | Name of the function to get the cached return value(s) for |