Skip to content

iceoryx_binding_c/wait_set.h🔗

Types🔗

Name
typedef CLASS cpp2c_WaitSet * iox_ws_t
wait set handle

Functions🔗

Name
iox_ws_t iox_ws_init(iox_ws_storage_t * self)
initialize wait set handle
void iox_ws_deinit(iox_ws_t const self)
deinitialize wait set handle
uint64_t iox_ws_timed_wait(iox_ws_t const self, struct timespec timeout, iox_notification_info_t *const notificationInfoArray, const uint64_t notificationInfoArrayCapacity, uint64_t * missedElements)
waits until an event occurred or the timeout was reached
uint64_t iox_ws_wait(iox_ws_t const self, iox_notification_info_t *const notificationInfoArray, const uint64_t notificationInfoArrayCapacity, uint64_t * missedElements)
waits until an event occurred
uint64_t iox_ws_size(iox_ws_t const self)
returns the number of registered events/states
uint64_t iox_ws_capacity(iox_ws_t const self)
returns the maximum amount of events/states which can be registered at the waitset
void iox_ws_mark_for_destruction(iox_ws_t const self)
Non-reversible call. After this call iox_ws_wait() and iox_ws_timed_wait() do not block any longer and never return triggered events/states. This function can be used to manually initialize destruction and to wakeup any thread which is waiting in iox_ws_wait() or iox_ws_timed_wait().
ENUM iox_WaitSetResult iox_ws_attach_subscriber_state(iox_ws_t const self, iox_sub_t const subscriber, const ENUM iox_SubscriberState subscriberState, const uint64_t id, void(*)(iox_sub_t) callback)
attaches a subscriber state to a waitset
ENUM iox_WaitSetResult iox_ws_attach_subscriber_state_with_context_data(iox_ws_t const self, iox_sub_t const subscriber, const ENUM iox_SubscriberState subscriberState, const uint64_t id, void()(iox_sub_t, void ) callback, void *const contextData)
attaches a subscriber state to a waitset. The callback has an additional contextData argument to provide access to user defined data.
ENUM iox_WaitSetResult iox_ws_attach_subscriber_event(iox_ws_t const self, iox_sub_t const subscriber, const ENUM iox_SubscriberEvent subscriberEvent, const uint64_t eventId, void(*)(iox_sub_t) callback)
attaches a subscriber event to a waitset
ENUM iox_WaitSetResult iox_ws_attach_subscriber_event_with_context_data(iox_ws_t const self, iox_sub_t const subscriber, const ENUM iox_SubscriberEvent subscriberEvent, const uint64_t eventId, void()(iox_sub_t, void ) callback, void *const contextData)
attaches a subscriber event to a waitset. The callback has an additional contextData argument to provide access to user defined data.
ENUM iox_WaitSetResult iox_ws_attach_user_trigger_event(iox_ws_t const self, iox_user_trigger_t const userTrigger, const uint64_t eventId, void(*)(iox_user_trigger_t) callback)
attaches a user trigger event to a waitset
ENUM iox_WaitSetResult iox_ws_attach_user_trigger_event_with_context_data(iox_ws_t const self, iox_user_trigger_t const userTrigger, const uint64_t eventId, void()(iox_user_trigger_t, void ) callback, void *const contextData)
attaches a user trigger event to a waitset. The callback has an additional contextData argument to provide access to user defined data.
void iox_ws_detach_subscriber_event(iox_ws_t const self, iox_sub_t const subscriber, const ENUM iox_SubscriberEvent subscriberEvent)
detaches a subscriber event from a waitset
void iox_ws_detach_subscriber_state(iox_ws_t const self, iox_sub_t const subscriber, const ENUM iox_SubscriberState subscriberState)
detaches a subscriber state from a waitset
void iox_ws_detach_user_trigger_event(iox_ws_t const self, iox_user_trigger_t const userTrigger)
detaches a user trigger event from a waitset
ENUM iox_WaitSetResult iox_ws_attach_client_event(const iox_ws_t self, const iox_client_t client, const ENUM iox_ClientEvent clientEvent, const uint64_t eventId, void(*)(iox_client_t) callback)
attaches a client event to a waitset
ENUM iox_WaitSetResult iox_ws_attach_client_event_with_context_data(iox_ws_t const self, iox_client_t const client, const ENUM iox_ClientEvent clientEvent, const uint64_t eventId, void()(iox_client_t, void ) callback, void *const contextData)
attaches a client event to a waitset with additional context data for the callback
ENUM iox_WaitSetResult iox_ws_attach_client_state(const iox_ws_t self, const iox_client_t client, const ENUM iox_ClientState clientState, const uint64_t eventId, void(*)(iox_client_t) callback)
attaches a client state to a waitset
ENUM iox_WaitSetResult iox_ws_attach_client_state_with_context_data(iox_ws_t const self, iox_client_t const client, const ENUM iox_ClientState clientState, const uint64_t eventId, void()(iox_client_t, void ) callback, void *const contextData)
attaches a client state to a waitset with additional context data for the callback
void iox_ws_detach_client_event(iox_ws_t const self, iox_client_t const client, const ENUM iox_ClientEvent clientEvent)
detaches a client event from a waitset
void iox_ws_detach_client_state(iox_ws_t const self, iox_client_t const client, const ENUM iox_ClientState clientState)
detaches a client state from a waitset
ENUM iox_WaitSetResult iox_ws_attach_server_event(const iox_ws_t self, const iox_server_t server, const ENUM iox_ServerEvent serverEvent, const uint64_t eventId, void(*)(iox_server_t) callback)
attaches a server event to a waitset
ENUM iox_WaitSetResult iox_ws_attach_server_event_with_context_data(iox_ws_t const self, iox_server_t const server, const ENUM iox_ServerEvent serverEvent, const uint64_t eventId, void()(iox_server_t, void ) callback, void *const contextData)
attaches a server event to a waitset with additional context data for the callback
ENUM iox_WaitSetResult iox_ws_attach_server_state(const iox_ws_t self, const iox_server_t server, const ENUM iox_ServerState serverState, const uint64_t eventId, void(*)(iox_server_t) callback)
attaches a server state to a waitset
ENUM iox_WaitSetResult iox_ws_attach_server_state_with_context_data(iox_ws_t const self, iox_server_t const server, const ENUM iox_ServerState serverState, const uint64_t eventId, void()(iox_server_t, void ) callback, void *const contextData)
attaches a server state to a waitset with additional context data for the callback
void iox_ws_detach_server_event(iox_ws_t const self, iox_server_t const server, const ENUM iox_ServerEvent serverEvent)
detaches a server event from a waitset
void iox_ws_detach_server_state(iox_ws_t const self, iox_server_t const server, const ENUM iox_ServerState serverState)
detaches a server state from a waitset
ENUM iox_WaitSetResult iox_ws_attach_service_discovery_event(const iox_ws_t self, const iox_service_discovery_t serviceDiscovery, const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent, const uint64_t eventId, void(*)(iox_service_discovery_t) callback)
attaches a service discovery event to a waitset
ENUM iox_WaitSetResult iox_ws_attach_service_discovery_event_with_context_data(iox_ws_t const self, iox_service_discovery_t const serviceDiscovery, const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent, const uint64_t eventId, void()(iox_service_discovery_t, void ) callback, void *const contextData)
attaches a service discovery event to a waitset with additional context data for the callback
void iox_ws_detach_service_discovery_event(iox_ws_t const self, iox_service_discovery_t const serviceDiscovery, const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent)
detaches a service discovery event from a waitset

