13#ifndef IOX2_PORTFACTORY_SUBSCRIBER_HPP
14#define IOX2_PORTFACTORY_SUBSCRIBER_HPP
30template <ServiceType S,
typename Payload,
typename UserHeader>
34#ifdef DOXYGEN_MACRO_FIX
42#ifdef DOXYGEN_MACRO_FIX
51#ifdef DOXYGEN_MACRO_FIX
77 template <ServiceType,
typename,
typename>
83 iox2_port_factory_subscriber_builder_h m_handle =
nullptr;
87template <ServiceType S,
typename Payload,
typename UserHeader>
89 iox2_port_factory_subscriber_builder_h handle)
90 : m_handle { handle } {
93template <ServiceType S,
typename Payload,
typename UserHeader>
94inline void PortFactorySubscriber<S, Payload, UserHeader>::drop() {
95 if (m_handle !=
nullptr) {
96 iox2_port_factory_subscriber_builder_drop(m_handle);
101template <ServiceType S,
typename Payload,
typename UserHeader>
103 *
this = std::move(rhs);
106template <ServiceType S,
typename Payload,
typename UserHeader>
111 m_handle = rhs.m_handle;
112 rhs.m_handle =
nullptr;
113 m_buffer_size = std::move(rhs.m_buffer_size);
114 m_history_request = std::move(rhs.m_history_request);
115 m_name = std::move(rhs.m_name);
116 m_degradation_handler = std::move(rhs.m_degradation_handler);
122template <ServiceType S,
typename Payload,
typename UserHeader>
127template <ServiceType S,
typename Payload,
typename UserHeader>
130 m_degradation_handler.emplace(handler);
131 return std::move(*
this);
134template <ServiceType S,
typename Payload,
typename UserHeader>
138 if (m_buffer_size.has_value()) {
139 iox2_port_factory_subscriber_builder_set_buffer_size(&m_handle, m_buffer_size.value());
142 if (m_history_request.has_value()) {
143 iox2_port_factory_subscriber_builder_set_history_request(&m_handle, m_history_request.value());
146 if (m_degradation_handler.has_value()) {
147 iox2_port_factory_subscriber_builder_set_degradation_handler(
151 if (m_name.has_value()) {
152 const auto* name_ptr = m_name.value().as_view().native_ptr();
153 iox2_port_factory_subscriber_builder_set_name(&m_handle, name_ptr);
156 iox2_subscriber_h sub_handle {};
157 auto result = iox2_port_factory_subscriber_builder_create(m_handle,
nullptr, &sub_handle);
160 if (result == IOX2_OK) {
#define IOX2_BUILDER_OPTIONAL(type, name)
auto buffer_size(const uint64_t value) -> decltype(auto)
Defines the required buffer size of the [Subscriber]. Smallest possible value is 1.
auto operator=(PortFactorySubscriber &&rhs) noexcept -> PortFactorySubscriber &
PortFactorySubscriber(PortFactorySubscriber &&rhs) noexcept
auto operator=(const PortFactorySubscriber &) -> PortFactorySubscriber &=delete
friend class PortFactoryPublishSubscribe
auto set_degradation_handler(DegradationHandler *handler) &&-> PortFactorySubscriber &&
PortFactorySubscriber(const PortFactorySubscriber &)=delete
auto history_request(const uint64_t value) -> decltype(auto)
auto name(const PortName value) -> decltype(auto)
auto create() &&-> bb::Expected< Subscriber< S, Payload, UserHeader >, SubscriberCreateError >
Creates a new [Subscriber] or returns a [SubscriberCreateError] on failure.
Represent the name for a [Port].
The receiving endpoint of a publish-subscribe communication.
constexpr auto into(const SourceType value) noexcept -> typename detail::ExtractIntoType< DestinationType >::TargetType
Converts a value of type SourceType to a corresponding value of type DestinationType....
iox2::bb::variation::Optional< T > Optional
constexpr auto err(const E &error) -> Unexpected< E >
iox2::bb::variation::Expected< T, E > Expected
auto degradation_handler_delegate(iox2_degradation_cause_e degradation_cause, iox2_degradation_info_h_ref info_handle, iox2_callback_context callback_cxt) -> iox2_degradation_action_e
iox2::bb::StaticFunction< DegradationAction(DegradationCause, DegradationInfo &)> DegradationHandler