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

Method Publish

src/interface/aimrt_module_cpp_interface/context/context.h:260–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258// publisher publish
259template <class T>
260void OpPub::Publish(const res::Channel<T>& ch, aimrt::channel::ContextRef ch_ctx, const T& msg) {
261 auto& channel_ctx = ctx_.GetChannelResource(ch, loc_);
262 if (!ctx_.Running() || ctx_.GetPubState() != context::ChannelState::kOn) [[unlikely]] {
263 ctx_.log().Trace("Publisher is not ready.");
264 return;
265 }
266 std::any_cast<typename Context::PublishFunction<T>&>(channel_ctx.pub_f)(channel_ctx.pub, ch_ctx, msg);
267}
268
269template <class T>
270void OpPub::Publish(const res::Channel<T>& ch, const T& msg) {

Callers

nothing calls this directly

Calls 8

GetCurrentContextFunction · 0.85
GetChannelResourceMethod · 0.80
RunningMethod · 0.80
GetPubStateMethod · 0.80
TraceMethod · 0.80
logMethod · 0.80
pubMethod · 0.80
PublishFunction · 0.50

Tested by

no test coverage detected