iceoryx_binding_c  2.0.2
subscriber.h
1 // Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved.
2 // Copyright (c) 2020 - 2022 by Apex.AI Inc. All rights reserved.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 // SPDX-License-Identifier: Apache-2.0
17 
18 #ifndef IOX_BINDING_C_SUBSCRIBER_H
19 #define IOX_BINDING_C_SUBSCRIBER_H
20 
21 #include "iceoryx_binding_c/enums.h"
22 #include "iceoryx_binding_c/internal/c2cpp_binding.h"
23 #include "iceoryx_binding_c/service_description.h"
24 #include "iceoryx_binding_c/types.h"
25 
27 typedef struct cpp2c_Subscriber* iox_sub_t;
28 
30 typedef struct
31 {
33  uint64_t queueCapacity;
34 
36  uint64_t historyRequest;
37 
40  const char* nodeName;
41 
44 
46  ENUM iox_QueueFullPolicy queueFullPolicy;
47 
52 
54  uint64_t initCheck;
56 
63 void iox_sub_options_init(iox_sub_options_t* const options);
64 
68 bool iox_sub_options_is_initialized(const iox_sub_options_t* const options);
69 
78 iox_sub_t iox_sub_init(iox_sub_storage_t* self,
79  const char* const service,
80  const char* const instance,
81  const char* const event,
82  const iox_sub_options_t* const options);
83 
86 void iox_sub_deinit(iox_sub_t const self);
87 
90 void iox_sub_subscribe(iox_sub_t const self);
91 
94 void iox_sub_unsubscribe(iox_sub_t const self);
95 
100 ENUM iox_SubscribeState iox_sub_get_subscription_state(iox_sub_t const self);
101 
107 ENUM iox_ChunkReceiveResult iox_sub_take_chunk(iox_sub_t const self, const void** const userPayload);
108 
112 void iox_sub_release_chunk(iox_sub_t const self, const void* const userPayload);
113 
116 void iox_sub_release_queued_chunks(iox_sub_t const self);
117 
121 bool iox_sub_has_chunks(iox_sub_t const self);
122 
126 bool iox_sub_has_lost_chunks(iox_sub_t const self);
127 
131 iox_service_description_t iox_sub_get_service_description(iox_sub_t const self);
132 #endif
Definition: service_description.h:25
options to be set for a subscriber
Definition: subscriber.h:31
ENUM iox_QueueFullPolicy queueFullPolicy
describes whether a publisher blocks when subscriber queue is full
Definition: subscriber.h:46
bool requirePublisherHistorySupport
Indicates whether we require the publisher to have historyCapacity > 0. If true and the condition is ...
Definition: subscriber.h:51
bool subscribeOnCreate
The option whether the subscriber shall try to subscribe when creating it.
Definition: subscriber.h:43
uint64_t historyRequest
number of chunks received after subscription if chunks are available
Definition: subscriber.h:36
uint64_t queueCapacity
size of the history chunk queue
Definition: subscriber.h:33
uint64_t initCheck
this value will be set exclusively by iox_sub_options_init and is not supposed to be modified otherwi...
Definition: subscriber.h:54
const char * nodeName
name of the node the subscriber belongs to
Definition: subscriber.h:40
Definition: types.h:47