Skip to content

Commit

Permalink
iox-#2327 Remove macro ENUM and rename macro CLASS to IOX_C_CLASS
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Bentley <[email protected]>
  • Loading branch information
mikebentley15 committed Aug 23, 2024
1 parent 912931a commit a5f5a64
Show file tree
Hide file tree
Showing 18 changed files with 134 additions and 137 deletions.
1 change: 1 addition & 0 deletions doc/website/release-notes/iceoryx-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@

**Bugfixes:**

- Fix compile-time conflict with Apache Arrow [\#2327](https://github.com/eclipse-iceoryx/iceoryx/issues/2327)
- FreeBSD CI build is broken [\#1338](https://github.com/eclipse-iceoryx/iceoryx/issues/1338)
- High CPU load in blocked publisher is reduced by introducing smart busy loop waiting (adaptive_wait) [\#1347](https://github.com/eclipse-iceoryx/iceoryx/issues/1347)
- Compile Error : iceoryx_dds/Mempool.hpp: No such file or directory [\#1364](https://github.com/eclipse-iceoryx/iceoryx/issues/1364)
Expand Down
19 changes: 9 additions & 10 deletions iceoryx_binding_c/include/iceoryx_binding_c/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "iceoryx_binding_c/types.h"

/// @brief client handle
typedef CLASS UntypedClient* iox_client_t;
typedef IOX_C_CLASS UntypedClient* iox_client_t;

/// @brief options to be set for a client
typedef struct
Expand All @@ -38,10 +38,10 @@ typedef struct
bool connectOnCreate;

/// @brief Sets whether the server blocks when the client response queue is full
ENUM iox_QueueFullPolicy responseQueueFullPolicy;
enum iox_QueueFullPolicy responseQueueFullPolicy;

/// @brief Sets whether the client blocks when the server request queue is full
ENUM iox_ConsumerTooSlowPolicy serverTooSlowPolicy;
enum iox_ConsumerTooSlowPolicy serverTooSlowPolicy;

/// @brief this value will be set exclusively by 'iox_client_options_init' and is not supposed to be modified
/// otherwise
Expand Down Expand Up @@ -87,9 +87,8 @@ void iox_client_deinit(iox_client_t const self);
/// describes the error
/// @note for the user-payload alignment 'IOX_C_CHUNK_DEFAULT_USER_PAYLOAD_ALIGNMENT' is used
/// for a custom user-payload alignment please use 'iox_client_loan_aligned_request'
ENUM iox_AllocationResult iox_client_loan_request(iox_client_t const self,
void** const payload,
const uint64_t payloadSize);
enum iox_AllocationResult
iox_client_loan_request(iox_client_t const self, void** const payload, const uint64_t payloadSize);

/// @brief allocates a request in the shared memory with a custom alignment for the user-payload
/// @param[in] self handle of the client
Expand All @@ -98,7 +97,7 @@ ENUM iox_AllocationResult iox_client_loan_request(iox_client_t const self,
/// @param[in] payloadAlignment user-payload alignment of the allocated request
/// @return on success it returns AllocationResult_SUCCESS otherwise a value which
/// describes the error
ENUM iox_AllocationResult iox_client_loan_aligned_request(iox_client_t const self,
enum iox_AllocationResult iox_client_loan_aligned_request(iox_client_t const self,
void** const payload,
const uint64_t payloadSize,
const uint32_t payloadAlignment);
Expand All @@ -114,7 +113,7 @@ void iox_client_release_request(iox_client_t const self, void* const payload);
/// @param[in] payload pointer to the user-payload of the request which should be send
/// @return on success it returns ClientSendResult_SUCCESS otherwise a value which
/// describes the error
ENUM iox_ClientSendResult iox_client_send(iox_client_t const self, void* const payload);
enum iox_ClientSendResult iox_client_send(iox_client_t const self, void* const payload);

/// @brief connects to the service
/// @param[in] self handle to the client
Expand All @@ -128,14 +127,14 @@ void iox_client_disconnect(iox_client_t const self);
/// @param[in] self handle to the client
/// @return ConnectionState_CONNECTED when successfully connected otherwise an enum which
/// describes the current state
ENUM iox_ConnectionState iox_client_get_connection_state(iox_client_t const self);
enum iox_ConnectionState iox_client_get_connection_state(iox_client_t const self);

/// @brief retrieve a received respone
/// @param[in] self handle to the client
/// @param[in] payload pointer in which the pointer to the user-payload of the response is stored
/// @return if a chunk could be received it returns ChunkReceiveResult_SUCCESS otherwise
/// an enum which describes the error
ENUM iox_ChunkReceiveResult iox_client_take_response(iox_client_t const self, const void** const payload);
enum iox_ChunkReceiveResult iox_client_take_response(iox_client_t const self, const void** const payload);

/// @brief release a previously acquired response (via iox_client_take_response)
/// @param[in] self handle to the client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,14 @@

#include <cstdint>

#define CLASS class
#define ENUM
#define IOX_C_CLASS class

#else

#include <stdbool.h>
#include <stdint.h>

#define CLASS struct
#define ENUM enum
#define IOX_C_CLASS struct

#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

namespace c2cpp
{
iox::popo::ConsumerTooSlowPolicy consumerTooSlowPolicy(const ENUM iox_ConsumerTooSlowPolicy policy) noexcept;
iox::popo::QueueFullPolicy queueFullPolicy(const ENUM iox_QueueFullPolicy policy) noexcept;
iox::popo::ConsumerTooSlowPolicy consumerTooSlowPolicy(const enum iox_ConsumerTooSlowPolicy policy) noexcept;
iox::popo::QueueFullPolicy queueFullPolicy(const enum iox_QueueFullPolicy policy) noexcept;
iox::popo::SubscriberEvent subscriberEvent(const iox_SubscriberEvent value) noexcept;
iox::popo::SubscriberState subscriberState(const iox_SubscriberState value) noexcept;

Expand Down
46 changes: 23 additions & 23 deletions iceoryx_binding_c/include/iceoryx_binding_c/listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "iceoryx_binding_c/types.h"
#include "iceoryx_binding_c/user_trigger.h"

typedef CLASS Listener* iox_listener_t;
typedef IOX_C_CLASS Listener* iox_listener_t;


/// @brief initializes a listener struct from a storage struct pointer
Expand All @@ -44,9 +44,9 @@ void iox_listener_deinit(iox_listener_t const self);
/// @param[in] subscriberEvent the event which should trigger the listener
/// @param[in] callback the callback which is called when an event triggers the listener
/// @return when successful iox_ListenerResult::ListenerResult_SUCCESS otherwise an enum which describes the error
ENUM iox_ListenerResult iox_listener_attach_subscriber_event(iox_listener_t const self,
enum iox_ListenerResult iox_listener_attach_subscriber_event(iox_listener_t const self,
iox_sub_t const subscriber,
const ENUM iox_SubscriberEvent subscriberEvent,
const enum iox_SubscriberEvent subscriberEvent,
void (*callback)(iox_sub_t));

/// @brief Attaches a subscriber event to the listener. The callback has an additional contextData argument to provide
Expand All @@ -57,10 +57,10 @@ ENUM iox_ListenerResult iox_listener_attach_subscriber_event(iox_listener_t cons
/// @param[in] callback the callback which is called when an event triggers the listener
/// @param[in] contextData a void pointer which is provided as second argument to the callback
/// @return when successful iox_ListenerResult::ListenerResult_SUCCESS otherwise an enum which describes the error
ENUM iox_ListenerResult
enum iox_ListenerResult
iox_listener_attach_subscriber_event_with_context_data(iox_listener_t const self,
iox_sub_t const subscriber,
const ENUM iox_SubscriberEvent subscriberEvent,
const enum iox_SubscriberEvent subscriberEvent,
void (*callback)(iox_sub_t, void*),
void* const contextData);

Expand All @@ -69,7 +69,7 @@ iox_listener_attach_subscriber_event_with_context_data(iox_listener_t const self
/// @param[in] userTrigger user trigger which emits the event
/// @param[in] callback the callback which is called when the user trigger triggers the listener
/// @return when successful iox_ListenerResult::ListenerResult_SUCCESS otherwise an enum which describes the error
ENUM iox_ListenerResult iox_listener_attach_user_trigger_event(iox_listener_t const self,
enum iox_ListenerResult iox_listener_attach_user_trigger_event(iox_listener_t const self,
iox_user_trigger_t const userTrigger,
void (*callback)(iox_user_trigger_t));

Expand All @@ -80,7 +80,7 @@ ENUM iox_ListenerResult iox_listener_attach_user_trigger_event(iox_listener_t co
/// @param[in] callback the callback which is called when the user trigger triggers the listener
/// @param[in] contextData a void pointer which is provided as second argument to the callback
/// @return when successful iox_ListenerResult::ListenerResult_SUCCESS otherwise an enum which describes the error
ENUM iox_ListenerResult iox_listener_attach_user_trigger_event_with_context_data(iox_listener_t const self,
enum iox_ListenerResult iox_listener_attach_user_trigger_event_with_context_data(iox_listener_t const self,
iox_user_trigger_t const userTrigger,
void (*callback)(iox_user_trigger_t,
void*),
Expand All @@ -92,7 +92,7 @@ ENUM iox_ListenerResult iox_listener_attach_user_trigger_event_with_context_data
/// @param[in] subscriberEvent the subscriber event which is registered at the listener
void iox_listener_detach_subscriber_event(iox_listener_t const self,
iox_sub_t const subscriber,
const ENUM iox_SubscriberEvent subscriberEvent);
const enum iox_SubscriberEvent subscriberEvent);

/// @brief Detaches a user trigger from the listener
/// @param[in] self listener from which the event should be detached
Expand All @@ -116,9 +116,9 @@ uint64_t iox_listener_capacity(iox_listener_t const self);
/// @param[in] clientEvent the event which should trigger the listener
/// @param[in] callback the callback which is called when an event triggers the listener
/// @return when successful iox_ListenerResult::ListenerResult_SUCCESS otherwise an enum which describes the error
ENUM iox_ListenerResult iox_listener_attach_client_event(iox_listener_t const self,
enum iox_ListenerResult iox_listener_attach_client_event(iox_listener_t const self,
iox_client_t const client,
const ENUM iox_ClientEvent clientEvent,
const enum iox_ClientEvent clientEvent,
void (*callback)(iox_client_t));

/// @brief Attaches a client event to the listener. The callback has an additional contextData argument to provide
Expand All @@ -129,9 +129,9 @@ ENUM iox_ListenerResult iox_listener_attach_client_event(iox_listener_t const se
/// @param[in] callback the callback which is called when an event triggers the listener
/// @param[in] contextData a void pointer which is provided as second argument to the callback
/// @return when successful iox_ListenerResult::ListenerResult_SUCCESS otherwise an enum which describes the error
ENUM iox_ListenerResult iox_listener_attach_client_event_with_context_data(iox_listener_t const self,
enum iox_ListenerResult iox_listener_attach_client_event_with_context_data(iox_listener_t const self,
iox_client_t const client,
const ENUM iox_ClientEvent clientEvent,
const enum iox_ClientEvent clientEvent,
void (*callback)(iox_client_t, void*),
void* const contextData);

Expand All @@ -141,17 +141,17 @@ ENUM iox_ListenerResult iox_listener_attach_client_event_with_context_data(iox_l
/// @param[in] clientEvent the event which should be removed from the listener
void iox_listener_detach_client_event(iox_listener_t const self,
iox_client_t const client,
const ENUM iox_ClientEvent clientEvent);
const enum iox_ClientEvent clientEvent);

/// @brief Attaches a server event to the listener
/// @param[in] self listener to which the event should be attached to
/// @param[in] server the server which emits the event
/// @param[in] serverEvent the event which should trigger the listener
/// @param[in] callback the callback which is called when an event triggers the listener
/// @return when successful iox_ListenerResult::ListenerResult_SUCCESS otherwise an enum which describes the error
ENUM iox_ListenerResult iox_listener_attach_server_event(iox_listener_t const self,
enum iox_ListenerResult iox_listener_attach_server_event(iox_listener_t const self,
iox_server_t const server,
const ENUM iox_ServerEvent serverEvent,
const enum iox_ServerEvent serverEvent,
void (*callback)(iox_server_t));

/// @brief Attaches a server event to the listener. The callback has an additional contextData argument to provide
Expand All @@ -162,9 +162,9 @@ ENUM iox_ListenerResult iox_listener_attach_server_event(iox_listener_t const se
/// @param[in] callback the callback which is called when an event triggers the listener
/// @param[in] contextData a void pointer which is provided as second argument to the callback
/// @return when successful iox_ListenerResult::ListenerResult_SUCCESS otherwise an enum which describes the error
ENUM iox_ListenerResult iox_listener_attach_server_event_with_context_data(iox_listener_t const self,
enum iox_ListenerResult iox_listener_attach_server_event_with_context_data(iox_listener_t const self,
iox_server_t const server,
const ENUM iox_ServerEvent serverEvent,
const enum iox_ServerEvent serverEvent,
void (*callback)(iox_server_t, void*),
void* const contextData);

Expand All @@ -174,18 +174,18 @@ ENUM iox_ListenerResult iox_listener_attach_server_event_with_context_data(iox_l
/// @param[in] serverEvent the event which should be removed from the listener
void iox_listener_detach_server_event(iox_listener_t const self,
iox_server_t const server,
const ENUM iox_ServerEvent serverEvent);
const enum iox_ServerEvent serverEvent);

/// @brief Attaches a service discovery event to the listener
/// @param[in] self listener to which the event should be attached to
/// @param[in] serviceDiscovery service discovery which emits the event
/// @param[in] serviceDiscoveryEvent the event which should trigger the listener
/// @param[in] callback the callback which is called when an event triggers the listener
/// @return when successful iox_ListenerResult::ListenerResult_SUCCESS otherwise an enum which describes the error
ENUM iox_ListenerResult
enum iox_ListenerResult
iox_listener_attach_service_discovery_event(iox_listener_t const self,
iox_service_discovery_t const serviceDiscovery,
const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent,
const enum iox_ServiceDiscoveryEvent serviceDiscoveryEvent,
void (*callback)(iox_service_discovery_t));

/// @brief Attaches a service discovery event to the listener. The callback has an additional contextData argument to
Expand All @@ -196,10 +196,10 @@ iox_listener_attach_service_discovery_event(iox_listener_t const self,
/// @param[in] callback the callback which is called when an event triggers the listener
/// @param[in] contextData a void pointer which is provided as second argument to the callback
/// @return when successful iox_ListenerResult::ListenerResult_SUCCESS otherwise an enum which describes the error
ENUM iox_ListenerResult iox_listener_attach_service_discovery_event_with_context_data(
enum iox_ListenerResult iox_listener_attach_service_discovery_event_with_context_data(
iox_listener_t const self,
iox_service_discovery_t const serviceDiscovery,
const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent,
const enum iox_ServiceDiscoveryEvent serviceDiscoveryEvent,
void (*callback)(iox_service_discovery_t, void*),
void* const contextData);

Expand All @@ -209,6 +209,6 @@ ENUM iox_ListenerResult iox_listener_attach_service_discovery_event_with_context
/// @param[in] serviceDiscoveryEvent the service discovery event which should be removed from the listener
void iox_listener_detach_service_discovery_event(iox_listener_t const self,
iox_service_discovery_t const serviceDiscovery,
const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent);
const enum iox_ServiceDiscoveryEvent serviceDiscoveryEvent);

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "iceoryx_binding_c/user_trigger.h"

/// @brief notification info handle
typedef const CLASS NotificationInfo* iox_notification_info_t;
typedef const IOX_C_CLASS NotificationInfo* iox_notification_info_t;

/// @brief returns the id of the notification
/// @param[in] self handle to notification info
Expand Down
Loading

0 comments on commit a5f5a64

Please sign in to comment.