Types Documentation🔗

typedef iox_ws_t🔗

typedef CLASS cpp2c_WaitSet* iox_ws_t;

wait set handle

Functions Documentation🔗

function iox_ws_init🔗

iox_ws_t iox_ws_init(
    iox_ws_storage_t * self
)

initialize wait set handle

Parameters:

  • self pointer to preallocated memory of size = sizeof(iox_ws_storage_t)

Return: handle to wait set

function iox_ws_deinit🔗

void iox_ws_deinit(
    iox_ws_t const self
)

deinitialize wait set handle

Parameters:

  • self the handle which should be deinitialized

function iox_ws_timed_wait🔗

uint64_t iox_ws_timed_wait(
    iox_ws_t const self,
    struct timespec timeout,
    iox_notification_info_t *const notificationInfoArray,
    const uint64_t notificationInfoArrayCapacity,
    uint64_t * missedElements
)

waits until an event occurred or the timeout was reached

Parameters:

  • self handle to the wait set
  • timeout duration how long this method should wait
  • notificationInfoArray preallocated memory to an array of iox_notification_info_t in which the notification infos, which are describing the occurred event, can be written to
  • notificationInfoArrayCapacity the capacity of the preallocated notificationInfoArray
  • missedElements if the notificationInfoArray has insufficient size the number of missed elements which could not be written into the array are stored here

