13#ifndef IOX2_PORTFACTORY_BLACKBOARD_HPP
14#define IOX2_PORTFACTORY_BLACKBOARD_HPP
22#include "iox2/iceoryx2.h"
35template <ServiceType S,
typename KeyType>
101 void drop() noexcept;
103 iox2_port_factory_blackboard_h m_handle =
nullptr;
108 : m_handle { handle } {
111template <ServiceType S,
typename KeyType>
112inline void PortFactoryBlackboard<S, KeyType>::drop() noexcept {
113 if (m_handle !=
nullptr) {
114 iox2_port_factory_blackboard_drop(m_handle);
119template <ServiceType S,
typename KeyType>
121 *
this = std::move(rhs);
124template <ServiceType S,
typename KeyType>
129 m_handle = rhs.m_handle;
130 rhs.m_handle =
nullptr;
136template <ServiceType S,
typename KeyType>
141template <ServiceType S,
typename KeyType>
143 const auto* service_name_ptr = iox2_port_factory_blackboard_service_name(&m_handle);
147template <ServiceType S,
typename KeyType>
151 iox2_port_factory_blackboard_service_hash(&m_handle, &buffer[0], IOX2_SERVICE_HASH_LENGTH);
156 IOX2_SERVICE_HASH_LENGTH));
159template <ServiceType S,
typename KeyType>
161 return AttributeSetView(iox2_port_factory_blackboard_attributes(&m_handle));
164template <ServiceType S,
typename KeyType>
167 iox2_port_factory_blackboard_static_config(&m_handle, &
static_config);
172template <ServiceType S,
typename KeyType>
177template <ServiceType S,
typename KeyType>
184 iox2_port_factory_blackboard_nodes(&m_handle, internal::list_callback<S>,
static_cast<void*
>(&ctx));
186 if (ret_val == IOX2_OK) {
190 return bb::err(bb::into<NodeListFailure>(ret_val));
193template <ServiceType S,
typename KeyType>
195 iox2_cleanup_state_t cleanup_state {};
197 iox2_port_factory_blackboard_try_cleanup_dead_nodes(&m_handle, &cleanup_state);
200 ret_val.
cleanups = cleanup_state.cleanups;
201 ret_val.failed_cleanups = cleanup_state.failed_cleanups;
205template <ServiceType T,
typename KeyType>
208 iox2_cleanup_state_t cleanup_state {};
210 iox2_port_factory_blackboard_blocking_cleanup_dead_nodes(
211 &m_handle, &cleanup_state, timeout.as_secs(), timeout.subsec_nanos());
214 ret_val.
cleanups = cleanup_state.cleanups;
215 ret_val.failed_cleanups = cleanup_state.failed_cleanups;
219template <ServiceType S,
typename KeyType>
224template <ServiceType S,
typename KeyType>
229template <
typename KeyType>
232 auto result = (*callback)(*
static_cast<const KeyType* const
>(key_ptr));
233 return iox2::bb::into<iox2_callback_progression_e>(result);
236template <ServiceType S,
typename KeyType>
239 auto mutable_callback = callback;
240 iox2_port_factory_blackboard_list_keys(&m_handle, list_keys_callback<KeyType>, &mutable_callback);
Describes the state of a [Node].
Represents the port factory of a [Service] with [MessagingPattern::Blackboard].
auto dynamic_config() const -> DynamicConfigBlackboard
PortFactoryBlackboard(const PortFactoryBlackboard &)=delete
void list_keys(const iox2::bb::StaticFunction< CallbackProgression(const KeyType &)> &callback) const
auto static_config() const -> StaticConfigBlackboard
auto attributes() const -> AttributeSetView
Returns the attributes defined in the [Service].
auto blocking_cleanup_dead_nodes(iox2::bb::Duration timeout) const -> CleanupState
auto writer_builder() const -> PortFactoryWriter< S, KeyType >
Returns a [PortFactoryWriter] to create a new [Writer] port.
auto service_hash() const -> ServiceHash
Returns the [ServiceHash] of the [Service].
auto operator=(const PortFactoryBlackboard &) -> PortFactoryBlackboard &=delete
PortFactoryBlackboard(PortFactoryBlackboard &&rhs) noexcept
auto name() const -> ServiceNameView
Returns the [ServiceName] of the service.
auto try_cleanup_dead_nodes() const -> CleanupState
auto reader_builder() const -> PortFactoryReader< S, KeyType >
Returns a [PortFactoryReader] to create a new [Reader] port.
auto nodes(const iox2::bb::StaticFunction< CallbackProgression(NodeState< S >)> &callback) const -> bb::Expected< void, NodeListFailure >
auto operator=(PortFactoryBlackboard &&rhs) noexcept -> PortFactoryBlackboard &
Builder to create new [MessagingPattern::Blackboard] 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 >
auto list_keys_callback(const void *const key_ptr, void *ctx) -> iox2_callback_progression_e
NodeListFailure
All failures that can occur in [Node::list()].
uint64_t cleanups
The number of successful dead node cleanups.