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_NULL_TERMINATED);
154 IOX2_SERVICE_HASH_LENGTH_NULL_TERMINATED));
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;
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;
203template <ServiceType S,
typename Payload,
typename UserHeader>
212 if (ret_val == IOX2_OK) {
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
friend class ServiceBuilderPublishSubscribe
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
Represents the unique if of a [Service].
Non-owning view of a [ServiceName].
static auto from_utf8_null_terminated_unchecked_truncated(char const *utf8_str, SizeType count) -> StaticString
Wrapper class for a C-style array of type ElementType and size Capacity. Per default it is uninitiali...
detail::StaticFunction< Capacity, Signature > StaticFunction
A static memory replacement for std::function.
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....
constexpr auto err(const E &error) -> Unexpected< E >
iox2::bb::variation::Expected< T, E > Expected
auto list_callback(iox2_node_state_e node_state, iox2_unique_node_id_ptr node_id_ptr, const char *executable, iox2_node_name_ptr node_name, iox2_config_ptr config, iox2_callback_context context) -> iox2_callback_progression_e
auto ctx(const T &ptr) -> CallbackContext< T >
NodeListFailure
All failures that can occur in [Node::list()].
uint64_t failed_cleanups
The number of failed dead node cleanups.
uint64_t cleanups
The number of successful dead node cleanups.