Skip to content

Commit

Permalink
[#264] Adjust formatting to clang-format 19
Browse files Browse the repository at this point in the history
  • Loading branch information
elfenpiff committed Dec 18, 2024
1 parent 491b4a0 commit a2b03d0
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class CustomPublisher : public iox2::FileDescriptorBased {
.expect("");
}

static auto create(iox2::Node<iox2::ServiceType::Ipc>& node,
const iox2::ServiceName& service_name) -> CustomPublisher {
static auto create(iox2::Node<iox2::ServiceType::Ipc>& node, const iox2::ServiceName& service_name)
-> CustomPublisher {
auto pubsub_service = node.service_builder(service_name)
.publish_subscribe<TransmissionData>()
.history_size(HISTORY_SIZE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#ifndef IOX2_EXAMPLES_CUSTOM_SUBSCRIBER_HPP
#define IOX2_EXAMPLES_CUSTOM_SUBSCRIBER_HPP

#include "iox/into.hpp"
#include "iox2/file_descriptor.hpp"
#include "iox2/listener.hpp"
#include "iox2/node.hpp"
Expand Down Expand Up @@ -44,8 +43,8 @@ class CustomSubscriber : public iox2::FileDescriptorBased {
auto operator=(const CustomSubscriber&) -> CustomSubscriber& = delete;
auto operator=(CustomSubscriber&&) -> CustomSubscriber& = default;

static auto create(iox2::Node<iox2::ServiceType::Ipc>& node,
const iox2::ServiceName& service_name) -> CustomSubscriber {
static auto create(iox2::Node<iox2::ServiceType::Ipc>& node, const iox2::ServiceName& service_name)
-> CustomSubscriber {
auto pubsub_service =
node.service_builder(service_name).publish_subscribe<TransmissionData>().open_or_create().expect("");
auto event_service = node.service_builder(service_name).event().open_or_create().expect("");
Expand Down
113 changes: 65 additions & 48 deletions iceoryx2-ffi/cxx/include/iox2/enum_translation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ constexpr auto from<int, iox2::SemanticStringError>(const int value) noexcept ->
}

template <>
constexpr auto from<iox2::SemanticStringError, iox2_semantic_string_error_e>(
const iox2::SemanticStringError value) noexcept -> iox2_semantic_string_error_e {
constexpr auto
from<iox2::SemanticStringError, iox2_semantic_string_error_e>(const iox2::SemanticStringError value) noexcept
-> iox2_semantic_string_error_e {
switch (value) {
case iox2::SemanticStringError::InvalidContent:
return iox2_semantic_string_error_e_INVALID_CONTENT;
Expand Down Expand Up @@ -85,8 +86,8 @@ constexpr auto from<int, iox2::ServiceType>(const int value) noexcept -> iox2::S
}

template <>
constexpr auto
from<iox2::ServiceType, iox2_service_type_e>(const iox2::ServiceType value) noexcept -> iox2_service_type_e {
constexpr auto from<iox2::ServiceType, iox2_service_type_e>(const iox2::ServiceType value) noexcept
-> iox2_service_type_e {
switch (value) {
case iox2::ServiceType::Ipc:
return iox2_service_type_e_IPC;
Expand All @@ -111,8 +112,9 @@ constexpr auto from<int, iox2::NodeCreationFailure>(const int value) noexcept ->
}

template <>
constexpr auto from<iox2::NodeCreationFailure, iox2_node_creation_failure_e>(
const iox2::NodeCreationFailure value) noexcept -> iox2_node_creation_failure_e {
constexpr auto
from<iox2::NodeCreationFailure, iox2_node_creation_failure_e>(const iox2::NodeCreationFailure value) noexcept
-> iox2_node_creation_failure_e {
switch (value) {
case iox2::NodeCreationFailure::InsufficientPermissions:
return iox2_node_creation_failure_e_INSUFFICIENT_PERMISSIONS;
Expand Down Expand Up @@ -143,8 +145,9 @@ constexpr auto from<int, iox2::CallbackProgression>(const int value) noexcept ->
}

template <>
constexpr auto from<iox2::CallbackProgression, iox2_callback_progression_e>(
const iox2::CallbackProgression value) noexcept -> iox2_callback_progression_e {
constexpr auto
from<iox2::CallbackProgression, iox2_callback_progression_e>(const iox2::CallbackProgression value) noexcept
-> iox2_callback_progression_e {
switch (value) {
case iox2::CallbackProgression::Continue:
return iox2_callback_progression_e_CONTINUE;
Expand Down Expand Up @@ -258,8 +261,9 @@ constexpr auto from<int, iox2::ServiceDetailsError>(const int value) noexcept ->
}

template <>
constexpr auto from<iox2::ServiceDetailsError, iox2_service_details_error_e>(
const iox2::ServiceDetailsError value) noexcept -> iox2_service_details_error_e {
constexpr auto
from<iox2::ServiceDetailsError, iox2_service_details_error_e>(const iox2::ServiceDetailsError value) noexcept
-> iox2_service_details_error_e {
switch (value) {
case iox2::ServiceDetailsError::FailedToOpenStaticServiceInfo:
return iox2_service_details_error_e_FAILED_TO_OPEN_STATIC_SERVICE_INFO;
Expand Down Expand Up @@ -337,8 +341,9 @@ constexpr auto from<int, iox2::EventOpenOrCreateError>(const int value) noexcept
}

template <>
constexpr auto from<iox2::EventOpenOrCreateError, iox2_event_open_or_create_error_e>(
const iox2::EventOpenOrCreateError value) noexcept -> iox2_event_open_or_create_error_e {
constexpr auto
from<iox2::EventOpenOrCreateError, iox2_event_open_or_create_error_e>(const iox2::EventOpenOrCreateError value) noexcept
-> iox2_event_open_or_create_error_e {
switch (value) {
case iox2::EventOpenOrCreateError::OpenDoesNotExist:
return iox2_event_open_or_create_error_e_O_DOES_NOT_EXIST;
Expand Down Expand Up @@ -489,8 +494,9 @@ constexpr auto from<int, iox2::EventCreateError>(const int value) noexcept -> io
}

template <>
constexpr auto from<iox2::EventCreateError, iox2_event_open_or_create_error_e>(
const iox2::EventCreateError value) noexcept -> iox2_event_open_or_create_error_e {
constexpr auto
from<iox2::EventCreateError, iox2_event_open_or_create_error_e>(const iox2::EventCreateError value) noexcept
-> iox2_event_open_or_create_error_e {
switch (value) {
case iox2::EventCreateError::InsufficientPermissions:
return iox2_event_open_or_create_error_e_C_INSUFFICIENT_PERMISSIONS;
Expand Down Expand Up @@ -664,15 +670,14 @@ constexpr auto from<iox2::PublishSubscribeOpenError, iox2_pub_sub_open_or_create
}

template <>
inline auto
from<iox2::PublishSubscribeOpenError, const char*>(const iox2::PublishSubscribeOpenError value) noexcept -> const
char* {
inline auto from<iox2::PublishSubscribeOpenError, const char*>(const iox2::PublishSubscribeOpenError value) noexcept
-> const char* {
return iox2_pub_sub_open_or_create_error_string(iox::into<iox2_pub_sub_open_or_create_error_e>(value));
}

template <>
constexpr auto
from<int, iox2::PublishSubscribeCreateError>(const int value) noexcept -> iox2::PublishSubscribeCreateError {
constexpr auto from<int, iox2::PublishSubscribeCreateError>(const int value) noexcept
-> iox2::PublishSubscribeCreateError {
const auto error = static_cast<iox2_pub_sub_open_or_create_error_e>(value);
switch (error) {
case iox2_pub_sub_open_or_create_error_e_C_SERVICE_IN_CORRUPTED_STATE:
Expand Down Expand Up @@ -718,9 +723,8 @@ constexpr auto from<iox2::PublishSubscribeCreateError, iox2_pub_sub_open_or_crea
}

template <>
inline auto
from<iox2::PublishSubscribeCreateError, const char*>(const iox2::PublishSubscribeCreateError value) noexcept -> const
char* {
inline auto from<iox2::PublishSubscribeCreateError, const char*>(const iox2::PublishSubscribeCreateError value) noexcept
-> const char* {
return iox2_pub_sub_open_or_create_error_string(iox::into<iox2_pub_sub_open_or_create_error_e>(value));
}

Expand Down Expand Up @@ -784,8 +788,9 @@ constexpr auto from<iox2::PublishSubscribeOpenOrCreateError, iox2_pub_sub_open_o
}

template <>
inline auto from<iox2::PublishSubscribeOpenOrCreateError, const char*>(
const iox2::PublishSubscribeOpenOrCreateError value) noexcept -> const char* {
inline auto
from<iox2::PublishSubscribeOpenOrCreateError, const char*>(const iox2::PublishSubscribeOpenOrCreateError value) noexcept
-> const char* {
return iox2_pub_sub_open_or_create_error_string(iox::into<iox2_pub_sub_open_or_create_error_e>(value));
}

Expand All @@ -801,8 +806,9 @@ constexpr auto from<int, iox2::NotifierCreateError>(const int value) noexcept ->
}

template <>
constexpr auto from<iox2::NotifierCreateError, iox2_notifier_create_error_e>(
const iox2::NotifierCreateError value) noexcept -> iox2_notifier_create_error_e {
constexpr auto
from<iox2::NotifierCreateError, iox2_notifier_create_error_e>(const iox2::NotifierCreateError value) noexcept
-> iox2_notifier_create_error_e {
switch (value) {
case iox2::NotifierCreateError::ExceedsMaxSupportedNotifiers:
return iox2_notifier_create_error_e_EXCEEDS_MAX_SUPPORTED_NOTIFIERS;
Expand Down Expand Up @@ -831,8 +837,9 @@ constexpr auto from<int, iox2::ListenerCreateError>(const int value) noexcept ->
}

template <>
constexpr auto from<iox2::ListenerCreateError, iox2_listener_create_error_e>(
const iox2::ListenerCreateError value) noexcept -> iox2_listener_create_error_e {
constexpr auto
from<iox2::ListenerCreateError, iox2_listener_create_error_e>(const iox2::ListenerCreateError value) noexcept
-> iox2_listener_create_error_e {
switch (value) {
case iox2::ListenerCreateError::ExceedsMaxSupportedListeners:
return iox2_listener_create_error_e_EXCEEDS_MAX_SUPPORTED_LISTENERS;
Expand Down Expand Up @@ -861,8 +868,9 @@ constexpr auto from<int, iox2::NotifierNotifyError>(const int value) noexcept ->
}

template <>
constexpr auto from<iox2::NotifierNotifyError, iox2_notifier_notify_error_e>(
const iox2::NotifierNotifyError value) noexcept -> iox2_notifier_notify_error_e {
constexpr auto
from<iox2::NotifierNotifyError, iox2_notifier_notify_error_e>(const iox2::NotifierNotifyError value) noexcept
-> iox2_notifier_notify_error_e {
switch (value) {
case iox2::NotifierNotifyError::EventIdOutOfBounds:
return iox2_notifier_notify_error_e_EVENT_ID_OUT_OF_BOUNDS;
Expand Down Expand Up @@ -926,8 +934,9 @@ constexpr auto from<int, iox2::PublisherCreateError>(const int value) noexcept -
}

template <>
constexpr auto from<iox2::PublisherCreateError, iox2_publisher_create_error_e>(
const iox2::PublisherCreateError value) noexcept -> iox2_publisher_create_error_e {
constexpr auto
from<iox2::PublisherCreateError, iox2_publisher_create_error_e>(const iox2::PublisherCreateError value) noexcept
-> iox2_publisher_create_error_e {
switch (value) {
case iox2::PublisherCreateError::ExceedsMaxSupportedPublishers:
return iox2_publisher_create_error_e_EXCEEDS_MAX_SUPPORTED_PUBLISHERS;
Expand Down Expand Up @@ -958,8 +967,9 @@ constexpr auto from<int, iox2::SubscriberCreateError>(const int value) noexcept
}

template <>
constexpr auto from<iox2::SubscriberCreateError, iox2_subscriber_create_error_e>(
const iox2::SubscriberCreateError value) noexcept -> iox2_subscriber_create_error_e {
constexpr auto
from<iox2::SubscriberCreateError, iox2_subscriber_create_error_e>(const iox2::SubscriberCreateError value) noexcept
-> iox2_subscriber_create_error_e {
switch (value) {
case iox2::SubscriberCreateError::BufferSizeExceedsMaxSupportedBufferSizeOfService:
return iox2_subscriber_create_error_e_BUFFER_SIZE_EXCEEDS_MAX_SUPPORTED_BUFFER_SIZE_OF_SERVICE;
Expand Down Expand Up @@ -1000,8 +1010,9 @@ constexpr auto from<int, iox2::PublisherSendError>(const int value) noexcept ->
}

template <>
constexpr auto from<iox2::PublisherSendError, iox2_publisher_send_error_e>(
const iox2::PublisherSendError value) noexcept -> iox2_publisher_send_error_e {
constexpr auto
from<iox2::PublisherSendError, iox2_publisher_send_error_e>(const iox2::PublisherSendError value) noexcept
-> iox2_publisher_send_error_e {
switch (value) {
case iox2::PublisherSendError::ConnectionBrokenSincePublisherNoLongerExists:
return iox2_publisher_send_error_e_CONNECTION_BROKEN_SINCE_PUBLISHER_NO_LONGER_EXISTS;
Expand Down Expand Up @@ -1043,8 +1054,9 @@ constexpr auto from<int, iox2::SubscriberReceiveError>(const int value) noexcept
}

template <>
constexpr auto from<iox2::SubscriberReceiveError, iox2_subscriber_receive_error_e>(
const iox2::SubscriberReceiveError value) noexcept -> iox2_subscriber_receive_error_e {
constexpr auto
from<iox2::SubscriberReceiveError, iox2_subscriber_receive_error_e>(const iox2::SubscriberReceiveError value) noexcept
-> iox2_subscriber_receive_error_e {
switch (value) {
case iox2::SubscriberReceiveError::FailedToEstablishConnection:
return iox2_subscriber_receive_error_e_FAILED_TO_ESTABLISH_CONNECTION;
Expand Down Expand Up @@ -1081,8 +1093,9 @@ constexpr auto from<int, iox2::PublisherLoanError>(const int value) noexcept ->
}

template <>
constexpr auto from<iox2::PublisherLoanError, iox2_publisher_loan_error_e>(
const iox2::PublisherLoanError value) noexcept -> iox2_publisher_loan_error_e {
constexpr auto
from<iox2::PublisherLoanError, iox2_publisher_loan_error_e>(const iox2::PublisherLoanError value) noexcept
-> iox2_publisher_loan_error_e {
switch (value) {
case iox2::PublisherLoanError::ExceedsMaxLoanedSamples:
return iox2_publisher_loan_error_e_EXCEEDS_MAX_LOANED_SAMPLES;
Expand Down Expand Up @@ -1234,8 +1247,9 @@ constexpr auto from<int, iox2::ConfigCreationError>(const int value) noexcept ->
}

template <>
constexpr auto from<iox2::ConfigCreationError, iox2_config_creation_error_e>(
const iox2::ConfigCreationError value) noexcept -> iox2_config_creation_error_e {
constexpr auto
from<iox2::ConfigCreationError, iox2_config_creation_error_e>(const iox2::ConfigCreationError value) noexcept
-> iox2_config_creation_error_e {
switch (value) {
case iox2::ConfigCreationError::FailedToOpenConfigFile:
return iox2_config_creation_error_e_FAILED_TO_OPEN_CONFIG_FILE;
Expand Down Expand Up @@ -1306,8 +1320,9 @@ constexpr auto from<int, iox2::WaitSetCreateError>(const int value) noexcept ->
}

template <>
constexpr auto from<iox2::WaitSetCreateError, iox2_waitset_create_error_e>(
const iox2::WaitSetCreateError value) noexcept -> iox2_waitset_create_error_e {
constexpr auto
from<iox2::WaitSetCreateError, iox2_waitset_create_error_e>(const iox2::WaitSetCreateError value) noexcept
-> iox2_waitset_create_error_e {
switch (value) {
case iox2::WaitSetCreateError::InternalError:
return iox2_waitset_create_error_e_INTERNAL_ERROR;
Expand Down Expand Up @@ -1371,8 +1386,9 @@ constexpr auto from<int, iox2::WaitSetAttachmentError>(const int value) noexcept
}

template <>
constexpr auto from<iox2::WaitSetAttachmentError, iox2_waitset_attachment_error_e>(
const iox2::WaitSetAttachmentError value) noexcept -> iox2_waitset_attachment_error_e {
constexpr auto
from<iox2::WaitSetAttachmentError, iox2_waitset_attachment_error_e>(const iox2::WaitSetAttachmentError value) noexcept
-> iox2_waitset_attachment_error_e {
switch (value) {
case iox2::WaitSetAttachmentError::AlreadyAttached:
return iox2_waitset_attachment_error_e_ALREADY_ATTACHED;
Expand Down Expand Up @@ -1435,8 +1451,9 @@ inline auto from<iox2::WaitSetRunError, const char*>(const iox2::WaitSetRunError
}

template <>
constexpr auto from<iox2::SignalHandlingMode, iox2_signal_handling_mode_e>(
const iox2::SignalHandlingMode value) noexcept -> iox2_signal_handling_mode_e {
constexpr auto
from<iox2::SignalHandlingMode, iox2_signal_handling_mode_e>(const iox2::SignalHandlingMode value) noexcept
-> iox2_signal_handling_mode_e {
switch (value) {
case iox2::SignalHandlingMode::Disabled:
return iox2_signal_handling_mode_e_DISABLED;
Expand Down
5 changes: 2 additions & 3 deletions iceoryx2-ffi/cxx/include/iox2/service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ template <ServiceType S>
class Service {
public:
/// Checks if a service under a given [`ConfigView`] does exist.
static auto does_exist(const ServiceName& service_name,
ConfigView config,
MessagingPattern messaging_pattern) -> iox::expected<bool, ServiceDetailsError>;
static auto does_exist(const ServiceName& service_name, ConfigView config, MessagingPattern messaging_pattern)
-> iox::expected<bool, ServiceDetailsError>;

/// Acquires the [`ServiceDetails`] of a [`Service`].
static auto details(const ServiceName& service_name, ConfigView config, MessagingPattern messaging_pattern)
Expand Down
4 changes: 2 additions & 2 deletions iceoryx2-ffi/cxx/src/service_name.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ auto ServiceName::create(const char* value) -> iox::expected<ServiceName, Semant
return ServiceName::create_impl(value, strnlen(value, IOX2_SERVICE_NAME_LENGTH + 1));
}

auto ServiceName::create_impl(const char* value,
const size_t value_len) -> iox::expected<ServiceName, SemanticStringError> {
auto ServiceName::create_impl(const char* value, const size_t value_len)
-> iox::expected<ServiceName, SemanticStringError> {
iox2_service_name_h handle {};
if (value_len > IOX2_SERVICE_NAME_LENGTH) {
return iox::err(SemanticStringError::ExceedsMaximumLength);
Expand Down
4 changes: 2 additions & 2 deletions iceoryx2-ffi/cxx/src/waitset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ auto WaitSet<S>::wait_and_process_once(const iox::function<CallbackProgression(W

template <ServiceType S>
auto WaitSet<S>::wait_and_process_once_with_timeout(
const iox::function<CallbackProgression(WaitSetAttachmentId<S>)>& fn_call,
const iox::units::Duration timeout) -> iox::expected<WaitSetRunResult, WaitSetRunError> {
const iox::function<CallbackProgression(WaitSetAttachmentId<S>)>& fn_call, const iox::units::Duration timeout)
-> iox::expected<WaitSetRunResult, WaitSetRunError> {
iox2_waitset_run_result_e run_result = iox2_waitset_run_result_e_STOP_REQUEST;
auto ctx = internal::ctx(fn_call);
auto timeout_secs = timeout.toSeconds();
Expand Down
2 changes: 1 addition & 1 deletion iceoryx2-ffi/cxx/tests/src/service_event_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ TYPED_TEST(ServiceEventTest, timed_wait_one_does_not_deadlock) {
}

TYPED_TEST(ServiceEventTest, timed_wait_all_does_not_deadlock) {
this->listener.timed_wait_all([](auto) {}, TIMEOUT).expect("");
this->listener.timed_wait_all([](auto) { }, TIMEOUT).expect("");
}

TYPED_TEST(ServiceEventTest, service_can_be_opened_when_there_is_a_notifier) {
Expand Down

0 comments on commit a2b03d0

Please sign in to comment.