| 239 | // publisher init |
| 240 | template <class T> |
| 241 | std::pair<res::Publisher<T>, ChannelResource&> OpPub::DoInit(std::string_view topic_name) { |
| 242 | ChannelResource channel_ctx; |
| 243 | channel_ctx.pub = ctx_.core_.GetChannelHandle().GetPublisher(topic_name); |
| 244 | AIMRT_ASSERT_WITH_LOC(loc_, channel_ctx.pub, "Get publisher for topic [{}] failed.", topic_name); |
| 245 | |
| 246 | const bool registered = channel_ctx.pub.RegisterPublishType(aimrt::GetMessageTypeSupport<T>()); |
| 247 | AIMRT_ASSERT_WITH_LOC(loc_, registered, "Register publish type for topic [{}] failed.", topic_name); |
| 248 | |
| 249 | ctx_.channel_resources_.push_back(std::move(channel_ctx)); |
| 250 | |
| 251 | res::Publisher<T> res; |
| 252 | res.name_ = std::string(topic_name); |
| 253 | res.idx_ = ctx_.channel_resources_.size() - 1; |
| 254 | res.context_id_ = ctx_.id_; |
| 255 | return {res, ctx_.channel_resources_.back()}; |
| 256 | } |
| 257 | |
| 258 | // publisher publish |
| 259 | template <class T> |
nothing calls this directly
no test coverage detected