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

Method Initialize

src/plugins/proxy_plugin/proxy_action.cc:53–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51
52namespace aimrt::plugins::proxy_plugin {
53void ProxyAction::Initialize(YAML::Node options) {
54 if (options && !options.IsNull())
55 options_ = options.as<Options>();
56
57 for (auto& topic_meta : options_.topic_meta_list) {
58 // check msg type
59 auto type_support_ref = get_type_support_func_(topic_meta.msg_type);
60 AIMRT_CHECK_ERROR_THROW(type_support_ref, "Can not get type support for msg type '{}'.", topic_meta.msg_type);
61
62 // check duplicate topic meta
63 runtime::core::util::TopicMetaKey key{
64 .topic_name = topic_meta.sub_topic_name,
65 .msg_type = topic_meta.msg_type};
66
67 AIMRT_CHECK_ERROR_THROW(
68 topic_meta_map_.find(key) == topic_meta_map_.end(),
69 "Duplicate topic meta, topic name: {}, msg type: {}.",
70 topic_meta.sub_topic_name, topic_meta.msg_type);
71
72 TopicMeta topic_meta_info{
73 .topic_name = topic_meta.sub_topic_name,
74 .msg_type = topic_meta.msg_type,
75 .pub_topic_name = topic_meta.pub_topic_name};
76 topic_meta_map_.emplace(key, topic_meta_info);
77
78 // check duplicate pub topic name
79 for (const auto& pub_topic_name : topic_meta.pub_topic_name) {
80 runtime::core::util::TopicMetaKey pub_key{
81 .topic_name = pub_topic_name,
82 .msg_type = topic_meta.msg_type};
83 AIMRT_CHECK_ERROR_THROW(
84 pub_topic_name_set_.find(pub_key) == pub_topic_name_set_.end(),
85 "Duplicate pub topic name: {}, msg type: {}.",
86 pub_topic_name, topic_meta.msg_type);
87 pub_topic_name_set_.insert(pub_key);
88 }
89 }
90}
91
92void ProxyAction::InitExecutor() {
93 executor_ = get_executor_func_(options_.executor);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected