13#ifndef IOX2_WRITER_HPP
14#define IOX2_WRITER_HPP
26template <ServiceType S,
typename KeyType>
44 template <typename ValueType>
51 explicit
Writer(iox2_writer_h handle);
54 iox2_writer_h m_handle =
nullptr;
59 : m_handle { handle } {
62template <ServiceType S,
typename KeyType>
63inline void Writer<S, KeyType>::drop() {
64 if (m_handle !=
nullptr) {
65 iox2_writer_drop(m_handle);
70template <ServiceType S,
typename KeyType>
72 *
this = std::move(rhs);
75template <ServiceType S,
typename KeyType>
79 m_handle = rhs.m_handle;
80 rhs.m_handle =
nullptr;
86template <ServiceType S,
typename KeyType>
91template <ServiceType S,
typename KeyType>
93 iox2_unique_writer_id_h id_handle =
nullptr;
95 iox2_writer_id(&m_handle,
nullptr, &id_handle);
99template <ServiceType S,
typename KeyType>
101 const auto* port_name_ptr = iox2_writer_name(&m_handle);
105template <ServiceType S,
typename KeyType>
106template <
typename ValueType>
109 iox2_entry_handle_mut_h entry_handle {};
110 const auto type_name = internal::get_type_name<ValueType>();
112 auto result = iox2_writer_entry(&m_handle,
116 type_name.unchecked_access().c_str(),
121 if (result == IOX2_OK) {
125 return bb::err(bb::into<EntryHandleMutError>(result));
A handle for direct write access to a specific blackboard value.
Non-owning view of a [PortName].
static auto from_native_ptr(iox2_port_name_ptr m_ptr) -> PortNameView
Creates a [PortNameView] from a native [iox2_port_name_ptr].
The system-wide unique id of a [Writer].
Producing endpoint of a blackboard based communication.
Writer(Writer &&rhs) noexcept
auto id() const -> UniqueWriterId
Returns the [UniqueWriterId] of the [Writer].
auto entry(const KeyType &key) -> bb::Expected< EntryHandleMut< S, KeyType, ValueType >, EntryHandleMutError >
auto operator=(const Writer &) -> Writer &=delete
auto operator=(Writer &&rhs) noexcept -> Writer &
Writer(const Writer &)=delete
auto name() const -> PortNameView
Returns the [PortNameView] of the [Writer].
constexpr auto err(const E &error) -> Unexpected< E >
iox2::bb::variation::Expected< T, E > Expected
EntryHandleMutError
Defines a failure that can occur when a [EntryHandleMut] is created with [Writer::entry()].