Skip to content

Commit

Permalink
[#500] UniquePortId::bytes() return const ref
Browse files Browse the repository at this point in the history
  • Loading branch information
orecham committed Nov 15, 2024
1 parent 5703e94 commit 6737410
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions iceoryx2-ffi/cxx/include/iox2/unique_port_id.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class UniquePublisherId {
auto operator=(UniquePublisherId&& rhs) noexcept -> UniquePublisherId&;
~UniquePublisherId();

auto bytes() -> iox::optional<RawIdType>&;
auto bytes() -> const iox::optional<RawIdType>&;

private:
template <ServiceType, typename, typename>
Expand All @@ -56,7 +56,7 @@ class UniqueSubscriberId {
auto operator=(UniqueSubscriberId&& rhs) noexcept -> UniqueSubscriberId&;
~UniqueSubscriberId();

auto bytes() -> iox::optional<RawIdType>&;
auto bytes() -> const iox::optional<RawIdType>&;

private:
template <ServiceType, typename, typename>
Expand All @@ -80,7 +80,7 @@ class UniqueNotifierId {
auto operator=(UniqueNotifierId&& rhs) noexcept -> UniqueNotifierId&;
~UniqueNotifierId();

auto bytes() -> iox::optional<RawIdType>&;
auto bytes() -> const iox::optional<RawIdType>&;

private:
template <ServiceType>
Expand All @@ -104,7 +104,7 @@ class UniqueListenerId {
auto operator=(UniqueListenerId&& rhs) noexcept -> UniqueListenerId&;
~UniqueListenerId();

auto bytes() -> iox::optional<RawIdType>&;
auto bytes() -> const iox::optional<RawIdType>&;

private:
template <ServiceType>
Expand Down
8 changes: 4 additions & 4 deletions iceoryx2-ffi/cxx/src/unique_port_id.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ UniquePublisherId::UniquePublisherId(iox2_unique_publisher_id_h handle)
: m_handle { handle } {
}

auto UniquePublisherId::bytes() -> iox::optional<RawIdType>& {
auto UniquePublisherId::bytes() -> const iox::optional<RawIdType>& {
if (!m_raw_id.has_value() && m_handle != nullptr) {
RawIdType bytes { UNIQUE_PORT_ID_LENGTH, 0 };
iox2_unique_publisher_id_value(m_handle, bytes.data(), bytes.size());
Expand Down Expand Up @@ -90,7 +90,7 @@ UniqueSubscriberId::UniqueSubscriberId(iox2_unique_subscriber_id_h handle)
: m_handle { handle } {
}

auto UniqueSubscriberId::bytes() -> iox::optional<RawIdType>& {
auto UniqueSubscriberId::bytes() -> const iox::optional<RawIdType>& {
if (!m_raw_id.has_value() && m_handle != nullptr) {
RawIdType bytes { UNIQUE_PORT_ID_LENGTH, 0 };
iox2_unique_subscriber_id_value(m_handle, bytes.data(), bytes.size());
Expand Down Expand Up @@ -136,7 +136,7 @@ UniqueNotifierId::UniqueNotifierId(iox2_unique_notifier_id_h handle)
: m_handle { handle } {
}

auto UniqueNotifierId::bytes() -> iox::optional<RawIdType>& {
auto UniqueNotifierId::bytes() -> const iox::optional<RawIdType>& {
if (!m_raw_id.has_value() && m_handle != nullptr) {
RawIdType bytes { UNIQUE_PORT_ID_LENGTH, 0 };
iox2_unique_notifier_id_value(m_handle, bytes.data(), bytes.size());
Expand Down Expand Up @@ -182,7 +182,7 @@ UniqueListenerId::UniqueListenerId(iox2_unique_listener_id_h handle)
: m_handle { handle } {
}

auto UniqueListenerId::bytes() -> iox::optional<RawIdType>& {
auto UniqueListenerId::bytes() -> const iox::optional<RawIdType>& {
if (!m_raw_id.has_value() && m_handle != nullptr) {
RawIdType bytes { UNIQUE_PORT_ID_LENGTH, 0 };
iox2_unique_listener_id_value(m_handle, bytes.data(), bytes.size());
Expand Down

0 comments on commit 6737410

Please sign in to comment.