Return: number of elements which were written into the notificationInfoArray

function iox_ws_wait🔗

uint64_t iox_ws_wait(
    iox_ws_t const self,
    iox_notification_info_t *const notificationInfoArray,
    const uint64_t notificationInfoArrayCapacity,
    uint64_t * missedElements
)

waits until an event occurred

Parameters:

  • self handle to the wait set
  • notificationInfoArray preallocated memory to an array of iox_notification_info_t in which the notification infos, which are describing the occurred event, can be written to
  • notificationInfoArrayCapacity the capacity of the preallocated notificationInfoArray
  • missedElements if the notificationInfoArray has insufficient size the number of missed elements which could not be written into the array are stored here

Return: number of elements which were written into the notificationInfoArray

function iox_ws_size🔗

uint64_t iox_ws_size(
    iox_ws_t const self
)

returns the number of registered events/states

function iox_ws_capacity🔗

uint64_t iox_ws_capacity(
    iox_ws_t const self
)

returns the maximum amount of events/states which can be registered at the waitset

function iox_ws_mark_for_destruction🔗

void iox_ws_mark_for_destruction(
    iox_ws_t const self
)

Non-reversible call. After this call iox_ws_wait() and iox_ws_timed_wait() do not block any longer and never return triggered events/states. This function can be used to manually initialize destruction and to wakeup any thread which is waiting in iox_ws_wait() or iox_ws_timed_wait().

function iox_ws_attach_subscriber_state🔗

ENUM iox_WaitSetResult iox_ws_attach_subscriber_state(
    iox_ws_t const self,
    iox_sub_t const subscriber,
    const ENUM iox_SubscriberState subscriberState,
    const uint64_t id,
    void(*)(iox_sub_t) callback
)

attaches a subscriber state to a waitset

Parameters:

  • self handle to the waitset
  • subscriber the subscriber of the state which should be attached
  • subscriberState the state which should be attached
  • id an arbitrary id which will be tagged to the state
  • callback a callback which is attached to the state

Return: if the attaching was successfull it returns WaitSetResult_SUCCESS, otherwise an enum which describes the error

function iox_ws_attach_subscriber_state_with_context_data🔗

ENUM iox_WaitSetResult iox_ws_attach_subscriber_state_with_context_data(
    iox_ws_t const self,
    iox_sub_t const subscriber,
    const ENUM iox_SubscriberState subscriberState,
    const uint64_t id,
    void(*)(iox_sub_t, void *) callback,
    void *const contextData
)

attaches a subscriber state to a waitset. The callback has an additional contextData argument to provide access to user defined data.

Parameters:

  • self handle to the waitset
  • subscriber the subscriber of the state which should be attached
  • subscriberState the state which should be attached
  • id an arbitrary id which will be tagged to the state
  • callback a callback which is attached to the state
  • contextData a void pointer which is provided as second argument to the callback

Return: if the attaching was successfull it returns WaitSetResult_SUCCESS, otherwise an enum which describes the error

function iox_ws_attach_subscriber_event🔗

ENUM iox_WaitSetResult iox_ws_attach_subscriber_event(
    iox_ws_t const self,
    iox_sub_t const subscriber,
    const ENUM iox_SubscriberEvent subscriberEvent,
    const uint64_t eventId,
    void(*)(iox_sub_t) callback
)

attaches a subscriber event to a waitset

