163 if (m_backpressure_strategy.has_value()) {
164 iox2_port_factory_publisher_builder_backpressure_strategy(
165 &m_handle,
static_cast<iox2_backpressure_strategy_e
>(bb::into<int>(m_backpressure_strategy.value())));
167 if (m_max_slice_len.has_value()) {
168 iox2_port_factory_publisher_builder_set_initial_max_slice_len(&m_handle, m_max_slice_len.value());
170 iox2_port_factory_publisher_builder_set_initial_max_slice_len(&m_handle, 1);
172 if (m_max_loaned_samples.has_value()) {
173 iox2_port_factory_publisher_builder_set_max_loaned_samples(&m_handle, m_max_loaned_samples.value());
175 if (m_allocation_strategy.has_value()) {
176 iox2_port_factory_publisher_builder_set_allocation_strategy(
177 &m_handle, bb::into<iox2_allocation_strategy_e>(m_allocation_strategy.value()));
180 if (m_degradation_handler.has_value()) {
181 iox2_port_factory_publisher_builder_set_degradation_handler(
185 if (m_backpressure_handler.has_value()) {
186 iox2_port_factory_publisher_builder_set_backpressure_handler(
190 if (m_override_preallocation_callback.has_value()) {
195 iox2_port_factory_publisher_builder_override_samples_preallocation(
200 iox2_publisher_h pub_handle {};
202 auto result = iox2_port_factory_publisher_builder_create(m_handle,
nullptr, &pub_handle);
204 if (result == IOX2_OK) {
208 return bb::err(bb::into<PublisherCreateError>(result));
auto create() &&-> bb::Expected< Publisher< S, Payload, UserHeader >, PublisherCreateError >
Creates a new [Publisher] or returns a [PublisherCreateError] on failure.