From a2b03d0bb93c17c742deabe7d1933f65ba66d751 Mon Sep 17 00:00:00 2001 From: Christian Eltzschig Date: Wed, 18 Dec 2024 15:31:45 +0100 Subject: [PATCH] [#264] Adjust formatting to clang-format 19 --- .../src/custom_publisher.hpp | 4 +- .../src/custom_subscriber.hpp | 5 +- .../cxx/include/iox2/enum_translation.hpp | 113 ++++++++++-------- iceoryx2-ffi/cxx/include/iox2/service.hpp | 5 +- iceoryx2-ffi/cxx/src/service_name.cpp | 4 +- iceoryx2-ffi/cxx/src/waitset.cpp | 4 +- .../cxx/tests/src/service_event_tests.cpp | 2 +- 7 files changed, 76 insertions(+), 61 deletions(-) diff --git a/examples/cxx/event_based_communication/src/custom_publisher.hpp b/examples/cxx/event_based_communication/src/custom_publisher.hpp index 8b96e1fce..5dcc63f7a 100644 --- a/examples/cxx/event_based_communication/src/custom_publisher.hpp +++ b/examples/cxx/event_based_communication/src/custom_publisher.hpp @@ -41,8 +41,8 @@ class CustomPublisher : public iox2::FileDescriptorBased { .expect(""); } - static auto create(iox2::Node& node, - const iox2::ServiceName& service_name) -> CustomPublisher { + static auto create(iox2::Node& node, const iox2::ServiceName& service_name) + -> CustomPublisher { auto pubsub_service = node.service_builder(service_name) .publish_subscribe() .history_size(HISTORY_SIZE) diff --git a/examples/cxx/event_based_communication/src/custom_subscriber.hpp b/examples/cxx/event_based_communication/src/custom_subscriber.hpp index 566662290..31d684085 100644 --- a/examples/cxx/event_based_communication/src/custom_subscriber.hpp +++ b/examples/cxx/event_based_communication/src/custom_subscriber.hpp @@ -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" @@ -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& node, - const iox2::ServiceName& service_name) -> CustomSubscriber { + static auto create(iox2::Node& node, const iox2::ServiceName& service_name) + -> CustomSubscriber { auto pubsub_service = node.service_builder(service_name).publish_subscribe().open_or_create().expect(""); auto event_service = node.service_builder(service_name).event().open_or_create().expect(""); diff --git a/iceoryx2-ffi/cxx/include/iox2/enum_translation.hpp b/iceoryx2-ffi/cxx/include/iox2/enum_translation.hpp index a002182a4..3c33ee94b 100644 --- a/iceoryx2-ffi/cxx/include/iox2/enum_translation.hpp +++ b/iceoryx2-ffi/cxx/include/iox2/enum_translation.hpp @@ -53,8 +53,9 @@ constexpr auto from(const int value) noexcept -> } template <> -constexpr auto from( - const iox2::SemanticStringError value) noexcept -> iox2_semantic_string_error_e { +constexpr auto +from(const iox2::SemanticStringError value) noexcept + -> iox2_semantic_string_error_e { switch (value) { case iox2::SemanticStringError::InvalidContent: return iox2_semantic_string_error_e_INVALID_CONTENT; @@ -85,8 +86,8 @@ constexpr auto from(const int value) noexcept -> iox2::S } template <> -constexpr auto -from(const iox2::ServiceType value) noexcept -> iox2_service_type_e { +constexpr auto from(const iox2::ServiceType value) noexcept + -> iox2_service_type_e { switch (value) { case iox2::ServiceType::Ipc: return iox2_service_type_e_IPC; @@ -111,8 +112,9 @@ constexpr auto from(const int value) noexcept -> } template <> -constexpr auto from( - const iox2::NodeCreationFailure value) noexcept -> iox2_node_creation_failure_e { +constexpr auto +from(const iox2::NodeCreationFailure value) noexcept + -> iox2_node_creation_failure_e { switch (value) { case iox2::NodeCreationFailure::InsufficientPermissions: return iox2_node_creation_failure_e_INSUFFICIENT_PERMISSIONS; @@ -143,8 +145,9 @@ constexpr auto from(const int value) noexcept -> } template <> -constexpr auto from( - const iox2::CallbackProgression value) noexcept -> iox2_callback_progression_e { +constexpr auto +from(const iox2::CallbackProgression value) noexcept + -> iox2_callback_progression_e { switch (value) { case iox2::CallbackProgression::Continue: return iox2_callback_progression_e_CONTINUE; @@ -258,8 +261,9 @@ constexpr auto from(const int value) noexcept -> } template <> -constexpr auto from( - const iox2::ServiceDetailsError value) noexcept -> iox2_service_details_error_e { +constexpr auto +from(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; @@ -337,8 +341,9 @@ constexpr auto from(const int value) noexcept } template <> -constexpr auto from( - const iox2::EventOpenOrCreateError value) noexcept -> iox2_event_open_or_create_error_e { +constexpr auto +from(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; @@ -489,8 +494,9 @@ constexpr auto from(const int value) noexcept -> io } template <> -constexpr auto from( - const iox2::EventCreateError value) noexcept -> iox2_event_open_or_create_error_e { +constexpr auto +from(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; @@ -664,15 +670,14 @@ constexpr auto from -inline auto -from(const iox2::PublishSubscribeOpenError value) noexcept -> const - char* { +inline auto from(const iox2::PublishSubscribeOpenError value) noexcept + -> const char* { return iox2_pub_sub_open_or_create_error_string(iox::into(value)); } template <> -constexpr auto -from(const int value) noexcept -> iox2::PublishSubscribeCreateError { +constexpr auto from(const int value) noexcept + -> iox2::PublishSubscribeCreateError { const auto error = static_cast(value); switch (error) { case iox2_pub_sub_open_or_create_error_e_C_SERVICE_IN_CORRUPTED_STATE: @@ -718,9 +723,8 @@ constexpr auto from -inline auto -from(const iox2::PublishSubscribeCreateError value) noexcept -> const - char* { +inline auto from(const iox2::PublishSubscribeCreateError value) noexcept + -> const char* { return iox2_pub_sub_open_or_create_error_string(iox::into(value)); } @@ -784,8 +788,9 @@ constexpr auto from -inline auto from( - const iox2::PublishSubscribeOpenOrCreateError value) noexcept -> const char* { +inline auto +from(const iox2::PublishSubscribeOpenOrCreateError value) noexcept + -> const char* { return iox2_pub_sub_open_or_create_error_string(iox::into(value)); } @@ -801,8 +806,9 @@ constexpr auto from(const int value) noexcept -> } template <> -constexpr auto from( - const iox2::NotifierCreateError value) noexcept -> iox2_notifier_create_error_e { +constexpr auto +from(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; @@ -831,8 +837,9 @@ constexpr auto from(const int value) noexcept -> } template <> -constexpr auto from( - const iox2::ListenerCreateError value) noexcept -> iox2_listener_create_error_e { +constexpr auto +from(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; @@ -861,8 +868,9 @@ constexpr auto from(const int value) noexcept -> } template <> -constexpr auto from( - const iox2::NotifierNotifyError value) noexcept -> iox2_notifier_notify_error_e { +constexpr auto +from(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; @@ -926,8 +934,9 @@ constexpr auto from(const int value) noexcept - } template <> -constexpr auto from( - const iox2::PublisherCreateError value) noexcept -> iox2_publisher_create_error_e { +constexpr auto +from(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; @@ -958,8 +967,9 @@ constexpr auto from(const int value) noexcept } template <> -constexpr auto from( - const iox2::SubscriberCreateError value) noexcept -> iox2_subscriber_create_error_e { +constexpr auto +from(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; @@ -1000,8 +1010,9 @@ constexpr auto from(const int value) noexcept -> } template <> -constexpr auto from( - const iox2::PublisherSendError value) noexcept -> iox2_publisher_send_error_e { +constexpr auto +from(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; @@ -1043,8 +1054,9 @@ constexpr auto from(const int value) noexcept } template <> -constexpr auto from( - const iox2::SubscriberReceiveError value) noexcept -> iox2_subscriber_receive_error_e { +constexpr auto +from(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; @@ -1081,8 +1093,9 @@ constexpr auto from(const int value) noexcept -> } template <> -constexpr auto from( - const iox2::PublisherLoanError value) noexcept -> iox2_publisher_loan_error_e { +constexpr auto +from(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; @@ -1234,8 +1247,9 @@ constexpr auto from(const int value) noexcept -> } template <> -constexpr auto from( - const iox2::ConfigCreationError value) noexcept -> iox2_config_creation_error_e { +constexpr auto +from(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; @@ -1306,8 +1320,9 @@ constexpr auto from(const int value) noexcept -> } template <> -constexpr auto from( - const iox2::WaitSetCreateError value) noexcept -> iox2_waitset_create_error_e { +constexpr auto +from(const iox2::WaitSetCreateError value) noexcept + -> iox2_waitset_create_error_e { switch (value) { case iox2::WaitSetCreateError::InternalError: return iox2_waitset_create_error_e_INTERNAL_ERROR; @@ -1371,8 +1386,9 @@ constexpr auto from(const int value) noexcept } template <> -constexpr auto from( - const iox2::WaitSetAttachmentError value) noexcept -> iox2_waitset_attachment_error_e { +constexpr auto +from(const iox2::WaitSetAttachmentError value) noexcept + -> iox2_waitset_attachment_error_e { switch (value) { case iox2::WaitSetAttachmentError::AlreadyAttached: return iox2_waitset_attachment_error_e_ALREADY_ATTACHED; @@ -1435,8 +1451,9 @@ inline auto from(const iox2::WaitSetRunError } template <> -constexpr auto from( - const iox2::SignalHandlingMode value) noexcept -> iox2_signal_handling_mode_e { +constexpr auto +from(const iox2::SignalHandlingMode value) noexcept + -> iox2_signal_handling_mode_e { switch (value) { case iox2::SignalHandlingMode::Disabled: return iox2_signal_handling_mode_e_DISABLED; diff --git a/iceoryx2-ffi/cxx/include/iox2/service.hpp b/iceoryx2-ffi/cxx/include/iox2/service.hpp index a7f82459d..39d69a1c4 100644 --- a/iceoryx2-ffi/cxx/include/iox2/service.hpp +++ b/iceoryx2-ffi/cxx/include/iox2/service.hpp @@ -33,9 +33,8 @@ template 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; + static auto does_exist(const ServiceName& service_name, ConfigView config, MessagingPattern messaging_pattern) + -> iox::expected; /// Acquires the [`ServiceDetails`] of a [`Service`]. static auto details(const ServiceName& service_name, ConfigView config, MessagingPattern messaging_pattern) diff --git a/iceoryx2-ffi/cxx/src/service_name.cpp b/iceoryx2-ffi/cxx/src/service_name.cpp index e3f8fc439..fe7b49cb3 100644 --- a/iceoryx2-ffi/cxx/src/service_name.cpp +++ b/iceoryx2-ffi/cxx/src/service_name.cpp @@ -86,8 +86,8 @@ auto ServiceName::create(const char* value) -> iox::expected iox::expected { +auto ServiceName::create_impl(const char* value, const size_t value_len) + -> iox::expected { iox2_service_name_h handle {}; if (value_len > IOX2_SERVICE_NAME_LENGTH) { return iox::err(SemanticStringError::ExceedsMaximumLength); diff --git a/iceoryx2-ffi/cxx/src/waitset.cpp b/iceoryx2-ffi/cxx/src/waitset.cpp index d933c2b39..d05f49a13 100644 --- a/iceoryx2-ffi/cxx/src/waitset.cpp +++ b/iceoryx2-ffi/cxx/src/waitset.cpp @@ -329,8 +329,8 @@ auto WaitSet::wait_and_process_once(const iox::function auto WaitSet::wait_and_process_once_with_timeout( - const iox::function)>& fn_call, - const iox::units::Duration timeout) -> iox::expected { + const iox::function)>& fn_call, const iox::units::Duration timeout) + -> iox::expected { 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(); diff --git a/iceoryx2-ffi/cxx/tests/src/service_event_tests.cpp b/iceoryx2-ffi/cxx/tests/src/service_event_tests.cpp index b29fc577b..463858841 100644 --- a/iceoryx2-ffi/cxx/tests/src/service_event_tests.cpp +++ b/iceoryx2-ffi/cxx/tests/src/service_event_tests.cpp @@ -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) {