Parameters:

  • self handle to the waitset
  • subscriber the subscriber of the event which should be attached
  • subscriberEvent the event which should be attached
  • eventId an arbitrary id which will be tagged to the event
  • callback a callback which is attached to the event

Return: if the attaching was successfull it returns WaitSetResult_SUCCESS, otherwise an enum which describes the error

function iox_ws_attach_subscriber_event_with_context_data🔗

ENUM iox_WaitSetResult iox_ws_attach_subscriber_event_with_context_data(
    iox_ws_t const self,
    iox_sub_t const subscriber,
    const ENUM iox_SubscriberEvent subscriberEvent,
    const uint64_t eventId,
    void(*)(iox_sub_t, void *) callback,
    void *const contextData
)

attaches a subscriber event to a waitset. The callback has an additional contextData argument to provide access to user defined data.

Parameters:

  • self handle to the waitset
  • subscriber the subscriber of the event which should be attached
  • subscriberEvent the event which should be attached
  • eventId an arbitrary id which will be tagged to the event
  • callback a callback which is attached to the event
  • contextData a void pointer which is provided as second argument to the callback

Return: if the attaching was successfull it returns WaitSetResult_SUCCESS, otherwise an enum which describes the error

function iox_ws_attach_user_trigger_event🔗

ENUM iox_WaitSetResult iox_ws_attach_user_trigger_event(
    iox_ws_t const self,
    iox_user_trigger_t const userTrigger,
    const uint64_t eventId,
    void(*)(iox_user_trigger_t) callback
)

attaches a user trigger event to a waitset

Parameters:

  • self handle to the waitset
  • userTrigger the user trigger of the event which should be attached
  • eventId an arbitrary id which will be tagged to the event
  • callback a callback which is attached to the event

Return: if the attaching was successfull it returns WaitSetResult_SUCCESS, otherwise an enum which describes the error

function iox_ws_attach_user_trigger_event_with_context_data🔗

ENUM iox_WaitSetResult iox_ws_attach_user_trigger_event_with_context_data(
    iox_ws_t const self,
    iox_user_trigger_t const userTrigger,
    const uint64_t eventId,
    void(*)(iox_user_trigger_t, void *) callback,
    void *const contextData
)

attaches a user trigger event to a waitset. The callback has an additional contextData argument to provide access to user defined data.

Parameters:

  • self handle to the waitset
  • userTrigger the user trigger of the event which should be attached
  • eventId an arbitrary id which will be tagged to the event
  • callback a callback which is attached to the event
  • contextData a void pointer which is provided as second argument to the callback

Return: if the attaching was successfull it returns WaitSetResult_SUCCESS, otherwise an enum which describes the error

function iox_ws_detach_subscriber_event🔗

void iox_ws_detach_subscriber_event(
    iox_ws_t const self,
    iox_sub_t const subscriber,
    const ENUM iox_SubscriberEvent subscriberEvent
)

detaches a subscriber event from a waitset

Parameters:

  • self handle to the waitset
  • subscriber the subscriber from which the event should be detached
  • subscriberEvent the event which should be detached from the subscriber

function iox_ws_detach_subscriber_state🔗

void iox_ws_detach_subscriber_state(
    iox_ws_t const self,
    iox_sub_t const subscriber,
    const ENUM iox_SubscriberState subscriberState
)

detaches a subscriber state from a waitset

Parameters:

  • self handle to the waitset
  • subscriber the subscriber from which the state should be detached
  • subscriberState the state which should be detached from the subscriber

function iox_ws_detach_user_trigger_event🔗

void iox_ws_detach_user_trigger_event(
    iox_ws_t const self,
    iox_user_trigger_t const userTrigger
)

detaches a user trigger event from a waitset

Parameters:

  • self handle to the waitset
  • usertrigger the user trigger which should be detached

function iox_ws_attach_client_event🔗

ENUM iox_WaitSetResult iox_ws_attach_client_event(
    const iox_ws_t self,
    const iox_client_t client,
    const ENUM iox_ClientEvent clientEvent,
    const uint64_t eventId,
    void(*)(iox_client_t) callback
)

attaches a client event to a waitset

