MCPcopy Create free account
hub / github.com/AimRT/AimRT / ServeInline

Method ServeInline

src/interface/aimrt_module_cpp_interface/context/context.h:514–527  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

512// OpSrv::ServeInline implementation
513template <class Q, class P, concepts::SupportedServer<Q, P> TServer>
514void OpSrv::ServeInline(const res::Service<Q, P>& srv, TServer server) {
515 auto& rpc_ctx = ctx_.GetRpcResource(srv, loc_);
516
517 auto standardized_server = StandardizeServer<Q, P, TServer>(std::move(server));
518 rpc_ctx.serve_f = Context::Server<Q, P>(
519 [server_func = std::move(standardized_server), ctx_ptr = ctx_.weak_from_this()](
520 aimrt::rpc::ContextRef rpc_ctx, const Q& q, P& p) -> aimrt::co::Task<aimrt::rpc::Status> {
521 if (auto ctx = ctx_ptr.lock()) {
522 ctx->LetMe();
523 co_return co_await server_func(rpc_ctx, q, p);
524 }
525 co_return aimrt::rpc::Status(AIMRT_RPC_STATUS_SVR_NOT_READY);
526 });
527}
528
529// OpSrv::ServeOn implementation
530template <class Q, class P, concepts::SupportedServer<Q, P> TServer>

Callers 1

InitializeMethod · 0.80

Calls 5

StatusClass · 0.85
GetCurrentContextFunction · 0.85
GetRpcResourceMethod · 0.80
LetMeMethod · 0.80
srvMethod · 0.80

Tested by

no test coverage detected