#include <context_registry.h>
Definition at line 45 of file context_registry.h.
◆ context_registry()
◆ emplace()
| context & pars::net::context_registry::emplace |
( |
| ) |
|
|
inline |
Definition at line 60 of file context_registry.h.
61 {
62 auto ctx = sock_m.make_ctx();
63
65
66 auto res = ctx_map_m.try_emplace(id, router_m, std::move(ctx), sock_m);
67
68 if (!res.second)
69 throw std::runtime_error("Unable to emplace a context");
70
71 return res.first->second;
72 }
Referenced by start_recv().
◆ of()
Definition at line 74 of file context_registry.h.
75 {
77 throw std::runtime_error("We need a context here");
78
79 if (ctx_map_m.find(t.id()) == ctx_map_m.end())
80 throw std::runtime_error(std::format("Unknown context {}", t.id()));
81
82 return ctx_map_m.at(t.id());
83 }
clev::iface< nng_ctx > ctx_view
References pars::net::tool_view::id(), and pars::net::tool_view::type().
◆ start_recv()
| void pars::net::context_registry::start_recv |
( |
int | num_ctxs | ) |
|
|
inline |
◆ stop_all()
| void pars::net::context_registry::stop_all |
( |
| ) |
|
|
inline |
Definition at line 54 of file context_registry.h.
55 {
56 for (auto& c : ctx_map_m)
57 c.second.stop();
58 }
The documentation for this class was generated from the following file: