JSON RPC
JSON-RPC 2.0 library for C++
|
Private implementation of the JSON RPC dispatcher class. More...
#include <dispatcher_p.h>
Public Member Functions | |
void | add_handler (std::string &&method, dispatcher::handler_t &&handler) |
Adds a method handler. | |
dispatcher::handler_t | find_handler (const std::string &method) const |
Finds a method handler. | |
Static Public Member Functions | |
static std::uint64_t | get_and_increment_counter () noexcept |
Generates a unique request ID. | |
Private Attributes | |
std::unordered_map< std::string, dispatcher::handler_t > | m_methods |
Map of method names to handler functions. | |
Static Private Attributes | |
static std::atomic_uint64_t | m_id_counter = 0 |
Counter for generating unique request IDs. | |
Private implementation of the JSON RPC dispatcher class.
This class contains the private members and methods used by the dispatcher
class to manage method handlers.
Definition at line 25 of file dispatcher_p.h.
|
inline |
Adds a method handler.
method | The name of the method. |
handler | The handler function. |
This method registers a handler function for a given method name. The handler function will be invoked when a request for the specified method is received.
Definition at line 36 of file dispatcher_p.h.
|
inline |
Finds a method handler.
method | The name of the method. |
nullptr | Handler not found |
This method returns the handler function for the specified method name. If no handler is found, it returns a null pointer.
Definition at line 51 of file dispatcher_p.h.
|
inlinestaticnoexcept |
Generates a unique request ID.
This method generates a unique request ID by incrementing an atomic counter.
Definition at line 67 of file dispatcher_p.h.
|
inlinestaticprivate |
Counter for generating unique request IDs.
Definition at line 76 of file dispatcher_p.h.
|
private |
Map of method names to handler functions.
Definition at line 74 of file dispatcher_p.h.