Parameters:

  • self handle to the waitset
  • client the client of the event which should be attached
  • clientEvent the event which should be attached
  • eventId an arbitrary id which will be tagged to the event
  • callback a callback which is attached to the event

Return: if the attaching was successfull it returns WaitSetResult_SUCCESS, otherwise an enum which describes the error

function iox_ws_attach_client_event_with_context_data🔗

ENUM iox_WaitSetResult iox_ws_attach_client_event_with_context_data(
    iox_ws_t const self,
    iox_client_t const client,
    const ENUM iox_ClientEvent clientEvent,
    const uint64_t eventId,
    void(*)(iox_client_t, void *) callback,
    void *const contextData
)

attaches a client event to a waitset with additional context data for the callback

Parameters:

  • self handle to the waitset
  • client the client of the event which should be attached
  • clientEvent the event which should be attached
  • eventId an arbitrary id which will be tagged to the event
  • callback a callback which is attached to the event
  • contextData a void pointer which is provided as second argument to the callback

Return: if the attaching was successfull it returns WaitSetResult_SUCCESS, otherwise an enum which describes the error

function iox_ws_attach_client_state🔗

ENUM iox_WaitSetResult iox_ws_attach_client_state(
    const iox_ws_t self,
    const iox_client_t client,
    const ENUM iox_ClientState clientState,
    const uint64_t eventId,
    void(*)(iox_client_t) callback
)

attaches a client state to a waitset

Parameters:

  • self handle to the waitset
  • client the client of the state which should be attached
  • clientState the state which should be attached
  • eventId an arbitrary id which will be tagged to the state
  • callback a callback which is attached to the state

Return: if the attaching was successfull it returns WaitSetResult_SUCCESS, otherwise an enum which describes the error

function iox_ws_attach_client_state_with_context_data🔗

ENUM iox_WaitSetResult iox_ws_attach_client_state_with_context_data(
    iox_ws_t const self,
    iox_client_t const client,
    const ENUM iox_ClientState clientState,
    const uint64_t eventId,
    void(*)(iox_client_t, void *) callback,
    void *const contextData
)

attaches a client state to a waitset with additional context data for the callback

Parameters:

  • self handle to the waitset
  • client the client of the state which should be attached
  • clientState the state which should be attached
  • eventId an arbitrary id which will be tagged to the state
  • callback a callback which is attached to the state
  • contextData a void pointer which is provided as second argument to the callback

Return: if the attaching was successfull it returns WaitSetResult_SUCCESS, otherwise an enum which describes the error

function iox_ws_detach_client_event🔗

void iox_ws_detach_client_event(
    iox_ws_t const self,
    iox_client_t const client,
    const ENUM iox_ClientEvent clientEvent
)

detaches a client event from a waitset

Parameters:

  • self handle to the waitset
  • client the client which should be detached
  • clientEvent the event which should be detached from the client

function iox_ws_detach_client_state🔗

void iox_ws_detach_client_state(
    iox_ws_t const self,
    iox_client_t const client,
    const ENUM iox_ClientState clientState
)

detaches a client state from a waitset

Parameters:

  • self handle to the waitset
  • client the client which should be detached
  • clientState the state which should be detached from the client

function iox_ws_attach_server_event🔗

ENUM iox_WaitSetResult iox_ws_attach_server_event(
    const iox_ws_t self,
    const iox_server_t server,
    const ENUM iox_ServerEvent serverEvent,
    const uint64_t eventId,
    void(*)(iox_server_t) callback
)

attaches a server event to a waitset

Parameters:

  • self handle to the waitset
  • server the server of the event which should be attached
  • serverEvent the server which should be attached
  • eventId an arbitrary id which will be tagged to the event
  • callback a callback which is attached to the event

Return: if the attaching was successfull it returns WaitSetResult_SUCCESS, otherwise an enum which describes the error

function iox_ws_attach_server_event_with_context_data🔗

ENUM iox_WaitSetResult iox_ws_attach_server_event_with_context_data(
    iox_ws_t const self,
    iox_server_t const server,
    const ENUM iox_ServerEvent serverEvent,
    const uint64_t eventId,
    void(*)(iox_server_t, void *) callback,
    void *const contextData
)

