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

Method DoSubscribe

src/interface/aimrt_module_cpp_interface/context/context.h:332–340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

330// subscriber subscribe
331template <class T, concepts::SupportedSubscriber<T> TCallback>
332void OpSub::DoSubscribe(const res::Subscriber<T>& ch, TCallback callback, aimrt::executor::ExecutorRef exe) {
333 auto& channel_ctx = ctx_.GetChannelResource(ch, loc_);
334 auto& sub_fn = std::any_cast<typename Context::SubscribeFunction<T>&>(channel_ctx.sub_f);
335 auto ctx = details::GetCurrentContext();
336 const bool ok = sub_fn(channel_ctx.sub,
337 StandardizeSubscriber<T>(std::move(callback)),
338 std::move(exe));
339 AIMRT_ASSERT_WITH_LOC(loc_, ok, "Subscribe [{}] failed.", ch.GetName());
340}
341
342// subscriber subscribe function
343template <class T>

Callers

nothing calls this directly

Calls 2

GetCurrentContextFunction · 0.85
GetChannelResourceMethod · 0.80

Tested by

no test coverage detected