iceoryx_binding_c  2.0.2
publisher.h
1 // Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved.
2 // Copyright (c) 2020 - 2021 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_PUBLISHER_H
19 #define IOX_BINDING_C_PUBLISHER_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_Publisher* iox_pub_t;
28 
30 typedef struct
31 {
33  uint64_t historyCapacity;
34 
37  const char* nodeName;
38 
41 
43  ENUM iox_ConsumerTooSlowPolicy subscriberTooSlowPolicy;
44 
46  uint64_t initCheck;
48 
55 void iox_pub_options_init(iox_pub_options_t* options);
56 
60 bool iox_pub_options_is_initialized(const iox_pub_options_t* const options);
61 
70 iox_pub_t iox_pub_init(iox_pub_storage_t* self,
71  const char* const service,
72  const char* const instance,
73  const char* const event,
74  const iox_pub_options_t* const options);
75 
78 void iox_pub_deinit(iox_pub_t const self);
79 
88 ENUM iox_AllocationResult iox_pub_loan_chunk(iox_pub_t const self,
89  void** const userPayload,
90  const uint32_t userPayloadSize);
91 
99 ENUM iox_AllocationResult iox_pub_loan_aligned_chunk(iox_pub_t const self,
100  void** const userPayload,
101  const uint32_t userPayloadSize,
102  const uint32_t userPayloadAlignment);
103 
114 ENUM iox_AllocationResult iox_pub_loan_aligned_chunk_with_user_header(iox_pub_t const self,
115  void** const userPayload,
116  const uint32_t userPayloadSize,
117  const uint32_t userPayloadAlignment,
118  const uint32_t userHeaderSize,
119  const uint32_t userHeaderAlignment);
120 
124 void iox_pub_release_chunk(iox_pub_t const self, void* const userPayload);
125 
129 void iox_pub_publish_chunk(iox_pub_t const self, void* const userPayload);
130 
133 void iox_pub_offer(iox_pub_t const self);
134 
137 void iox_pub_stop_offer(iox_pub_t const self);
138 
142 bool iox_pub_is_offered(iox_pub_t const self);
143 
147 bool iox_pub_has_subscribers(iox_pub_t const self);
148 
152 iox_service_description_t iox_pub_get_service_description(iox_pub_t const self);
153 #endif
options to be set for a publisher
Definition: publisher.h:31
const char * nodeName
Name of the node the publisher belongs to.
Definition: publisher.h:37
uint64_t initCheck
this value will be set exclusively by iox_pub_options_init and is not supposed to be modified otherwi...
Definition: publisher.h:46
ENUM iox_ConsumerTooSlowPolicy subscriberTooSlowPolicy
describes whether a publisher blocks when subscriber queue is full
Definition: publisher.h:43
bool offerOnCreate
The option whether the publisher should already be offered when creating it.
Definition: publisher.h:40
uint64_t historyCapacity
Size of the history chunk queue.
Definition: publisher.h:33
Definition: types.h:53
Definition: service_description.h:25