24#include <unordered_map>
27#include <fmt/format.h>
51 void append(std::unique_ptr<IMethod> method) {
54 methods_.try_emplace(method_name, std::move(method));
57 fmt::format(
"Duplicate method name {}.", method_name);
69 const auto iter =
methods_.find(name);
71 const auto message = fmt::format(
"Method {} not found.", name);
74 return iter->second.get();
79 std::unordered_map<messages::MethodNameView, std::unique_ptr<IMethod>>
Class of exceptions in cpp-msgpack-rpc library.
IMethod * get(messages::MethodNameView name) const
Get the method with a name. Throws an exception when not found.
MethodDict()=default
Constructor.
std::unordered_map< messages::MethodNameView, std::unique_ptr< IMethod > > methods_
Dictionary of methods.
void append(std::unique_ptr< IMethod > method)
Append a method.
Definition of IMethod class.
Definition of MethodNameView class.
Definition of MsgpackRPCException class.
Namespace of methods in MessagePack-RPC.
Definition of StatusCode enumeration.