attaches a server event to a waitset with additional context data for the callback

Parameters:

  • self handle to the waitset
  • server the server of the event which should be attached
  • serverEvent the server which should be attached
  • eventId an arbitrary id which will be tagged to the event
  • callback a callback which is attached to the event
  • contextData a void pointer which is provided as second argument to the callback

Return: if the attaching was successfull it returns WaitSetResult_SUCCESS, otherwise an enum which describes the error

function iox_ws_attach_server_state🔗

ENUM iox_WaitSetResult iox_ws_attach_server_state(
    const iox_ws_t self,
    const iox_server_t server,
    const ENUM iox_ServerState serverState,
    const uint64_t eventId,
    void(*)(iox_server_t) callback
)

attaches a server state to a waitset

Parameters:

  • self handle to the waitset
  • server the server of the state which should be attached
  • serverState the state which should be attached
  • eventId an arbitrary id which will be tagged to the state
  • callback a callback which is attached to the state

Return: if the attaching was successfull it returns WaitSetResult_SUCCESS, otherwise an enum which describes the error

function iox_ws_attach_server_state_with_context_data🔗

ENUM iox_WaitSetResult iox_ws_attach_server_state_with_context_data(
    iox_ws_t const self,
    iox_server_t const server,
    const ENUM iox_ServerState serverState,
    const uint64_t eventId,
    void(*)(iox_server_t, void *) callback,
    void *const contextData
)

attaches a server state to a waitset with additional context data for the callback

Parameters:

  • self handle to the waitset
  • server the server of the state which should be attached
  • serverState the state which should be attached
  • eventId an arbitrary id which will be tagged to the state
  • callback a callback which is attached to the state
  • contextData a void pointer which is provided as second argument to the callback

Return: if the attaching was successfull it returns WaitSetResult_SUCCESS, otherwise an enum which describes the error

function iox_ws_detach_server_event🔗

void iox_ws_detach_server_event(
    iox_ws_t const self,
    iox_server_t const server,
    const ENUM iox_ServerEvent serverEvent
)

detaches a server event from a waitset

Parameters:

  • self handle to the waitset
  • server the server which should be detached
  • serverEvent the event which should be detached from the server

function iox_ws_detach_server_state🔗

void iox_ws_detach_server_state(
    iox_ws_t const self,
    iox_server_t const server,
    const ENUM iox_ServerState serverState
)

detaches a server state from a waitset

Parameters:

  • self handle to the waitset
  • server the server which should be detached
  • serverState the state which should be detached from the server

function iox_ws_attach_service_discovery_event🔗

ENUM iox_WaitSetResult iox_ws_attach_service_discovery_event(
    const iox_ws_t self,
    const iox_service_discovery_t serviceDiscovery,
    const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent,
    const uint64_t eventId,
    void(*)(iox_service_discovery_t) callback
)

attaches a service discovery event to a waitset

Parameters:

  • self handle to the waitset
  • serviceDiscovery service discovery which emits the event
  • serviceDiscoveryEvent the event which should be attached
  • eventId an arbitrary id which will be tagged to the event
  • callback a callback which is attached to the event

Return: if the attaching was successfull it returns WaitSetResult_SUCCESS, otherwise an enum which describes the error

function iox_ws_attach_service_discovery_event_with_context_data🔗

ENUM iox_WaitSetResult iox_ws_attach_service_discovery_event_with_context_data(
    iox_ws_t const self,
    iox_service_discovery_t const serviceDiscovery,
    const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent,
    const uint64_t eventId,
    void(*)(iox_service_discovery_t, void *) callback,
    void *const contextData
)

attaches a service discovery event to a waitset with additional context data for the callback

Parameters:

  • self handle to the waitset
  • serviceDiscovery service discovery which emits the event
  • serviceDiscoveryEvent the event which should be attached
  • eventId an arbitrary id which will be tagged to the event
  • callback a callback which is attached to the event
  • contextData a void pointer which is provided as second argument to the callback

Return: if the attaching was successfull it returns WaitSetResult_SUCCESS, otherwise an enum which describes the error

