Skip to content

Commit

Permalink
fix coordinator not knowing the string names of types (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-basis authored Oct 31, 2024
1 parent a4176bf commit 70f9a3f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
10 changes: 9 additions & 1 deletion cpp/unit/include/basis/unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,18 @@ struct HandlerPubSubWithOptions : public HandlerPubSub {
constexpr bool is_raw = std::string_view(T_DERIVED::subscription_serializers[INDEX]) == "raw";
using T_SERIALIZER = typename RawSerializationHelper<MessageType, is_raw>::type;

basis::core::serialization::MessageTypeInfo mti;
if constexpr (is_raw) {
mti = {"raw", derived->subscription_message_type_names[INDEX], "", ""};
}
else {
mti = T_SERIALIZER::template DeduceMessageTypeInfo<MessageType>();
}

derived->*subscriber_member_ptr =
transport_manager->SubscribeCallable<MessageType, T_SERIALIZER, MessageInprocType>(
runtime_topic_name, CreateOnMessageCallback<INDEX, false>(), thread_pool, subscriber_queue,
T_SERIALIZER::template DeduceMessageTypeInfo<MessageType>(), CreateOnMessageCallback<INDEX, true>());
mti, CreateOnMessageCallback<INDEX, true>());
}

type_erased_callbacks[runtime_topic_name] = CreateTypeErasedOnMessageCallback<INDEX>();
Expand Down
7 changes: 6 additions & 1 deletion python/unit/templates/unit_base.cpp.j2
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ namespace {{handler_name}} {
{% endif %}
>
{% endif %}
(templated_topic_to_runtime_topic.at("{{topic_name}}"));
(templated_topic_to_runtime_topic.at("{{topic_name}}")
{% if output.serializer == "raw" %}
{# cpp makes it hard to convert a templated type to a string, so we just supply it here #}
, {"raw", "{{output.cpp_message_type}}", "", ""}
{% endif %}
);
{{output.cpp_topic_name}}_publisher->SetMaxQueueSize({{output['qos']['depth']}});
{% endfor %}
{% if 'rate' in handler.sync %}
Expand Down

0 comments on commit 70f9a3f

Please sign in to comment.