13#ifndef IOX2_PORTFACTORY_PUBLISH_SUBSCRIBE_HPP
14#define IOX2_PORTFACTORY_PUBLISH_SUBSCRIBE_HPP
37template <ServiceType S,
typename Payload,
typename UserHeader>
99 iox2_port_factory_pub_sub_h m_handle =
nullptr;
102template <
ServiceType S, typename Payload, typename UserHeader>
104 iox2_port_factory_pub_sub_h handle)
105 : m_handle { handle } {
108template <ServiceType S,
typename Payload,
typename UserHeader>
109inline void PortFactoryPublishSubscribe<S, Payload, UserHeader>::drop() {
110 if (m_handle !=
nullptr) {
111 iox2_port_factory_pub_sub_drop(m_handle);
116template <ServiceType S,
typename Payload,
typename UserHeader>
119 *
this = std::move(rhs);
122template <ServiceType S,
typename Payload,
typename UserHeader>
127 m_handle = rhs.m_handle;
128 rhs.m_handle =
nullptr;
134template <ServiceType S,
typename Payload,
typename UserHeader>
139template <ServiceType S,
typename Payload,
typename UserHeader>
141 const auto* service_name_ptr = iox2_port_factory_pub_sub_service_name(&m_handle);
145template <ServiceType S,
typename Payload,
typename UserHeader>
149 iox2_port_factory_pub_sub_service_hash(&m_handle, &buffer[0], IOX2_SERVICE_HASH_LENGTH);
154 IOX2_SERVICE_HASH_LENGTH));
157template <ServiceType S,
typename Payload,
typename UserHeader>
162template <ServiceType S,
typename Payload,
typename UserHeader>
165 iox2_port_factory_pub_sub_static_config(&m_handle, &
static_config);
170template <ServiceType S,
typename Payload,
typename UserHeader>
176template <ServiceType S,
typename Payload,
typename UserHeader>
178 iox2_cleanup_state_t cleanup_state {};
180 iox2_port_factory_pub_sub_try_cleanup_dead_nodes(&m_handle, &cleanup_state);
183 ret_val.
cleanups = cleanup_state.cleanups;
184 ret_val.failed_cleanups = cleanup_state.failed_cleanups;
188template <ServiceType T,
typename Payload,
typename UserHeader>
192 iox2_cleanup_state_t cleanup_state {};
194 iox2_port_factory_pub_sub_blocking_cleanup_dead_nodes(
195 &m_handle, &cleanup_state, timeout.as_secs(), timeout.subsec_nanos());
198 ret_val.
cleanups = cleanup_state.cleanups;
199 ret_val.failed_cleanups = cleanup_state.failed_cleanups;
203template <ServiceType S,
typename Payload,
typename UserHeader>
210 iox2_port_factory_pub_sub_nodes(&m_handle, internal::list_callback<S>,
static_cast<void*
>(&ctx));
212 if (ret_val == IOX2_OK) {
216 return bb::err(bb::into<NodeListFailure>(ret_val));
219template <ServiceType S,
typename Payload,
typename UserHeader>
223 iox2_port_factory_pub_sub_subscriber_builder(&m_handle,
nullptr));
226template <ServiceType S,
typename Payload,
typename UserHeader>
230 iox2_port_factory_pub_sub_publisher_builder(&m_handle,
nullptr));
Describes the state of a [Node].
auto operator=(const PortFactoryPublishSubscribe &) -> PortFactoryPublishSubscribe &=delete
auto subscriber_builder() const -> PortFactorySubscriber< S, Payload, UserHeader >
Returns a [PortFactorySubscriber] to create a new [Subscriber] port.
auto blocking_cleanup_dead_nodes(iox2::bb::Duration timeout) const -> CleanupState
auto service_hash() const -> ServiceHash
Returns the [ServiceHash] of the [Service].
auto nodes(const iox2::bb::StaticFunction< CallbackProgression(NodeState< S >)> &callback) const -> bb::Expected< void, NodeListFailure >
auto name() const -> ServiceNameView
Returns the [ServiceName] of the service.
PortFactoryPublishSubscribe(const PortFactoryPublishSubscribe &)=delete
auto operator=(PortFactoryPublishSubscribe &&rhs) noexcept -> PortFactoryPublishSubscribe &
auto publisher_builder() const -> PortFactoryPublisher< S, Payload, UserHeader >
Returns a [PortFactoryPublisher] to create a new [Publisher] port.
auto try_cleanup_dead_nodes() const -> CleanupState
PortFactoryPublishSubscribe(PortFactoryPublishSubscribe &&rhs) noexcept
auto dynamic_config() const -> DynamicConfigPublishSubscribe
~PortFactoryPublishSubscribe()
auto attributes() const -> AttributeSetView
Returns the attributes defined in the [Service].
auto static_config() const -> StaticConfigPublishSubscribe
Builder to create new [MessagingPattern::PublishSubscribe] based [Service]s.
Represents the unique if of a [Service].
Non-owning view of a [ServiceName].
Wrapper class for a C-style array of type ElementType and size Capacity. Per default it is uninitiali...
constexpr auto err(const E &error) -> Unexpected< E >
iox2::bb::variation::Expected< T, E > Expected
auto ctx(const T &ptr) -> CallbackContext< T >
NodeListFailure
All failures that can occur in [Node::list()].
uint64_t cleanups
The number of successful dead node cleanups.