function iox_ws_detach_service_discovery_event🔗

void iox_ws_detach_service_discovery_event(
    iox_ws_t const self,
    iox_service_discovery_t const serviceDiscovery,
    const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent
)

detaches a service discovery event from a waitset

Parameters:

  • self handle to the waitset
  • serviceDiscovery the service discovery which should be detached
  • serviceDiscoveryEvent the event which should be detached from the service discovery

Source code🔗

// Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2020 - 2022 Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// SPDX-License-Identifier: Apache-2.0

#ifndef IOX_BINDING_C_WAIT_SET_H
#define IOX_BINDING_C_WAIT_SET_H

#include "iceoryx_binding_c/client.h"
#include "iceoryx_binding_c/enums.h"
#include "iceoryx_binding_c/internal/c2cpp_binding.h"
#include "iceoryx_binding_c/notification_info.h"
#include "iceoryx_binding_c/service_discovery.h"
#include "iceoryx_binding_c/subscriber.h"
#include "iceoryx_binding_c/types.h"
#include "iceoryx_binding_c/user_trigger.h"

#include <time.h>

typedef CLASS cpp2c_WaitSet* iox_ws_t;

iox_ws_t iox_ws_init(iox_ws_storage_t* self);

void iox_ws_deinit(iox_ws_t const self);

uint64_t iox_ws_timed_wait(iox_ws_t const self,
                           struct timespec timeout,
                           iox_notification_info_t* const notificationInfoArray,
                           const uint64_t notificationInfoArrayCapacity,
                           uint64_t* missedElements);

uint64_t iox_ws_wait(iox_ws_t const self,
                     iox_notification_info_t* const notificationInfoArray,
                     const uint64_t notificationInfoArrayCapacity,
                     uint64_t* missedElements);

uint64_t iox_ws_size(iox_ws_t const self);

uint64_t iox_ws_capacity(iox_ws_t const self);

void iox_ws_mark_for_destruction(iox_ws_t const self);

ENUM iox_WaitSetResult iox_ws_attach_subscriber_state(iox_ws_t const self,
                                                      iox_sub_t const subscriber,
                                                      const ENUM iox_SubscriberState subscriberState,
                                                      const uint64_t id,
                                                      void (*callback)(iox_sub_t));

ENUM iox_WaitSetResult iox_ws_attach_subscriber_state_with_context_data(iox_ws_t const self,
                                                                        iox_sub_t const subscriber,
                                                                        const ENUM iox_SubscriberState subscriberState,
                                                                        const uint64_t id,
                                                                        void (*callback)(iox_sub_t, void*),
                                                                        void* const contextData);

ENUM iox_WaitSetResult iox_ws_attach_subscriber_event(iox_ws_t const self,
                                                      iox_sub_t const subscriber,
                                                      const ENUM iox_SubscriberEvent subscriberEvent,
                                                      const uint64_t eventId,
                                                      void (*callback)(iox_sub_t));

ENUM iox_WaitSetResult iox_ws_attach_subscriber_event_with_context_data(iox_ws_t const self,
                                                                        iox_sub_t const subscriber,
                                                                        const ENUM iox_SubscriberEvent subscriberEvent,
                                                                        const uint64_t eventId,
                                                                        void (*callback)(iox_sub_t, void*),
                                                                        void* const contextData);

ENUM iox_WaitSetResult iox_ws_attach_user_trigger_event(iox_ws_t const self,
                                                        iox_user_trigger_t const userTrigger,
                                                        const uint64_t eventId,
                                                        void (*callback)(iox_user_trigger_t));

ENUM iox_WaitSetResult iox_ws_attach_user_trigger_event_with_context_data(iox_ws_t const self,
                                                                          iox_user_trigger_t const userTrigger,
                                                                          const uint64_t eventId,
                                                                          void (*callback)(iox_user_trigger_t, void*),
                                                                          void* const contextData);

void iox_ws_detach_subscriber_event(iox_ws_t const self,
                                    iox_sub_t const subscriber,
                                    const ENUM iox_SubscriberEvent subscriberEvent);

