Skip to content

Commit

Permalink
[eclipse-iceoryx#210] Run clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
elBoberido committed Sep 28, 2024
1 parent f230a93 commit f08b0b3
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 52 deletions.
8 changes: 3 additions & 5 deletions iceoryx2-ffi/cxx/include/iox/builder_addendum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,16 @@
} \
\
private: \
type m_##name { \
defaultValue \
}
type m_##name { defaultValue }

#define IOX_BUILDER_OPTIONAL(type, name) \
public: \
auto name(type const& value)&& -> decltype(auto) { \
auto name(type const& value)&&->decltype(auto) { \
m_##name = iox::optional(value); \
return std::move(*this); \
} \
\
auto name(type&& value)&& -> decltype(auto) { \
auto name(type&& value)&&->decltype(auto) { \
m_##name = iox::optional(std::move(value)); \
return std::move(*this); \
} \
Expand Down
13 changes: 7 additions & 6 deletions iceoryx2-ffi/cxx/include/iox2/enum_translation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,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 Down Expand Up @@ -102,8 +102,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 @@ -393,8 +394,8 @@ constexpr auto from<int, iox2::PublishSubscribeOpenError>(const int value) noexc
}

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
8 changes: 4 additions & 4 deletions iceoryx2-ffi/cxx/include/iox2/listener.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ class Listener {
/// currently available [`EventId`]s in buffer.
/// For every received [`EventId`] the provided callback is called with the [`EventId`] as
/// input argument.
auto timed_wait_all(const iox::function<void(EventId)>& callback,
const iox::units::Duration& timeout) -> iox::expected<void, ListenerWaitError>;
auto timed_wait_all(const iox::function<void(EventId)>& callback, const iox::units::Duration& timeout)
-> iox::expected<void, ListenerWaitError>;

/// Blocking wait for new [`EventId`]s. Collects either
/// all [`EventId`]s that were received
Expand All @@ -71,8 +71,8 @@ class Listener {
/// has passed. If no [`EventId`] was notified it returns [`None`].
/// On error it returns [`ListenerWaitError`] is returned which describes the error
/// in detail.
auto
timed_wait_one(const iox::units::Duration& timeout) -> iox::expected<iox::optional<EventId>, ListenerWaitError>;
auto timed_wait_one(const iox::units::Duration& timeout)
-> iox::expected<iox::optional<EventId>, ListenerWaitError>;

/// Blocking wait for a new [`EventId`].
/// Sporadic wakeups can occur and if no [`EventId`] was notified it returns [`None`].
Expand Down
8 changes: 3 additions & 5 deletions iceoryx2-ffi/cxx/include/iox2/node_name.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@ class NodeNameView {
friend class Node;
friend class NodeName;
template <ServiceType>
friend auto list_callback(iox2_node_state_e,
iox2_node_id_ptr,
iox2_node_name_ptr,
iox2_config_ptr,
iox2_callback_context) -> iox2_callback_progression_e;
friend auto
list_callback(iox2_node_state_e, iox2_node_id_ptr, iox2_node_name_ptr, iox2_config_ptr, iox2_callback_context)
-> iox2_callback_progression_e;

explicit NodeNameView(iox2_node_name_ptr ptr);
iox2_node_name_ptr m_ptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ inline auto PortFactoryPublishSubscribe<S, Payload, UserHeader>::static_config()
}

template <ServiceType S, typename Payload, typename UserHeader>
inline auto
PortFactoryPublishSubscribe<S, Payload, UserHeader>::dynamic_config() const -> const DynamicConfigPublishSubscribe& {
inline auto PortFactoryPublishSubscribe<S, Payload, UserHeader>::dynamic_config() const
-> const DynamicConfigPublishSubscribe& {
IOX_TODO();
}

Expand Down
3 changes: 1 addition & 2 deletions iceoryx2-ffi/cxx/include/iox2/port_factory_subscriber.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ template <ServiceType S, typename Payload, typename UserHeader>
inline auto
PortFactorySubscriber<S, Payload, UserHeader>::create() && -> iox::expected<Subscriber<S, Payload, UserHeader>,
SubscriberCreateError> {
m_buffer_size.and_then(
[&](auto value) { iox2_port_factory_subscriber_builder_set_buffer_size(&m_handle, value); });
m_buffer_size.and_then([&](auto value) { iox2_port_factory_subscriber_builder_set_buffer_size(&m_handle, value); });

iox2_subscriber_h sub_handle {};
auto result = iox2_port_factory_subscriber_builder_create(m_handle, nullptr, &sub_handle);
Expand Down
8 changes: 4 additions & 4 deletions iceoryx2-ffi/cxx/include/iox2/publisher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ inline auto Publisher<S, Payload, UserHeader>::send_copy(const Payload& payload)
static_assert(std::is_trivially_copyable<Payload>::value);

size_t number_of_recipients = 0;
auto result = iox2_publisher_send_copy(
&m_handle, static_cast<const void*>(&payload), sizeof(Payload), &number_of_recipients);
auto result =
iox2_publisher_send_copy(&m_handle, static_cast<const void*>(&payload), sizeof(Payload), &number_of_recipients);

if (result == IOX2_OK) {
return iox::ok(number_of_recipients);
Expand All @@ -178,8 +178,8 @@ inline auto Publisher<S, Payload, UserHeader>::loan_uninit()
}

template <ServiceType S, typename Payload, typename UserHeader>
inline auto
Publisher<S, Payload, UserHeader>::loan() -> iox::expected<SampleMut<S, Payload, UserHeader>, PublisherLoanError> {
inline auto Publisher<S, Payload, UserHeader>::loan()
-> iox::expected<SampleMut<S, Payload, UserHeader>, PublisherLoanError> {
auto sample = loan_uninit();

if (sample.has_error()) {
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
28 changes: 11 additions & 17 deletions iceoryx2-ffi/cxx/include/iox2/service_builder_publish_subscribe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,16 @@ class ServiceBuilderPublishSubscribe {
/// created. It defines a set of attributes. If the [`Service`] already exists all attribute
/// requirements must be satisfied otherwise the open process will fail. If the [`Service`]
/// does not exist the required attributes will be defined in the [`Service`].
auto open_or_create_with_attributes(
const AttributeVerifier&
required_attributes) && -> iox::expected<PortFactoryPublishSubscribe<S, Payload, UserHeader>,
PublishSubscribeOpenOrCreateError>;
auto open_or_create_with_attributes(const AttributeVerifier& required_attributes) && -> iox::
expected<PortFactoryPublishSubscribe<S, Payload, UserHeader>, PublishSubscribeOpenOrCreateError>;

/// Opens an existing [`Service`].
auto open() && -> iox::expected<PortFactoryPublishSubscribe<S, Payload, UserHeader>, PublishSubscribeOpenError>;

/// Opens an existing [`Service`] with attribute requirements. If the defined attribute
/// requirements are not satisfied the open process will fail.
auto open_with_attributes(
const AttributeVerifier&
required_attributes) && -> iox::expected<PortFactoryPublishSubscribe<S, Payload, UserHeader>,
PublishSubscribeOpenError>;
auto open_with_attributes(const AttributeVerifier& required_attributes) && -> iox::
expected<PortFactoryPublishSubscribe<S, Payload, UserHeader>, PublishSubscribeOpenError>;

/// Creates a new [`Service`].
auto create() && -> iox::expected<PortFactoryPublishSubscribe<S, Payload, UserHeader>, PublishSubscribeCreateError>;
Expand Down Expand Up @@ -133,8 +129,7 @@ inline void ServiceBuilderPublishSubscribe<Payload, UserHeader, S>::set_paramete
m_history_size.and_then([&](auto value) { iox2_service_builder_pub_sub_set_history_size(&m_handle, value); });
m_subscriber_max_buffer_size.and_then(
[&](auto value) { iox2_service_builder_pub_sub_set_subscriber_max_buffer_size(&m_handle, value); });
m_max_subscribers.and_then(
[&](auto value) { iox2_service_builder_pub_sub_set_max_subscribers(&m_handle, value); });
m_max_subscribers.and_then([&](auto value) { iox2_service_builder_pub_sub_set_max_subscribers(&m_handle, value); });
m_max_publishers.and_then([&](auto value) { iox2_service_builder_pub_sub_set_max_publishers(&m_handle, value); });
m_max_nodes.and_then([&](auto value) { iox2_service_builder_pub_sub_set_max_nodes(&m_handle, value); });

Expand Down Expand Up @@ -185,9 +180,8 @@ inline auto ServiceBuilderPublishSubscribe<Payload, UserHeader, S>::
}

template <typename Payload, typename UserHeader, ServiceType S>
inline auto ServiceBuilderPublishSubscribe<Payload, UserHeader, S>::
open_or_create() && -> iox::expected<PortFactoryPublishSubscribe<S, Payload, UserHeader>,
PublishSubscribeOpenOrCreateError> {
inline auto ServiceBuilderPublishSubscribe<Payload, UserHeader, S>::open_or_create() && -> iox::
expected<PortFactoryPublishSubscribe<S, Payload, UserHeader>, PublishSubscribeOpenOrCreateError> {
set_parameters();

iox2_port_factory_pub_sub_h port_factory_handle {};
Expand All @@ -201,8 +195,8 @@ inline auto ServiceBuilderPublishSubscribe<Payload, UserHeader, S>::
}

template <typename Payload, typename UserHeader, ServiceType S>
inline auto ServiceBuilderPublishSubscribe<Payload, UserHeader, S>::
open() && -> iox::expected<PortFactoryPublishSubscribe<S, Payload, UserHeader>, PublishSubscribeOpenError> {
inline auto ServiceBuilderPublishSubscribe<Payload, UserHeader, S>::open() && -> iox::
expected<PortFactoryPublishSubscribe<S, Payload, UserHeader>, PublishSubscribeOpenError> {
set_parameters();

iox2_port_factory_pub_sub_h port_factory_handle {};
Expand All @@ -216,8 +210,8 @@ inline auto ServiceBuilderPublishSubscribe<Payload, UserHeader, S>::
}

template <typename Payload, typename UserHeader, ServiceType S>
inline auto ServiceBuilderPublishSubscribe<Payload, UserHeader, S>::
create() && -> iox::expected<PortFactoryPublishSubscribe<S, Payload, UserHeader>, PublishSubscribeCreateError> {
inline auto ServiceBuilderPublishSubscribe<Payload, UserHeader, S>::create() && -> iox::
expected<PortFactoryPublishSubscribe<S, Payload, UserHeader>, PublishSubscribeCreateError> {
set_parameters();

iox2_port_factory_pub_sub_h port_factory_handle {};
Expand Down
4 changes: 2 additions & 2 deletions iceoryx2-ffi/cxx/src/listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ auto Listener<S>::try_wait_all(const iox::function<void(EventId)>& callback) ->
}

template <ServiceType S>
auto Listener<S>::timed_wait_all(const iox::function<void(EventId)>& callback,
const iox::units::Duration& timeout) -> iox::expected<void, ListenerWaitError> {
auto Listener<S>::timed_wait_all(const iox::function<void(EventId)>& callback, const iox::units::Duration& timeout)
-> iox::expected<void, ListenerWaitError> {
auto ctx = internal::ctx(callback);
auto timeout_timespec = timeout.timespec();

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

0 comments on commit f08b0b3

Please sign in to comment.