Skip to content

Commit

Permalink
[#490] Properly set max slice length consdering custom type settings
Browse files Browse the repository at this point in the history
  • Loading branch information
orecham committed Nov 7, 2024
1 parent a03dfc4 commit 103a02c
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions iceoryx2-ffi/cxx/include/iox2/port_factory_publisher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,8 @@ PortFactoryPublisher<S, Payload, UserHeader>::create() && -> iox::expected<Publi
&m_handle, static_cast<iox2_unable_to_deliver_strategy_e>(iox::into<int>(value)));
});
m_max_slice_len
.and_then([&](auto value) {
// The payload type used by the C API is always a [u8].
// Thus need to convert from N to N * sizeof(payload).
// TODO: Consider alignment... not aligning each element properly will impact performance
iox2_port_factory_publisher_builder_set_max_slice_len(
&m_handle, value * sizeof(typename PayloadInfo<Payload>::ValueType));
})
.or_else([&]() {
// Assume only one element if not otherwise specified
iox2_port_factory_publisher_builder_set_max_slice_len(&m_handle,
sizeof(typename PayloadInfo<Payload>::ValueType));
});
.and_then([&](auto value) { iox2_port_factory_publisher_builder_set_max_slice_len(&m_handle, value); })
.or_else([&]() { iox2_port_factory_publisher_builder_set_max_slice_len(&m_handle, 1); });
m_max_loaned_samples.and_then(
[&](auto value) { iox2_port_factory_publisher_builder_set_max_loaned_samples(&m_handle, value); });

Expand Down

0 comments on commit 103a02c

Please sign in to comment.