void iox_ws_detach_subscriber_state(iox_ws_t const self,
                                    iox_sub_t const subscriber,
                                    const ENUM iox_SubscriberState subscriberState);

void iox_ws_detach_user_trigger_event(iox_ws_t const self, iox_user_trigger_t const userTrigger);

ENUM iox_WaitSetResult iox_ws_attach_client_event(const iox_ws_t self,
                                                  const iox_client_t client,
                                                  const ENUM iox_ClientEvent clientEvent,
                                                  const uint64_t eventId,
                                                  void (*callback)(iox_client_t));

ENUM iox_WaitSetResult iox_ws_attach_client_event_with_context_data(iox_ws_t const self,
                                                                    iox_client_t const client,
                                                                    const ENUM iox_ClientEvent clientEvent,
                                                                    const uint64_t eventId,
                                                                    void (*callback)(iox_client_t, void*),
                                                                    void* const contextData);

ENUM iox_WaitSetResult iox_ws_attach_client_state(const iox_ws_t self,
                                                  const iox_client_t client,
                                                  const ENUM iox_ClientState clientState,
                                                  const uint64_t eventId,
                                                  void (*callback)(iox_client_t));

ENUM iox_WaitSetResult iox_ws_attach_client_state_with_context_data(iox_ws_t const self,
                                                                    iox_client_t const client,
                                                                    const ENUM iox_ClientState clientState,
                                                                    const uint64_t eventId,
                                                                    void (*callback)(iox_client_t, void*),
                                                                    void* const contextData);

void iox_ws_detach_client_event(iox_ws_t const self, iox_client_t const client, const ENUM iox_ClientEvent clientEvent);

void iox_ws_detach_client_state(iox_ws_t const self, iox_client_t const client, const ENUM iox_ClientState clientState);

ENUM iox_WaitSetResult iox_ws_attach_server_event(const iox_ws_t self,
                                                  const iox_server_t server,
                                                  const ENUM iox_ServerEvent serverEvent,
                                                  const uint64_t eventId,
                                                  void (*callback)(iox_server_t));

ENUM iox_WaitSetResult iox_ws_attach_server_event_with_context_data(iox_ws_t const self,
                                                                    iox_server_t const server,
                                                                    const ENUM iox_ServerEvent serverEvent,
                                                                    const uint64_t eventId,
                                                                    void (*callback)(iox_server_t, void*),
                                                                    void* const contextData);

ENUM iox_WaitSetResult iox_ws_attach_server_state(const iox_ws_t self,
                                                  const iox_server_t server,
                                                  const ENUM iox_ServerState serverState,
                                                  const uint64_t eventId,
                                                  void (*callback)(iox_server_t));

ENUM iox_WaitSetResult iox_ws_attach_server_state_with_context_data(iox_ws_t const self,
                                                                    iox_server_t const server,
                                                                    const ENUM iox_ServerState serverState,
                                                                    const uint64_t eventId,
                                                                    void (*callback)(iox_server_t, void*),
                                                                    void* const contextData);

void iox_ws_detach_server_event(iox_ws_t const self, iox_server_t const server, const ENUM iox_ServerEvent serverEvent);

void iox_ws_detach_server_state(iox_ws_t const self, iox_server_t const server, const ENUM iox_ServerState serverState);

ENUM iox_WaitSetResult iox_ws_attach_service_discovery_event(const iox_ws_t self,
                                                             const iox_service_discovery_t serviceDiscovery,
                                                             const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent,
                                                             const uint64_t eventId,
                                                             void (*callback)(iox_service_discovery_t));

ENUM iox_WaitSetResult
iox_ws_attach_service_discovery_event_with_context_data(iox_ws_t const self,
                                                        iox_service_discovery_t const serviceDiscovery,
                                                        const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent,
                                                        const uint64_t eventId,
                                                        void (*callback)(iox_service_discovery_t, void*),
                                                        void* const contextData);

void iox_ws_detach_service_discovery_event(iox_ws_t const self,
                                           iox_service_discovery_t const serviceDiscovery,
                                           const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent);

#endif

Updated on 31 May 2022 at 11:34:55 CEST