From c6725630a26c8d1aa4285bcfa96a128b67cb5f19 Mon Sep 17 00:00:00 2001 From: DenisBiryukov91 <155981813+DenisBiryukov91@users.noreply.github.com> Date: Thu, 10 Oct 2024 17:53:55 +0200 Subject: [PATCH] revert the renaming of implicit session functions (#755) * revert the renaming of implicit session functions * change order of arguments in implicit session declare/undeclare methods * return undeclare functions * fix arguments order in zc_publisher_declare_matching_listener * revert renaming of zc_liveliness_undeclare_token --- docs/api.rst | 31 +- docs/examples.rst | 4 +- examples/z_liveliness.c | 2 +- examples/z_ping.c | 4 +- examples/z_ping_shm.c | 4 +- examples/z_pong.c | 4 +- examples/z_pub.c | 4 +- examples/z_pub_attachment.c | 2 +- examples/z_pub_cache.c | 2 +- examples/z_pub_shm.c | 4 +- examples/z_pub_shm_thr.c | 2 +- examples/z_pub_thr.c | 2 +- examples/z_pull.c | 2 +- examples/z_query_sub.c | 2 +- examples/z_queryable.c | 2 +- examples/z_queryable_shm.c | 2 +- examples/z_queryable_with_channels.c | 2 +- examples/z_sub.c | 2 +- examples/z_sub_attachment.c | 2 +- examples/z_sub_liveliness.c | 2 +- examples/z_sub_shm.c | 2 +- examples/z_sub_thr.c | 6 +- include/zenoh_commons.h | 1220 ++++++++++++++--------- include/zenoh_macros.h | 350 +------ src/keyexpr.rs | 10 +- src/liveliness.rs | 22 +- src/publication_cache.rs | 29 +- src/publisher.rs | 35 +- src/queryable.rs | 28 +- src/querying_subscriber.rs | 30 +- src/subscriber.rs | 31 +- tests/z_api_alignment_test.c | 8 +- tests/z_api_double_drop_test.c | 6 +- tests/z_api_keyexpr_drop_test.c | 4 +- tests/z_api_keyexpr_test.c | 4 +- tests/z_api_liveliness.c | 8 +- tests/z_int_pub_cache_query_sub_test.c | 6 +- tests/z_int_pub_sub_attachment_test.c | 4 +- tests/z_int_pub_sub_test.c | 4 +- tests/z_int_queryable_attachment_test.c | 2 +- tests/z_int_queryable_test.c | 2 +- tests/z_leak_pub_sub_test.c | 4 +- tests/z_leak_queryable_get_test.c | 2 +- 43 files changed, 945 insertions(+), 953 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index fc4189a0d..b378bd743 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -564,7 +564,8 @@ Functions .. doxygenfunction:: z_put .. doxygenfunction:: z_delete -.. doxygenfunction:: z_publisher_declare +.. doxygenfunction:: z_declare_publisher +.. doxygenfunction:: z_undeclare_publisher .. doxygenfunction:: z_publisher_put .. doxygenfunction:: z_publisher_delete .. doxygenfunction:: z_publisher_keyexpr @@ -587,8 +588,8 @@ Functions .. doxygenfunction:: zc_closure_matching_status .. doxygenfunction:: zc_publisher_get_matching_status -.. doxygenfunction:: zc_publisher_matching_listener_declare -.. doxygenfunction:: zc_publisher_matching_listener_declare_background +.. doxygenfunction:: zc_publisher_declare_matching_listener +.. doxygenfunction:: zc_publisher_declare_background_matching_listener .. doxygenfunction:: zc_publisher_matching_listener_drop @@ -615,8 +616,9 @@ Types Functions --------- -.. doxygenfunction:: z_subscriber_declare -.. doxygenfunction:: z_subscriber_declare_background +.. doxygenfunction:: z_declare_subscriber +.. doxygenfunction:: z_undeclare_subscriber +.. doxygenfunction:: z_declare_background_subscriber .. doxygenfunction:: z_subscriber_keyexpr .. doxygenfunction:: z_subscriber_drop @@ -673,8 +675,9 @@ Types Functions --------- -.. doxygenfunction:: z_queryable_declare -.. doxygenfunction:: z_queryable_declare_background +.. doxygenfunction:: z_declare_queryable +.. doxygenfunction:: z_undeclare_queryable +.. doxygenfunction:: z_declare_background_queryable .. doxygenfunction:: z_queryable_id .. doxygenfunction:: z_queryable_options_default @@ -823,8 +826,8 @@ Types Functions --------- -.. doxygenfunction:: zc_liveliness_subscriber_declare -.. doxygenfunction:: zc_liveliness_subscriber_declare_background +.. doxygenfunction:: zc_liveliness_declare_subscriber +.. doxygenfunction:: zc_liveliness_declare_background_subscriber .. doxygenfunction:: zc_liveliness_get .. doxygenfunction:: zc_liveliness_declare_token @@ -851,8 +854,9 @@ Types Functions --------- -.. doxygenfunction:: ze_publication_cache_declare -.. doxygenfunction:: ze_publication_cache_declare_background +.. doxygenfunction:: ze_declare_publication_cache +.. doxygenfunction:: ze_undeclare_publication_cache +.. doxygenfunction:: ze_declare_background_publication_cache .. doxygenfunction:: ze_publication_cache_drop .. doxygenfunction:: ze_publication_cache_loan @@ -875,8 +879,9 @@ Types Functions --------- -.. doxygenfunction:: ze_querying_subscriber_declare -.. doxygenfunction:: ze_querying_subscriber_declare_background +.. doxygenfunction:: ze_declare_querying_subscriber +.. doxygenfunction:: ze_undeclare_querying_subscriber +.. doxygenfunction:: ze_declare_background_querying_subscriber .. doxygenfunction:: ze_querying_subscriber_get .. doxygenfunction:: ze_querying_subscriber_drop diff --git a/docs/examples.rst b/docs/examples.rst index dd9454d39..91e28c6f6 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -81,7 +81,7 @@ Subscribe z_view_keyexpr_from_string(&key_expr, "key/expression"); z_owned_subscriber_t sub; - if (z_subscriber_declare(&sub, z_loan(s), z_loan(key_expr) z_move(callback), NULL) != 0) { + if (z_declare_subscriber(z_loan(s), &sub, z_loan(key_expr) z_move(callback), NULL) != 0) { printf("Unable to create Zenoh subscriber.\n"); z_drop(z_move(s)); exit(-1); @@ -195,7 +195,7 @@ Queryable z_closure(&callback, query_handler, NULL, (void*)keyexpr); z_owned_queryable_t qable; - if (z_queryable_declare(&qable, z_loan(s), z_loan(key_expr), z_move(callback), NULL) < 0) { + if (z_declare_queryable(z_loan(s), &qable, z_loan(key_expr), z_move(callback), NULL) < 0) { printf("Unable to create Zenoh queryable.\n"); exit(-1); } diff --git a/examples/z_liveliness.c b/examples/z_liveliness.c index affd242d5..987f8c4b9 100644 --- a/examples/z_liveliness.c +++ b/examples/z_liveliness.c @@ -45,7 +45,7 @@ int main(int argc, char** argv) { printf("Declaring liveliness token '%s'...\n", args.keyexpr); zc_owned_liveliness_token_t token; - if (zc_liveliness_declare_token(&token, z_loan(s), z_loan(keyexpr), NULL) < 0) { + if (zc_liveliness_declare_token(z_loan(s), &token, z_loan(keyexpr), NULL) < 0) { printf("Unable to create liveliness token!\n"); exit(-1); } diff --git a/examples/z_ping.c b/examples/z_ping.c index 77e867054..1304438f0 100644 --- a/examples/z_ping.c +++ b/examples/z_ping.c @@ -46,11 +46,11 @@ int main(int argc, char** argv) { z_view_keyexpr_t pong; z_view_keyexpr_from_str_unchecked(&pong, "test/pong"); z_owned_publisher_t pub; - z_publisher_declare(&pub, z_loan(session), z_loan(ping), NULL); + z_declare_publisher(z_loan(session), &pub, z_loan(ping), NULL); z_owned_closure_sample_t respond; z_closure(&respond, callback, drop, (void*)(&pub)); z_owned_subscriber_t sub; - z_subscriber_declare(&sub, z_loan(session), z_loan(pong), z_move(respond), NULL); + z_declare_subscriber(&sub, z_loan(session), z_loan(pong), z_move(respond), NULL); uint8_t* data = z_malloc(args.size); for (int i = 0; i < args.size; i++) { data[i] = i % 10; diff --git a/examples/z_ping_shm.c b/examples/z_ping_shm.c index e6fe35100..f8d8aaebb 100644 --- a/examples/z_ping_shm.c +++ b/examples/z_ping_shm.c @@ -64,11 +64,11 @@ int main(int argc, char** argv) { z_view_keyexpr_t pong; z_view_keyexpr_from_str_unchecked(&pong, "test/pong"); z_owned_publisher_t pub; - z_publisher_declare(&pub, z_loan(session), z_loan(ping), NULL); + z_declare_publisher(z_loan(session), &pub, z_loan(ping), NULL); z_owned_closure_sample_t respond; z_closure(&respond, callback, drop, (void*)(&pub)); z_owned_subscriber_t sub; - z_subscriber_declare(&sub, z_loan(session), z_loan(pong), z_move(respond), NULL); + z_declare_subscriber(z_loan(session), &sub, z_loan(pong), z_move(respond), NULL); // Create SHM Provider z_alloc_alignment_t alignment = {0}; diff --git a/examples/z_pong.c b/examples/z_pong.c index 9f14d1add..e31f9d55d 100644 --- a/examples/z_pong.c +++ b/examples/z_pong.c @@ -34,10 +34,10 @@ int main(int argc, char** argv) { z_view_keyexpr_t pong; z_view_keyexpr_from_str_unchecked(&pong, "test/pong"); z_owned_publisher_t pub; - z_publisher_declare(&pub, z_loan(session), z_loan(pong), NULL); + z_declare_publisher(z_loan(session), &pub, z_loan(pong), NULL); z_owned_closure_sample_t respond; z_closure(&respond, callback, drop, (void*)&pub); - z_subscriber_declare_background(z_loan(session), z_loan(ping), z_move(respond), NULL); + z_declare_background_subscriber(z_loan(session), z_loan(ping), z_move(respond), NULL); while (1) { z_sleep_s(1); diff --git a/examples/z_pub.c b/examples/z_pub.c index ec74cf3e8..2b7da9f98 100644 --- a/examples/z_pub.c +++ b/examples/z_pub.c @@ -54,7 +54,7 @@ int main(int argc, char** argv) { z_owned_publisher_t pub; z_view_keyexpr_t ke; z_view_keyexpr_from_str(&ke, args.keyexpr); - if (z_publisher_declare(&pub, z_loan(s), z_loan(ke), NULL) < 0) { + if (z_declare_publisher(z_loan(s), &pub, z_loan(ke), NULL) < 0) { printf("Unable to declare Publisher for key expression!\n"); exit(-1); } @@ -64,7 +64,7 @@ int main(int argc, char** argv) { if (args.add_matching_listener) { zc_owned_closure_matching_status_t callback; z_closure(&callback, matching_status_handler, NULL, NULL); - zc_publisher_matching_listener_declare(&listener, z_loan(pub), z_move(callback)); + zc_publisher_declare_matching_listener(z_loan(pub), &listener, z_move(callback)); } #else if (args.add_matching_listener) { diff --git a/examples/z_pub_attachment.c b/examples/z_pub_attachment.c index 5e3743950..c075c3d2f 100644 --- a/examples/z_pub_attachment.c +++ b/examples/z_pub_attachment.c @@ -48,7 +48,7 @@ int main(int argc, char** argv) { z_view_keyexpr_t ke; z_view_keyexpr_from_str(&ke, args.keyexpr); z_owned_publisher_t pub; - if (z_publisher_declare(&pub, z_loan(s), z_loan(ke), NULL)) { + if (z_declare_publisher(z_loan(s), &pub, z_loan(ke), NULL)) { printf("Unable to declare Publisher for key expression!\n"); exit(-1); } diff --git a/examples/z_pub_cache.c b/examples/z_pub_cache.c index 7858ac0a9..2393eae54 100644 --- a/examples/z_pub_cache.c +++ b/examples/z_pub_cache.c @@ -56,7 +56,7 @@ int main(int argc, char** argv) { z_view_keyexpr_t ke; z_view_keyexpr_from_str(&ke, args.keyexpr); - if (ze_publication_cache_declare(&pub_cache, z_loan(s), z_loan(ke), &pub_cache_opts) != Z_OK) { + if (ze_declare_publication_cache(z_loan(s), &pub_cache, z_loan(ke), &pub_cache_opts) != Z_OK) { printf("Unable to declare publication cache for key expression!\n"); exit(-1); } diff --git a/examples/z_pub_shm.c b/examples/z_pub_shm.c index 896043fae..8a22fbeec 100644 --- a/examples/z_pub_shm.c +++ b/examples/z_pub_shm.c @@ -55,7 +55,7 @@ int main(int argc, char** argv) { z_owned_publisher_t pub; z_view_keyexpr_t ke; z_view_keyexpr_from_str(&ke, args.keyexpr); - if (z_publisher_declare(&pub, z_loan(s), z_loan(ke), NULL) < 0) { + if (z_declare_publisher(z_loan(s), &pub, z_loan(ke), NULL) < 0) { printf("Unable to declare Publisher for key expression!\n"); exit(-1); } @@ -64,7 +64,7 @@ int main(int argc, char** argv) { if (args.add_matching_listener) { zc_owned_closure_matching_status_t callback; z_closure(&callback, matching_status_handler, NULL, NULL); - zc_publisher_matching_listener_declare(&listener, z_loan(pub), z_move(callback)); + zc_publisher_declare_matching_listener(z_loan(pub), &listener, z_move(callback)); } #else if (add_matching_listener) { diff --git a/examples/z_pub_shm_thr.c b/examples/z_pub_shm_thr.c index 8fa4e5de1..4bad1308e 100644 --- a/examples/z_pub_shm_thr.c +++ b/examples/z_pub_shm_thr.c @@ -53,7 +53,7 @@ int main(int argc, char **argv) { z_owned_publisher_t pub; z_view_keyexpr_t ke; z_view_keyexpr_from_str(&ke, keyexpr); - if (z_publisher_declare(&pub, z_loan(s), z_loan(ke), &options)) { + if (z_declare_publisher(z_loan(s), &pub, z_loan(ke), &options)) { printf("Unable to declare publisher for key expression!\n"); exit(-1); } diff --git a/examples/z_pub_thr.c b/examples/z_pub_thr.c index 19a057a92..da2604e36 100644 --- a/examples/z_pub_thr.c +++ b/examples/z_pub_thr.c @@ -48,7 +48,7 @@ int main(int argc, char** argv) { z_owned_publisher_t pub; z_view_keyexpr_t ke; z_view_keyexpr_from_str(&ke, keyexpr); - if (z_publisher_declare(&pub, z_loan(s), z_loan(ke), &options)) { + if (z_declare_publisher(z_loan(s), &pub, z_loan(ke), &options)) { printf("Unable to declare publisher for key expression!\n"); exit(-1); } diff --git a/examples/z_pull.c b/examples/z_pull.c index d8c6d5b5a..ffaf38686 100644 --- a/examples/z_pull.c +++ b/examples/z_pull.c @@ -59,7 +59,7 @@ int main(int argc, char** argv) { z_view_keyexpr_from_str(&ke, args.keyexpr); z_owned_subscriber_t sub; - if (z_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(closure), NULL) < 0) { + if (z_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(closure), NULL) < 0) { printf("Unable to declare subscriber.\n"); exit(-1); } diff --git a/examples/z_query_sub.c b/examples/z_query_sub.c index be9ae30b8..b7dce5ed0 100644 --- a/examples/z_query_sub.c +++ b/examples/z_query_sub.c @@ -59,7 +59,7 @@ int main(int argc, char** argv) { z_closure(&callback, data_handler, NULL, NULL); printf("Declaring querying subscriber on '%s'...\n", args.keyexpr); ze_owned_querying_subscriber_t sub; - if (ze_querying_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), &sub_opts) < 0) { + if (ze_declare_querying_subscriber(z_loan(s), &sub, z_loan(ke), z_move(callback), &sub_opts) < 0) { printf("Unable to declare querying subscriber.\n"); exit(-1); } diff --git a/examples/z_queryable.c b/examples/z_queryable.c index ca295f023..13d381334 100644 --- a/examples/z_queryable.c +++ b/examples/z_queryable.c @@ -86,7 +86,7 @@ int main(int argc, char **argv) { z_closure(&callback, query_handler, NULL, (void *)args.keyexpr); z_owned_queryable_t qable; - if (z_queryable_declare(&qable, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) { + if (z_declare_queryable(z_loan(s), &qable, z_loan(ke), z_move(callback), NULL) < 0) { printf("Unable to create queryable.\n"); exit(-1); } diff --git a/examples/z_queryable_shm.c b/examples/z_queryable_shm.c index 260d731c3..995e26a84 100644 --- a/examples/z_queryable_shm.c +++ b/examples/z_queryable_shm.c @@ -119,7 +119,7 @@ int main(int argc, char **argv) { z_closure(&callback, query_handler, (void *)z_loan(provider), (void *)keyexpr); z_owned_queryable_t qable; - if (z_queryable_declare(&qable, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) { + if (z_declare_queryable(z_loan(s), &qable, z_loan(ke), z_move(callback), NULL) < 0) { printf("Unable to create queryable.\n"); exit(-1); } diff --git a/examples/z_queryable_with_channels.c b/examples/z_queryable_with_channels.c index 6238dbcae..9fcb220c9 100644 --- a/examples/z_queryable_with_channels.c +++ b/examples/z_queryable_with_channels.c @@ -52,7 +52,7 @@ int main(int argc, char** argv) { z_fifo_channel_query_new(&closure, &handler, 16); z_owned_queryable_t qable; - if (z_queryable_declare(&qable, z_loan(s), z_loan(ke), z_move(closure), NULL) < 0) { + if (z_declare_queryable(z_loan(s), &qable, z_loan(ke), z_move(closure), NULL) < 0) { printf("Unable to create queryable.\n"); exit(-1); } diff --git a/examples/z_sub.c b/examples/z_sub.c index 0d823c686..cd73fe0b6 100644 --- a/examples/z_sub.c +++ b/examples/z_sub.c @@ -70,7 +70,7 @@ int main(int argc, char **argv) { z_closure(&callback, data_handler, NULL, NULL); printf("Declaring Subscriber on '%s'...\n", args.keyexpr); z_owned_subscriber_t sub; - if (z_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) { + if (z_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(callback), NULL) < 0) { printf("Unable to declare subscriber.\n"); exit(-1); } diff --git a/examples/z_sub_attachment.c b/examples/z_sub_attachment.c index 6178b15db..8e4b1c819 100644 --- a/examples/z_sub_attachment.c +++ b/examples/z_sub_attachment.c @@ -74,7 +74,7 @@ int main(int argc, char** argv) { z_closure(&callback, data_handler, NULL, NULL); printf("Declaring Subscriber on '%s'...\n", args.keyexpr); z_owned_subscriber_t sub; - if (z_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL)) { + if (z_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(callback), NULL)) { printf("Unable to declare subscriber.\n"); exit(-1); } diff --git a/examples/z_sub_liveliness.c b/examples/z_sub_liveliness.c index f2efd65f1..4279959b2 100644 --- a/examples/z_sub_liveliness.c +++ b/examples/z_sub_liveliness.c @@ -60,7 +60,7 @@ int main(int argc, char** argv) { z_owned_closure_sample_t callback; z_closure(&callback, data_handler, NULL, NULL); z_owned_subscriber_t sub; - if (zc_liveliness_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) { + if (zc_liveliness_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(callback), NULL) < 0) { printf("Unable to declare liveliness subscriber.\n"); exit(-1); } diff --git a/examples/z_sub_shm.c b/examples/z_sub_shm.c index e49eb8b6a..b2cd00017 100644 --- a/examples/z_sub_shm.c +++ b/examples/z_sub_shm.c @@ -87,7 +87,7 @@ int main(int argc, char **argv) { z_closure(&callback, data_handler, NULL, NULL); printf("Declaring Subscriber on '%s'...\n", keyexpr); z_owned_subscriber_t sub; - if (z_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) { + if (z_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(callback), NULL) < 0) { printf("Unable to declare subscriber.\n"); exit(-1); } diff --git a/examples/z_sub_thr.c b/examples/z_sub_thr.c index f5c595fbe..1addec736 100644 --- a/examples/z_sub_thr.c +++ b/examples/z_sub_thr.c @@ -90,12 +90,12 @@ int main(int argc, char **argv) { z_view_keyexpr_t ke; z_view_keyexpr_from_str(&ke, "test/thr"); z_owned_keyexpr_t declared_ke; - z_declare_keyexpr(&declared_ke, z_loan(s), z_loan(ke)); + z_declare_keyexpr(z_loan(s), &declared_ke, z_loan(ke)); z_stats_t *context = z_stats_make(); z_owned_closure_sample_t callback; z_closure(&callback, on_sample, drop_stats, context); - if (z_subscriber_declare_background(z_loan(s), z_loan(declared_ke), z_move(callback), NULL)) { + if (z_declare_background_subscriber(z_loan(s), z_loan(declared_ke), z_move(callback), NULL)) { printf("Unable to create subscriber.\n"); exit(-1); } @@ -105,7 +105,7 @@ int main(int argc, char **argv) { z_sleep_s(1); } - z_undeclare_keyexpr(z_move(declared_ke), z_loan(s)); + z_undeclare_keyexpr(z_loan(s), z_move(declared_ke)); z_drop(z_move(s)); return 0; } diff --git a/include/zenoh_commons.h b/include/zenoh_commons.h index c77b90a28..224372239 100644 --- a/include/zenoh_commons.h +++ b/include/zenoh_commons.h @@ -16,6 +16,32 @@ #define ALIGN(n) #define ZENOHC_API #endif +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Allocation errors + */ +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) +typedef enum z_alloc_error_t { +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) + /** + * Defragmentation needed. + */ + Z_ALLOC_ERROR_NEED_DEFRAGMENT, +#endif +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) + /** + * The provider is out of memory. + */ + Z_ALLOC_ERROR_OUT_OF_MEMORY, +#endif +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) + /** + * Other error. + */ + Z_ALLOC_ERROR_OTHER, +#endif +} z_alloc_error_t; +#endif typedef enum z_congestion_control_t { /** * Messages are not dropped in case of congestion. @@ -77,6 +103,26 @@ typedef enum z_keyexpr_intersection_level_t { Z_KEYEXPR_INTERSECTION_LEVEL_EQUALS = 3, } z_keyexpr_intersection_level_t; #endif +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Layouting errors + */ +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) +typedef enum z_layout_error_t { +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) + /** + * Layout arguments are incorrect. + */ + Z_LAYOUT_ERROR_INCORRECT_LAYOUT_ARGS, +#endif +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) + /** + * Layout incompatible with provider. + */ + Z_LAYOUT_ERROR_PROVIDER_INCOMPATIBLE_LAYOUT, +#endif +} z_layout_error_t; +#endif /** * The priority of zenoh messages. */ @@ -169,6 +215,52 @@ typedef enum z_whatami_t { Z_WHATAMI_PEER = 2, Z_WHATAMI_CLIENT = 4, } z_whatami_t; +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Status of SHM buffer allocation operation. + */ +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) +typedef enum zc_buf_alloc_status_t { +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) + /** + * Allocation ok + */ + ZC_BUF_ALLOC_STATUS_OK = 0, +#endif +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) + /** + * Allocation error + */ + ZC_BUF_ALLOC_STATUS_ALLOC_ERROR = 1, +#endif +} zc_buf_alloc_status_t; +#endif +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Status of SHM buffer layouting + allocation operation. + */ +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) +typedef enum zc_buf_layout_alloc_status_t { +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) + /** + * Allocation ok + */ + ZC_BUF_LAYOUT_ALLOC_STATUS_OK = 0, +#endif +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) + /** + * Allocation error + */ + ZC_BUF_LAYOUT_ALLOC_STATUS_ALLOC_ERROR = 1, +#endif +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) + /** + * Layouting error + */ + ZC_BUF_LAYOUT_ALLOC_STATUS_LAYOUT_ERROR = 2, +#endif +} zc_buf_layout_alloc_status_t; +#endif /** * The locality of samples to be received by subscribers or targeted by publishers. */ @@ -237,19 +329,56 @@ typedef enum zc_reply_keyexpr_t { ZC_REPLY_KEYEXPR_MATCHING_QUERY = 1, } zc_reply_keyexpr_t; #endif -typedef struct z_moved_alloc_layout_t { - struct z_owned_alloc_layout_t _this; -} z_moved_alloc_layout_t; +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief A result of SHM buffer allocation operation. + */ +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) +typedef struct z_buf_alloc_result_t { + enum zc_buf_alloc_status_t status; + z_owned_shm_mut_t buf; + enum z_alloc_error_t error; +} z_buf_alloc_result_t; +#endif typedef int8_t z_result_t; +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief An AllocAlignment. + */ +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) +typedef struct z_alloc_alignment_t { + uint8_t pow; +} z_alloc_alignment_t; +#endif +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) +typedef struct zc_threadsafe_context_data_t { + void *ptr; +} zc_threadsafe_context_data_t; +#endif +/** + * A tread-safe droppable context. + * Contexts are idiomatically used in C together with callback interfaces to deliver associated state + * information to each callback. + * + * This is a thread-safe context - the associated callbacks may be executed concurrently with the same + * zc_context_t instance. In other words, all the callbacks associated with this context data MUST be + * thread-safe. + * + * Once moved to zenoh-c ownership, this context is guaranteed to execute delete_fn when deleted.The + * delete_fn is guaranteed to be executed only once at some point of time after the last associated + * callback call returns. + * NOTE: if user doesn't pass the instance of this context to zenoh-c, the delete_fn callback won't + * be executed. + */ +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) +typedef struct zc_threadsafe_context_t { + struct zc_threadsafe_context_data_t context; + void (*delete_fn)(void*); +} zc_threadsafe_context_t; +#endif typedef struct z_moved_bytes_t { struct z_owned_bytes_t _this; } z_moved_bytes_t; -typedef struct z_moved_shm_t { - struct z_owned_shm_t _this; -} z_moved_shm_t; -typedef struct z_moved_shm_mut_t { - struct z_owned_shm_mut_t _this; -} z_moved_shm_mut_t; typedef struct z_moved_slice_t { struct z_owned_slice_t _this; } z_moved_slice_t; @@ -265,9 +394,41 @@ typedef struct ALIGN(8) z_bytes_slice_iterator_t { typedef struct z_moved_bytes_writer_t { struct z_owned_bytes_writer_t _this; } z_moved_bytes_writer_t; -typedef struct z_moved_chunk_alloc_result_t { - struct z_owned_chunk_alloc_result_t _this; -} z_moved_chunk_alloc_result_t; +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Unique segment identifier. + */ +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) +typedef uint32_t z_segment_id_t; +#endif +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Chunk id within it's segment. + */ +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) +typedef uint32_t z_chunk_id_t; +#endif +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief A ChunkDescriptor. + */ +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) +typedef struct z_chunk_descriptor_t { + z_segment_id_t segment; + z_chunk_id_t chunk; + size_t len; +} z_chunk_descriptor_t; +#endif +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief An AllocatedChunk. + */ +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) +typedef struct z_allocated_chunk_t { + struct z_chunk_descriptor_t descriptpr; + void *data; +} z_allocated_chunk_t; +#endif /** * Monotonic clock */ @@ -422,7 +583,7 @@ typedef struct z_owned_closure_zid_t { /** * A callback function. */ - void (*call)(const struct z_id_t *z_id, void *context); + void (*call)(const z_id_t *z_id, void *context); /** * An optional function that will be called upon closure drop. */ @@ -444,6 +605,64 @@ typedef struct z_moved_condvar_t { typedef struct z_moved_config_t { struct z_owned_config_t _this; } z_moved_config_t; +/** + * Options passed to the `z_declare_queryable()` function. + */ +typedef struct z_queryable_options_t { + /** + * The completeness of the Queryable. + */ + bool complete; +} z_queryable_options_t; +/** + * Options passed to the `z_declare_subscriber()` function. + */ +typedef struct z_subscriber_options_t { + /** + * Dummy field to avoid having fieldless struct + */ + uint8_t _0; +} z_subscriber_options_t; +typedef struct z_moved_encoding_t { + struct z_owned_encoding_t _this; +} z_moved_encoding_t; +/** + * Options passed to the `z_declare_publisher()` function. + */ +typedef struct z_publisher_options_t { + /** + * Default encoding for messages put by this publisher. + */ + struct z_moved_encoding_t *encoding; + /** + * The congestion control to apply when routing messages from this publisher. + */ + enum z_congestion_control_t congestion_control; + /** + * The priority of messages from this publisher. + */ + enum z_priority_t priority; + /** + * If true, Zenoh will not wait to batch this message with others to reduce the bandwith. + */ + bool is_express; +#if defined(Z_FEATURE_UNSTABLE_API) + /** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * + * The publisher reliability. + */ + enum z_reliability_t reliability; +#endif +#if defined(Z_FEATURE_UNSTABLE_API) + /** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * + * The allowed destination for this publisher. + */ + enum zc_locality_t allowed_destination; +#endif +} z_publisher_options_t; /** * Options passed to the `z_delete()` function. */ @@ -481,9 +700,6 @@ typedef struct z_delete_options_t { enum zc_locality_t allowed_destination; #endif } z_delete_options_t; -typedef struct z_moved_encoding_t { - struct z_owned_encoding_t _this; -} z_moved_encoding_t; typedef struct z_moved_fifo_handler_query_t { struct z_owned_fifo_handler_query_t _this; } z_moved_fifo_handler_query_t; @@ -499,9 +715,6 @@ typedef struct z_moved_fifo_handler_sample_t { typedef struct z_query_consolidation_t { enum z_consolidation_mode_t mode; } z_query_consolidation_t; -typedef struct z_moved_source_info_t { - struct z_owned_source_info_t _this; -} z_moved_source_info_t; /** * Options passed to the `z_get()` function. */ @@ -556,7 +769,7 @@ typedef struct z_get_options_t { * * The source info for the query. */ - struct z_moved_source_info_t *source_info; + z_moved_source_info_t *source_info; #endif /** * An optional attachment to attach to the query. @@ -573,9 +786,6 @@ typedef struct z_moved_hello_t { typedef struct z_moved_keyexpr_t { struct z_owned_keyexpr_t _this; } z_moved_keyexpr_t; -typedef struct z_moved_memory_layout_t { - struct z_owned_memory_layout_t _this; -} z_moved_memory_layout_t; typedef struct z_moved_mutex_t { struct z_owned_mutex_t _this; } z_moved_mutex_t; @@ -585,43 +795,6 @@ typedef struct z_moved_mutex_t { typedef struct z_open_options_t { uint8_t _dummy; } z_open_options_t; -/** - * Options passed to the `z_publisher_declare()` function. - */ -typedef struct z_publisher_options_t { - /** - * Default encoding for messages put by this publisher. - */ - struct z_moved_encoding_t *encoding; - /** - * The congestion control to apply when routing messages from this publisher. - */ - enum z_congestion_control_t congestion_control; - /** - * The priority of messages from this publisher. - */ - enum z_priority_t priority; - /** - * If true, Zenoh will not wait to batch this message with others to reduce the bandwith. - */ - bool is_express; -#if defined(Z_FEATURE_UNSTABLE_API) - /** - * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * - * The publisher reliability. - */ - enum z_reliability_t reliability; -#endif -#if defined(Z_FEATURE_UNSTABLE_API) - /** - * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * - * The allowed destination for this publisher. - */ - enum zc_locality_t allowed_destination; -#endif -} z_publisher_options_t; /** * Represents the set of options that can be applied to the delete operation by a previously declared publisher, * whenever issued via `z_publisher_delete()`. @@ -653,7 +826,7 @@ typedef struct z_publisher_put_options_t { * * The source info for the publication. */ - struct z_moved_source_info_t *source_info; + z_moved_source_info_t *source_info; #endif /** * The attachment to attach to the publication. @@ -706,7 +879,7 @@ typedef struct z_put_options_t { * * The source info for the message. */ - struct z_moved_source_info_t *source_info; + z_moved_source_info_t *source_info; #endif /** * The attachment to this message. @@ -747,7 +920,7 @@ typedef struct z_query_reply_options_t { * * The source info for the reply. */ - struct z_moved_source_info_t *source_info; + z_moved_source_info_t *source_info; #endif /** * The attachment to this reply. @@ -781,7 +954,7 @@ typedef struct z_query_reply_del_options_t { * * The source info for the reply. */ - struct z_moved_source_info_t *source_info; + z_moved_source_info_t *source_info; #endif /** * The attachment to this reply. @@ -798,15 +971,6 @@ typedef struct z_query_reply_err_options_t { */ struct z_moved_encoding_t *encoding; } z_query_reply_err_options_t; -/** - * Options passed to the `z_queryable_declare()` function. - */ -typedef struct z_queryable_options_t { - /** - * The completeness of the Queryable. - */ - bool complete; -} z_queryable_options_t; typedef struct z_moved_queryable_t { struct z_owned_queryable_t _this; } z_moved_queryable_t; @@ -844,15 +1008,46 @@ typedef struct z_scout_options_t { typedef struct z_moved_session_t { struct z_owned_session_t _this; } z_moved_session_t; -typedef struct z_moved_shm_client_t { - struct z_owned_shm_client_t _this; -} z_moved_shm_client_t; -typedef struct z_moved_shm_client_storage_t { - struct z_owned_shm_client_storage_t _this; -} z_moved_shm_client_storage_t; -typedef struct z_moved_shm_provider_t { - struct z_owned_shm_provider_t _this; -} z_moved_shm_provider_t; +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Callbacks for ShmSegment. + */ +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) +typedef struct zc_shm_segment_callbacks_t { + uint8_t *(*map_fn)(z_chunk_id_t chunk_id, void *context); +} zc_shm_segment_callbacks_t; +#endif +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief An ShmSegment. + */ +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) +typedef struct z_shm_segment_t { + struct zc_threadsafe_context_t context; + struct zc_shm_segment_callbacks_t callbacks; +} z_shm_segment_t; +#endif +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Callback for ShmClient. + */ +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) +typedef struct zc_shm_client_callbacks_t { + bool (*attach_fn)(struct z_shm_segment_t *out_segment, z_segment_id_t segment_id, void *context); +} zc_shm_client_callbacks_t; +#endif +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief A result of SHM buffer layouting + allocation operation. + */ +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) +typedef struct z_buf_layout_alloc_result_t { + enum zc_buf_layout_alloc_status_t status; + z_owned_shm_mut_t buf; + enum z_alloc_error_t alloc_error; + enum z_layout_error_t layout_error; +} z_buf_layout_alloc_result_t; +#endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. * @brief Unique protocol identifier. @@ -862,18 +1057,50 @@ typedef struct z_moved_shm_provider_t { #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) typedef uint32_t z_protocol_id_t; #endif +/** + * A non-tread-safe droppable context. + * Contexts are idiomatically used in C together with callback interfaces to deliver associated state + * information to each callback. + * + * This is a non-thread-safe context - zenoh-c guarantees that associated callbacks that share the same + * zc_context_t instance will never be executed concurrently. In other words, all the callbacks associated + * with this context data are not required to be thread-safe. + * + * NOTE: Remember that the same callback interfaces associated with different zc_context_t instances can + * still be executed concurrently. The exact behavior depends on user's application, but we strongly + * discourage our users from pinning to some specific behavior unless they _really_ understand what they + * are doing. + * + * Once moved to zenoh-c ownership, this context is guaranteed to execute delete_fn when deleted. The + * delete_fn is guaranteed to be executed only once at some point of time after the last associated + * callback call returns. + * NOTE: if user doesn't pass the instance of this context to zenoh-c, the delete_fn callback won't + * be executed. + */ +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) +typedef struct zc_context_t { + void *context; + void (*delete_fn)(void*); +} zc_context_t; +#endif +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Callbacks for ShmProviderBackend. + */ +#if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) +typedef struct zc_shm_provider_backend_callbacks_t { + void (*alloc_fn)(z_owned_chunk_alloc_result_t *out_result, + const z_loaned_memory_layout_t *layout, + void *context); + void (*free_fn)(const struct z_chunk_descriptor_t *chunk, void *context); + size_t (*defragment_fn)(void *context); + size_t (*available_fn)(void *context); + void (*layout_for_fn)(z_owned_memory_layout_t *layout, void *context); +} zc_shm_provider_backend_callbacks_t; +#endif typedef struct z_moved_string_array_t { struct z_owned_string_array_t _this; } z_moved_string_array_t; -/** - * Options passed to the `z_subscriber_declare()` function. - */ -typedef struct z_subscriber_options_t { - /** - * Dummy field to avoid having fieldless struct - */ - uint8_t _0; -} z_subscriber_options_t; typedef struct z_moved_subscriber_t { struct z_owned_subscriber_t _this; } z_moved_subscriber_t; @@ -958,6 +1185,15 @@ typedef struct zc_owned_closure_matching_status_t { void (*drop)(void *context); } zc_owned_closure_matching_status_t; #endif +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Loaned closure. + */ +#if defined(Z_FEATURE_UNSTABLE_API) +typedef struct zc_loaned_closure_matching_status_t { + size_t _0[3]; +} zc_loaned_closure_matching_status_t; +#endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. * @brief Moved closure. @@ -978,34 +1214,25 @@ typedef struct zc_liveliness_declaration_options_t { #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * @brief The options for `zc_liveliness_get()` + * @brief The options for `zc_liveliness_declare_subscriber()` */ #if defined(Z_FEATURE_UNSTABLE_API) -typedef struct zc_liveliness_get_options_t { - uint32_t timeout_ms; -} zc_liveliness_get_options_t; +typedef struct zc_liveliness_subscriber_options_t { + bool history; +} zc_liveliness_subscriber_options_t; #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * @brief The options for `zc_liveliness_subscriber_declare()` + * @brief The options for `zc_liveliness_get()` */ #if defined(Z_FEATURE_UNSTABLE_API) -typedef struct zc_liveliness_subscriber_options_t { - bool history; -} zc_liveliness_subscriber_options_t; +typedef struct zc_liveliness_get_options_t { + uint32_t timeout_ms; +} zc_liveliness_get_options_t; #endif -typedef struct zc_moved_liveliness_token_t { - struct zc_owned_liveliness_token_t _this; -} zc_moved_liveliness_token_t; -typedef struct zc_moved_matching_listener_t { - struct zc_owned_matching_listener_t _this; -} zc_moved_matching_listener_t; -typedef struct zc_moved_shm_client_list_t { - struct zc_owned_shm_client_list_t _this; -} zc_moved_shm_client_list_t; /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * @brief Options passed to the `ze_publication_cache_declare()` function. + * @brief Options passed to the `ze_declare_publication_cache()` function. */ #if defined(Z_FEATURE_UNSTABLE_API) typedef struct ze_publication_cache_options_t { @@ -1033,20 +1260,10 @@ typedef struct ze_publication_cache_options_t { size_t resources_limit; } ze_publication_cache_options_t; #endif -typedef struct ze_moved_publication_cache_t { - struct ze_owned_publication_cache_t _this; -} ze_moved_publication_cache_t; -/** - * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * @brief A loaned Zenoh publication cache. - */ -typedef struct ALIGN(8) ze_loaned_publication_cache_t { - uint8_t _0[96]; -} ze_loaned_publication_cache_t; /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. * @brief A set of options that can be applied to a querying subscriber, - * upon its declaration via `ze_querying_subscriber_declare()`. + * upon its declaration via `ze_declare_querying_subscriber()`. * */ #if defined(Z_FEATURE_UNSTABLE_API) @@ -1081,9 +1298,6 @@ typedef struct ze_querying_subscriber_options_t { uint64_t query_timeout_ms; } ze_querying_subscriber_options_t; #endif -typedef struct ze_moved_querying_subscriber_t { - struct ze_owned_querying_subscriber_t _this; -} ze_moved_querying_subscriber_t; typedef struct ze_moved_serializer_t { struct ze_owned_serializer_t _this; } ze_moved_serializer_t; @@ -1106,40 +1320,39 @@ ZENOHC_API extern const unsigned int Z_SHM_POSIX_PROTOCOL_ID; #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API void z_alloc_layout_alloc(struct z_buf_alloc_result_t *out_result, - const struct z_loaned_alloc_layout_t *layout); + const z_loaned_alloc_layout_t *layout); #endif #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API void z_alloc_layout_alloc_gc(struct z_buf_alloc_result_t *out_result, - const struct z_loaned_alloc_layout_t *layout); + const z_loaned_alloc_layout_t *layout); #endif #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API void z_alloc_layout_alloc_gc_defrag(struct z_buf_alloc_result_t *out_result, - const struct z_loaned_alloc_layout_t *layout); + const z_loaned_alloc_layout_t *layout); #endif #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API void z_alloc_layout_alloc_gc_defrag_blocking(struct z_buf_alloc_result_t *out_result, - const struct z_loaned_alloc_layout_t *layout); + const z_loaned_alloc_layout_t *layout); #endif #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API void z_alloc_layout_alloc_gc_defrag_dealloc(struct z_buf_alloc_result_t *out_result, - const struct z_loaned_alloc_layout_t *layout); + const z_loaned_alloc_layout_t *layout); #endif /** * Deletes Alloc Layout */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) -ZENOHC_API void z_alloc_layout_drop(struct z_moved_alloc_layout_t *this_); +ZENOHC_API void z_alloc_layout_drop(z_moved_alloc_layout_t *this_); #endif /** * Borrows Alloc Layout */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) -ZENOHC_API -const struct z_loaned_alloc_layout_t *z_alloc_layout_loan(const struct z_owned_alloc_layout_t *this_); +ZENOHC_API const z_loaned_alloc_layout_t *z_alloc_layout_loan(const z_owned_alloc_layout_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -1147,15 +1360,15 @@ const struct z_loaned_alloc_layout_t *z_alloc_layout_loan(const struct z_owned_a */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -z_result_t z_alloc_layout_new(struct z_owned_alloc_layout_t *this_, - const struct z_loaned_shm_provider_t *provider, +z_result_t z_alloc_layout_new(z_owned_alloc_layout_t *this_, + const z_loaned_shm_provider_t *provider, size_t size, struct z_alloc_alignment_t alignment); #endif #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API z_result_t z_alloc_layout_threadsafe_alloc_gc_defrag_async(struct z_buf_alloc_result_t *out_result, - const struct z_loaned_alloc_layout_t *layout, + const z_loaned_alloc_layout_t *layout, struct zc_threadsafe_context_t result_context, void (*result_callback)(void*, struct z_buf_alloc_result_t*)); @@ -1225,7 +1438,7 @@ z_result_t z_bytes_from_buf(struct z_owned_bytes_t *this_, #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API z_result_t z_bytes_from_shm(struct z_owned_bytes_t *this_, - struct z_moved_shm_t *shm); + z_moved_shm_t *shm); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -1234,7 +1447,7 @@ z_result_t z_bytes_from_shm(struct z_owned_bytes_t *this_, #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API z_result_t z_bytes_from_shm_mut(struct z_owned_bytes_t *this_, - struct z_moved_shm_mut_t *shm); + z_moved_shm_mut_t *shm); #endif /** * Converts a slice into `z_owned_bytes_t`. @@ -1361,7 +1574,7 @@ bool z_bytes_slice_iterator_next(struct z_bytes_slice_iterator_t *this_, #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API z_result_t z_bytes_to_loaned_shm(const struct z_loaned_bytes_t *this_, - const struct z_loaned_shm_t **dst); + const z_loaned_shm_t **dst); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -1373,7 +1586,7 @@ z_result_t z_bytes_to_loaned_shm(const struct z_loaned_bytes_t *this_, #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API z_result_t z_bytes_to_mut_loaned_shm(struct z_loaned_bytes_t *this_, - struct z_loaned_shm_t **dst); + z_loaned_shm_t **dst); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -1385,7 +1598,7 @@ z_result_t z_bytes_to_mut_loaned_shm(struct z_loaned_bytes_t *this_, #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API z_result_t z_bytes_to_owned_shm(const struct z_loaned_bytes_t *this_, - struct z_owned_shm_t *dst); + z_owned_shm_t *dst); #endif /** * Converts data into an owned slice. @@ -1458,7 +1671,7 @@ z_result_t z_bytes_writer_write_all(struct z_loaned_bytes_writer_t *this_, */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_chunk_alloc_result_drop(struct z_moved_chunk_alloc_result_t *this_); +void z_chunk_alloc_result_drop(z_moved_chunk_alloc_result_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -1466,7 +1679,7 @@ void z_chunk_alloc_result_drop(struct z_moved_chunk_alloc_result_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -const struct z_loaned_chunk_alloc_result_t *z_chunk_alloc_result_loan(const struct z_owned_chunk_alloc_result_t *this_); +const z_loaned_chunk_alloc_result_t *z_chunk_alloc_result_loan(const z_owned_chunk_alloc_result_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -1474,7 +1687,7 @@ const struct z_loaned_chunk_alloc_result_t *z_chunk_alloc_result_loan(const stru */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_chunk_alloc_result_new_error(struct z_owned_chunk_alloc_result_t *this_, +void z_chunk_alloc_result_new_error(z_owned_chunk_alloc_result_t *this_, enum z_alloc_error_t alloc_error); #endif /** @@ -1483,7 +1696,7 @@ void z_chunk_alloc_result_new_error(struct z_owned_chunk_alloc_result_t *this_, */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -z_result_t z_chunk_alloc_result_new_ok(struct z_owned_chunk_alloc_result_t *this_, +z_result_t z_chunk_alloc_result_new_ok(z_owned_chunk_alloc_result_t *this_, struct z_allocated_chunk_t allocated_chunk); #endif /** @@ -1633,7 +1846,7 @@ const struct z_loaned_closure_sample_t *z_closure_sample_loan(const struct z_own #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API void z_closure_zid(struct z_owned_closure_zid_t *this_, - void (*call)(const struct z_id_t *z_id, void *context), + void (*call)(const z_id_t *z_id, void *context), void (*drop)(void *context), void *context); #endif @@ -1644,7 +1857,7 @@ void z_closure_zid(struct z_owned_closure_zid_t *this_, #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API void z_closure_zid_call(const struct z_loaned_closure_zid_t *closure, - const struct z_id_t *z_id); + const z_id_t *z_id); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -1713,19 +1926,103 @@ ZENOHC_API const struct z_loaned_config_t *z_config_loan(const struct z_owned_co * Mutably borrows config. */ ZENOHC_API struct z_loaned_config_t *z_config_loan_mut(struct z_owned_config_t *this_); +/** + * Declares a background queryable for a given keyexpr. The queryable callback will be be called + * to proccess incoming queries until the corresponding session is closed or dropped. + * + * @param session: The zenoh session. + * @param key_expr: The key expression the Queryable will reply to. + * @param callback: The callback function that will be called each time a matching query is received. Its ownership is passed to queryable. + * @param options: Options for the queryable. + * + * @return 0 in case of success, negative error code otherwise (in this case ) + */ +ZENOHC_API +z_result_t z_declare_background_queryable(const struct z_loaned_session_t *session, + const struct z_loaned_keyexpr_t *key_expr, + struct z_moved_closure_query_t *callback, + struct z_queryable_options_t *options); +/** + * Constructs and declares a background subscriber. Subscriber callback will be called to process the messages, + * until the corresponding session is closed or dropped. + * + * @param session: The zenoh session. + * @param key_expr: The key expression to subscribe. + * @param callback: The callback function that will be called each time a data matching the subscribed expression is received. + * @param _options: The options to be passed to the subscriber declaration. + * + * @return 0 in case of success, negative error code otherwise. + */ +ZENOHC_API +z_result_t z_declare_background_subscriber(const struct z_loaned_session_t *session, + const struct z_loaned_keyexpr_t *key_expr, + struct z_moved_closure_sample_t *callback, + struct z_subscriber_options_t *_options); /** * Constructs and declares a key expression on the network. This reduces key key expression to a numerical id, * which allows to save the bandwith, when passing key expression between Zenoh entities. * - * @param this_: An uninitialized location in memory where key expression will be constructed. * @param session: Session on which to declare key expression. + * @param declared_key_expr: An uninitialized location in memory where key expression will be constructed. * @param key_expr: Key expression to declare on network. * @return 0 in case of success, negative error code otherwise. */ ZENOHC_API -z_result_t z_declare_keyexpr(struct z_owned_keyexpr_t *this_, - const struct z_loaned_session_t *session, +z_result_t z_declare_keyexpr(const struct z_loaned_session_t *session, + struct z_owned_keyexpr_t *declared_key_expr, const struct z_loaned_keyexpr_t *key_expr); +/** + * Constructs and declares a publisher for the given key expression. + * + * Data can be put and deleted with this publisher with the help of the + * `z_publisher_put()` and `z_publisher_delete()` functions. + * + * @param session: The Zenoh session. + * @param publisher: An unitilized location in memory where publisher will be constructed. + * @param key_expr: The key expression to publish. + * @param options: Additional options for the publisher. + * + * @return 0 in case of success, negative error code otherwise. + */ +ZENOHC_API +z_result_t z_declare_publisher(const struct z_loaned_session_t *session, + struct z_owned_publisher_t *publisher, + const struct z_loaned_keyexpr_t *key_expr, + struct z_publisher_options_t *options); +/** + * Constructs a Queryable for the given key expression. + * + * @param session: A Zenoh session. + * @param queryable: An uninitialized memory location where queryable will be constructed. + * @param key_expr: The key expression the Queryable will reply to. + * @param callback: The callback function that will be called each time a matching query is received. Its ownership is passed to queryable. + * @param options: Options for the queryable. + * + * @return 0 in case of success, negative error code otherwise (in this case ) + */ +ZENOHC_API +z_result_t z_declare_queryable(const struct z_loaned_session_t *session, + struct z_owned_queryable_t *queryable, + const struct z_loaned_keyexpr_t *key_expr, + struct z_moved_closure_query_t *callback, + struct z_queryable_options_t *options); +/** + * Constructs and declares a subscriber for a given key expression. Dropping subscriber undeclares its callback. + * + * @param session: The zenoh session. + * @param subscriber: An uninitialized location in memory, where subscriber will be constructed. + * @param key_expr: The key expression to subscribe. + * @param callback: The callback function that will be called each time a data matching the subscribed expression is received. + * @param _options: The options to be passed to the subscriber declaration. + * + * @return 0 in case of success, negative error code otherwise (in this case subscriber will be in its gravestone state). + */ +ZENOHC_API +z_result_t z_declare_subscriber(const struct z_loaned_session_t *session, + struct z_owned_subscriber_t *subscriber, + const struct z_loaned_keyexpr_t *key_expr, + struct z_moved_closure_sample_t *callback, + struct z_subscriber_options_t *_options); /** * Sends request to delete data on specified key expression (used when working with Zenoh storages ). * @@ -2146,7 +2443,7 @@ const struct z_loaned_encoding_t *z_encoding_zenoh_string(void); */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -uint32_t z_entity_global_id_eid(const struct z_entity_global_id_t *this_); +uint32_t z_entity_global_id_eid(const z_entity_global_id_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -2154,7 +2451,7 @@ uint32_t z_entity_global_id_eid(const struct z_entity_global_id_t *this_); */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -struct z_id_t z_entity_global_id_zid(const struct z_entity_global_id_t *this_); +z_id_t z_entity_global_id_zid(const z_entity_global_id_t *this_); #endif /** * Constructs send and recieve ends of the fifo channel @@ -2306,7 +2603,7 @@ ZENOHC_API enum z_whatami_t z_hello_whatami(const struct z_loaned_hello_t *this_ */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -struct z_id_t z_hello_zid(const struct z_loaned_hello_t *this_); +z_id_t z_hello_zid(const struct z_loaned_hello_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -2314,7 +2611,7 @@ struct z_id_t z_hello_zid(const struct z_loaned_hello_t *this_); */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -void z_id_to_string(const struct z_id_t *zid, +void z_id_to_string(const z_id_t *zid, struct z_owned_string_t *dst); #endif /** @@ -2355,19 +2652,19 @@ z_result_t z_info_routers_zid(const struct z_loaned_session_t *session, */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -struct z_id_t z_info_zid(const struct z_loaned_session_t *session); +z_id_t z_info_zid(const struct z_loaned_session_t *session); #endif /** * Returns ``true`` if `this` is valid. */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) -ZENOHC_API bool z_internal_alloc_layout_check(const struct z_owned_alloc_layout_t *this_); +ZENOHC_API bool z_internal_alloc_layout_check(const z_owned_alloc_layout_t *this_); #endif /** * Constructs Alloc Layout in its gravestone value. */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) -ZENOHC_API void z_internal_alloc_layout_null(struct z_owned_alloc_layout_t *this_); +ZENOHC_API void z_internal_alloc_layout_null(z_owned_alloc_layout_t *this_); #endif /** * Returns ``true`` if `this_` is in a valid state, ``false`` if it is in a gravestone state. @@ -2391,7 +2688,7 @@ ZENOHC_API void z_internal_bytes_writer_null(struct z_owned_bytes_writer_t *this */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -bool z_internal_chunk_alloc_result_check(const struct z_owned_chunk_alloc_result_t *this_); +bool z_internal_chunk_alloc_result_check(const z_owned_chunk_alloc_result_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -2399,7 +2696,7 @@ bool z_internal_chunk_alloc_result_check(const struct z_owned_chunk_alloc_result */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_internal_chunk_alloc_result_null(struct z_owned_chunk_alloc_result_t *this_); +void z_internal_chunk_alloc_result_null(z_owned_chunk_alloc_result_t *this_); #endif /** * Returns ``true`` if closure is valid, ``false`` if it is in gravestone state. @@ -2522,7 +2819,7 @@ ZENOHC_API void z_internal_keyexpr_null(struct z_owned_keyexpr_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -bool z_internal_memory_layout_check(const struct z_owned_memory_layout_t *this_); +bool z_internal_memory_layout_check(const z_owned_memory_layout_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -2530,7 +2827,7 @@ bool z_internal_memory_layout_check(const struct z_owned_memory_layout_t *this_) */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_internal_memory_layout_null(struct z_owned_memory_layout_t *this_); +void z_internal_memory_layout_null(z_owned_memory_layout_t *this_); #endif /** * Returns ``true`` if mutex is valid, ``false`` otherwise. @@ -2629,7 +2926,7 @@ ZENOHC_API void z_internal_session_null(struct z_owned_session_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -bool z_internal_shm_check(const struct z_owned_shm_t *this_); +bool z_internal_shm_check(const z_owned_shm_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -2637,7 +2934,7 @@ bool z_internal_shm_check(const struct z_owned_shm_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -bool z_internal_shm_client_check(const struct z_owned_shm_client_t *this_); +bool z_internal_shm_client_check(const z_owned_shm_client_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -2645,7 +2942,7 @@ bool z_internal_shm_client_check(const struct z_owned_shm_client_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_internal_shm_client_null(struct z_owned_shm_client_t *this_); +void z_internal_shm_client_null(z_owned_shm_client_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -2653,7 +2950,7 @@ void z_internal_shm_client_null(struct z_owned_shm_client_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -bool z_internal_shm_client_storage_check(const struct z_owned_shm_client_storage_t *this_); +bool z_internal_shm_client_storage_check(const z_owned_shm_client_storage_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -2661,7 +2958,7 @@ bool z_internal_shm_client_storage_check(const struct z_owned_shm_client_storage */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_internal_shm_client_storage_null(struct z_owned_shm_client_storage_t *this_); +void z_internal_shm_client_storage_null(z_owned_shm_client_storage_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -2669,7 +2966,7 @@ void z_internal_shm_client_storage_null(struct z_owned_shm_client_storage_t *thi */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -bool z_internal_shm_mut_check(const struct z_owned_shm_mut_t *this_); +bool z_internal_shm_mut_check(const z_owned_shm_mut_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -2677,7 +2974,7 @@ bool z_internal_shm_mut_check(const struct z_owned_shm_mut_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_internal_shm_mut_null(struct z_owned_shm_mut_t *this_); +void z_internal_shm_mut_null(z_owned_shm_mut_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -2685,7 +2982,7 @@ void z_internal_shm_mut_null(struct z_owned_shm_mut_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_internal_shm_null(struct z_owned_shm_t *this_); +void z_internal_shm_null(z_owned_shm_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -2693,7 +2990,7 @@ void z_internal_shm_null(struct z_owned_shm_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -bool z_internal_shm_provider_check(const struct z_owned_shm_provider_t *this_); +bool z_internal_shm_provider_check(const z_owned_shm_provider_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -2701,7 +2998,7 @@ bool z_internal_shm_provider_check(const struct z_owned_shm_provider_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_internal_shm_provider_null(struct z_owned_shm_provider_t *this_); +void z_internal_shm_provider_null(z_owned_shm_provider_t *this_); #endif /** * @return ``true`` if slice is not empty, ``false`` otherwise. @@ -2717,7 +3014,7 @@ ZENOHC_API void z_internal_slice_null(struct z_owned_slice_t *this_); */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -bool z_internal_source_info_check(const struct z_owned_source_info_t *this_); +bool z_internal_source_info_check(const z_owned_source_info_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -2725,7 +3022,7 @@ bool z_internal_source_info_check(const struct z_owned_source_info_t *this_); */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -void z_internal_source_info_null(struct z_owned_source_info_t *this_); +void z_internal_source_info_null(z_owned_source_info_t *this_); #endif /** * @return ``true`` if the string array is valid, ``false`` if it is in a gravestone state. @@ -2902,7 +3199,7 @@ enum z_keyexpr_intersection_level_t z_keyexpr_relation_to(const struct z_loaned_ */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_memory_layout_drop(struct z_moved_memory_layout_t *this_); +void z_memory_layout_drop(z_moved_memory_layout_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -2910,7 +3207,7 @@ void z_memory_layout_drop(struct z_moved_memory_layout_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_memory_layout_get_data(const struct z_loaned_memory_layout_t *this_, +void z_memory_layout_get_data(const z_loaned_memory_layout_t *this_, size_t *out_size, struct z_alloc_alignment_t *out_alignment); #endif @@ -2920,7 +3217,7 @@ void z_memory_layout_get_data(const struct z_loaned_memory_layout_t *this_, */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -const struct z_loaned_memory_layout_t *z_memory_layout_loan(const struct z_owned_memory_layout_t *this_); +const z_loaned_memory_layout_t *z_memory_layout_loan(const z_owned_memory_layout_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -2928,7 +3225,7 @@ const struct z_loaned_memory_layout_t *z_memory_layout_loan(const struct z_owned */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -z_result_t z_memory_layout_new(struct z_owned_memory_layout_t *this_, +z_result_t z_memory_layout_new(z_owned_memory_layout_t *this_, size_t size, struct z_alloc_alignment_t alignment); #endif @@ -2984,7 +3281,7 @@ ZENOHC_API void z_open_options_default(struct z_open_options_t *this_); ZENOHC_API z_result_t z_open_with_custom_shm_clients(struct z_owned_session_t *this_, struct z_moved_config_t *config, - const struct z_loaned_shm_client_storage_t *shm_clients); + const z_loaned_shm_client_storage_t *shm_clients); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -2992,7 +3289,7 @@ z_result_t z_open_with_custom_shm_clients(struct z_owned_session_t *this_, */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_posix_shm_client_new(struct z_owned_shm_client_t *this_); +void z_posix_shm_client_new(z_owned_shm_client_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3000,31 +3297,13 @@ void z_posix_shm_client_new(struct z_owned_shm_client_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -z_result_t z_posix_shm_provider_new(struct z_owned_shm_provider_t *this_, - const struct z_loaned_memory_layout_t *layout); +z_result_t z_posix_shm_provider_new(z_owned_shm_provider_t *this_, + const z_loaned_memory_layout_t *layout); #endif /** * Returns the default value of #z_priority_t. */ ZENOHC_API enum z_priority_t z_priority_default(void); -/** - * Constructs and declares a publisher for the given key expression. - * - * Data can be put and deleted with this publisher with the help of the - * `z_publisher_put()` and `z_publisher_delete()` functions. - * - * @param this_: An unitilized location in memory where publisher will be constructed. - * @param session: The Zenoh session. - * @param key_expr: The key expression to publish. - * @param options: Additional options for the publisher. - * - * @return 0 in case of success, negative error code otherwise. - */ -ZENOHC_API -z_result_t z_publisher_declare(struct z_owned_publisher_t *this_, - const struct z_loaned_session_t *session, - const struct z_loaned_keyexpr_t *key_expr, - struct z_publisher_options_t *options); /** * Sends a `DELETE` message onto the publisher's key expression. * @@ -3039,6 +3318,7 @@ z_result_t z_publisher_delete(const struct z_loaned_publisher_t *publisher, ZENOHC_API void z_publisher_delete_options_default(struct z_publisher_delete_options_t *this_); /** * Frees memory and resets publisher to its gravestone state. + * This is equivalent to calling `z_undeclare_publisher()` and discarding its return value. */ ZENOHC_API void z_publisher_drop(struct z_moved_publisher_t *this_); /** @@ -3047,7 +3327,7 @@ ZENOHC_API void z_publisher_drop(struct z_moved_publisher_t *this_); */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -struct z_entity_global_id_t z_publisher_id(const struct z_loaned_publisher_t *publisher); +z_entity_global_id_t z_publisher_id(const struct z_loaned_publisher_t *publisher); #endif /** * Returns the key expression of the publisher. @@ -3257,41 +3537,9 @@ ZENOHC_API void z_query_reply_options_default(struct z_query_reply_options_t *th * Create a default `z_query_target_t`. */ ZENOHC_API enum z_query_target_t z_query_target_default(void); -/** - * Constructs a Queryable for the given key expression. - * - * @param this_: An uninitialized memory location where queryable will be constructed. - * @param session: The zenoh session. - * @param key_expr: The key expression the Queryable will reply to. - * @param callback: The callback function that will be called each time a matching query is received. Its ownership is passed to queryable. - * @param options: Options for the queryable. - * - * @return 0 in case of success, negative error code otherwise (in this case ) - */ -ZENOHC_API -z_result_t z_queryable_declare(struct z_owned_queryable_t *this_, - const struct z_loaned_session_t *session, - const struct z_loaned_keyexpr_t *key_expr, - struct z_moved_closure_query_t *callback, - struct z_queryable_options_t *options); -/** - * Declares a background queryable for a given keyexpr. The queryable callback will be be called - * to proccess incoming queries until the corresponding session is closed or dropped. - * - * @param session: The zenoh session. - * @param key_expr: The key expression the Queryable will reply to. - * @param callback: The callback function that will be called each time a matching query is received. Its ownership is passed to queryable. - * @param options: Options for the queryable. - * - * @return 0 in case of success, negative error code otherwise (in this case ) - */ -ZENOHC_API -z_result_t z_queryable_declare_background(const struct z_loaned_session_t *session, - const struct z_loaned_keyexpr_t *key_expr, - struct z_moved_closure_query_t *callback, - struct z_queryable_options_t *options); /** * Undeclares queryable callback and resets it to its gravestone state. + * This is equivalent to calling `z_undeclare_queryable()` and discarding its return value. */ ZENOHC_API void z_queryable_drop(struct z_moved_queryable_t *this_); /** @@ -3300,7 +3548,7 @@ ZENOHC_API void z_queryable_drop(struct z_moved_queryable_t *this_); */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -struct z_entity_global_id_t z_queryable_id(const struct z_loaned_queryable_t *queryable); +z_entity_global_id_t z_queryable_id(const struct z_loaned_queryable_t *queryable); #endif ZENOHC_API const struct z_loaned_queryable_t *z_queryable_loan(const struct z_owned_queryable_t *this_); @@ -3333,7 +3581,7 @@ ZENOHC_API uint8_t z_random_u8(void); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_ref_shm_client_storage_global(struct z_owned_shm_client_storage_t *this_); +void z_ref_shm_client_storage_global(z_owned_shm_client_storage_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3405,7 +3653,7 @@ ZENOHC_API const struct z_loaned_sample_t *z_reply_ok(const struct z_loaned_repl #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API bool z_reply_replier_id(const struct z_loaned_reply_t *this_, - struct z_id_t *out_id); + z_id_t *out_id); #endif /** * Constructs send and recieve ends of the ring channel @@ -3568,7 +3816,7 @@ enum z_reliability_t z_sample_reliability(const struct z_loaned_sample_t *this_) */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -const struct z_loaned_source_info_t *z_sample_source_info(const struct z_loaned_sample_t *this_); +const z_loaned_source_info_t *z_sample_source_info(const struct z_loaned_sample_t *this_); #endif /** * Returns the sample timestamp. @@ -3614,7 +3862,7 @@ ZENOHC_API struct z_loaned_session_t *z_session_loan_mut(struct z_owned_session_ */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_shm_client_drop(struct z_moved_shm_client_t *this_); +void z_shm_client_drop(z_moved_shm_client_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3622,7 +3870,7 @@ void z_shm_client_drop(struct z_moved_shm_client_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_shm_client_new(struct z_owned_shm_client_t *this_, +void z_shm_client_new(z_owned_shm_client_t *this_, struct zc_threadsafe_context_t context, struct zc_shm_client_callbacks_t callbacks); #endif @@ -3632,8 +3880,8 @@ void z_shm_client_new(struct z_owned_shm_client_t *this_, */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_shm_client_storage_clone(struct z_owned_shm_client_storage_t *this_, - const struct z_loaned_shm_client_storage_t *from); +void z_shm_client_storage_clone(z_owned_shm_client_storage_t *this_, + const z_loaned_shm_client_storage_t *from); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3641,7 +3889,7 @@ void z_shm_client_storage_clone(struct z_owned_shm_client_storage_t *this_, */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_shm_client_storage_drop(struct z_moved_shm_client_storage_t *this_); +void z_shm_client_storage_drop(z_moved_shm_client_storage_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3649,15 +3897,15 @@ void z_shm_client_storage_drop(struct z_moved_shm_client_storage_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -const struct z_loaned_shm_client_storage_t *z_shm_client_storage_loan(const struct z_owned_shm_client_storage_t *this_); +const z_loaned_shm_client_storage_t *z_shm_client_storage_loan(const z_owned_shm_client_storage_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -z_result_t z_shm_client_storage_new(struct z_owned_shm_client_storage_t *this_, - const struct zc_loaned_shm_client_list_t *clients, +z_result_t z_shm_client_storage_new(z_owned_shm_client_storage_t *this_, + const zc_loaned_shm_client_list_t *clients, bool add_default_client_set); #endif /** @@ -3665,7 +3913,7 @@ z_result_t z_shm_client_storage_new(struct z_owned_shm_client_storage_t *this_, */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_shm_client_storage_new_default(struct z_owned_shm_client_storage_t *this_); +void z_shm_client_storage_new_default(z_owned_shm_client_storage_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3673,8 +3921,8 @@ void z_shm_client_storage_new_default(struct z_owned_shm_client_storage_t *this_ */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_shm_clone(struct z_owned_shm_t *out, - const struct z_loaned_shm_t *this_); +void z_shm_clone(z_owned_shm_t *out, + const z_loaned_shm_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3682,7 +3930,7 @@ void z_shm_clone(struct z_owned_shm_t *out, */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -const unsigned char *z_shm_data(const struct z_loaned_shm_t *this_); +const unsigned char *z_shm_data(const z_loaned_shm_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3690,7 +3938,7 @@ const unsigned char *z_shm_data(const struct z_loaned_shm_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_shm_drop(struct z_moved_shm_t *this_); +void z_shm_drop(z_moved_shm_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3698,8 +3946,8 @@ void z_shm_drop(struct z_moved_shm_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_shm_from_mut(struct z_owned_shm_t *this_, - struct z_moved_shm_mut_t *that); +void z_shm_from_mut(z_owned_shm_t *this_, + z_moved_shm_mut_t *that); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3707,7 +3955,7 @@ void z_shm_from_mut(struct z_owned_shm_t *this_, */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -size_t z_shm_len(const struct z_loaned_shm_t *this_); +size_t z_shm_len(const z_loaned_shm_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3715,13 +3963,13 @@ size_t z_shm_len(const struct z_loaned_shm_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -const struct z_loaned_shm_t *z_shm_loan(const struct z_owned_shm_t *this_); +const z_loaned_shm_t *z_shm_loan(const z_owned_shm_t *this_); #endif /** * @brief Mutably borrows ZShm slice. */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) -ZENOHC_API struct z_loaned_shm_t *z_shm_loan_mut(struct z_owned_shm_t *this_); +ZENOHC_API z_loaned_shm_t *z_shm_loan_mut(z_owned_shm_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3729,7 +3977,7 @@ ZENOHC_API struct z_loaned_shm_t *z_shm_loan_mut(struct z_owned_shm_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -const unsigned char *z_shm_mut_data(const struct z_loaned_shm_mut_t *this_); +const unsigned char *z_shm_mut_data(const z_loaned_shm_mut_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3737,7 +3985,7 @@ const unsigned char *z_shm_mut_data(const struct z_loaned_shm_mut_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -unsigned char *z_shm_mut_data_mut(struct z_loaned_shm_mut_t *this_); +unsigned char *z_shm_mut_data_mut(z_loaned_shm_mut_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3745,7 +3993,7 @@ unsigned char *z_shm_mut_data_mut(struct z_loaned_shm_mut_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_shm_mut_drop(struct z_moved_shm_mut_t *this_); +void z_shm_mut_drop(z_moved_shm_mut_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3753,7 +4001,7 @@ void z_shm_mut_drop(struct z_moved_shm_mut_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -size_t z_shm_mut_len(const struct z_loaned_shm_mut_t *this_); +size_t z_shm_mut_len(const z_loaned_shm_mut_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3761,7 +4009,7 @@ size_t z_shm_mut_len(const struct z_loaned_shm_mut_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -const struct z_loaned_shm_mut_t *z_shm_mut_loan(const struct z_owned_shm_mut_t *this_); +const z_loaned_shm_mut_t *z_shm_mut_loan(const z_owned_shm_mut_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3769,7 +4017,7 @@ const struct z_loaned_shm_mut_t *z_shm_mut_loan(const struct z_owned_shm_mut_t * */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -struct z_loaned_shm_mut_t *z_shm_mut_loan_mut(struct z_owned_shm_mut_t *this_); +z_loaned_shm_mut_t *z_shm_mut_loan_mut(z_owned_shm_mut_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3783,9 +4031,9 @@ struct z_loaned_shm_mut_t *z_shm_mut_loan_mut(struct z_owned_shm_mut_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -z_result_t z_shm_mut_try_from_immut(struct z_owned_shm_mut_t *this_, - struct z_moved_shm_t *that, - struct z_owned_shm_t *immut); +z_result_t z_shm_mut_try_from_immut(z_owned_shm_mut_t *this_, + z_moved_shm_t *that, + z_owned_shm_t *immut); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3793,7 +4041,7 @@ z_result_t z_shm_mut_try_from_immut(struct z_owned_shm_mut_t *this_, #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API void z_shm_provider_alloc(struct z_buf_layout_alloc_result_t *out_result, - const struct z_loaned_shm_provider_t *provider, + const z_loaned_shm_provider_t *provider, size_t size, struct z_alloc_alignment_t alignment); #endif @@ -3803,7 +4051,7 @@ void z_shm_provider_alloc(struct z_buf_layout_alloc_result_t *out_result, #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API void z_shm_provider_alloc_gc(struct z_buf_layout_alloc_result_t *out_result, - const struct z_loaned_shm_provider_t *provider, + const z_loaned_shm_provider_t *provider, size_t size, struct z_alloc_alignment_t alignment); #endif @@ -3813,7 +4061,7 @@ void z_shm_provider_alloc_gc(struct z_buf_layout_alloc_result_t *out_result, #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API void z_shm_provider_alloc_gc_defrag(struct z_buf_layout_alloc_result_t *out_result, - const struct z_loaned_shm_provider_t *provider, + const z_loaned_shm_provider_t *provider, size_t size, struct z_alloc_alignment_t alignment); #endif @@ -3823,7 +4071,7 @@ void z_shm_provider_alloc_gc_defrag(struct z_buf_layout_alloc_result_t *out_resu #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API z_result_t z_shm_provider_alloc_gc_defrag_async(struct z_buf_layout_alloc_result_t *out_result, - const struct z_loaned_shm_provider_t *provider, + const z_loaned_shm_provider_t *provider, size_t size, struct z_alloc_alignment_t alignment, struct zc_threadsafe_context_t result_context, @@ -3836,7 +4084,7 @@ z_result_t z_shm_provider_alloc_gc_defrag_async(struct z_buf_layout_alloc_result #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API void z_shm_provider_alloc_gc_defrag_blocking(struct z_buf_layout_alloc_result_t *out_result, - const struct z_loaned_shm_provider_t *provider, + const z_loaned_shm_provider_t *provider, size_t size, struct z_alloc_alignment_t alignment); #endif @@ -3846,7 +4094,7 @@ void z_shm_provider_alloc_gc_defrag_blocking(struct z_buf_layout_alloc_result_t #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API void z_shm_provider_alloc_gc_defrag_dealloc(struct z_buf_layout_alloc_result_t *out_result, - const struct z_loaned_shm_provider_t *provider, + const z_loaned_shm_provider_t *provider, size_t size, struct z_alloc_alignment_t alignment); #endif @@ -3855,14 +4103,14 @@ void z_shm_provider_alloc_gc_defrag_dealloc(struct z_buf_layout_alloc_result_t * */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -size_t z_shm_provider_available(const struct z_loaned_shm_provider_t *provider); +size_t z_shm_provider_available(const z_loaned_shm_provider_t *provider); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -size_t z_shm_provider_defragment(const struct z_loaned_shm_provider_t *provider); +size_t z_shm_provider_defragment(const z_loaned_shm_provider_t *provider); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3870,14 +4118,14 @@ size_t z_shm_provider_defragment(const struct z_loaned_shm_provider_t *provider) */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_shm_provider_drop(struct z_moved_shm_provider_t *this_); +void z_shm_provider_drop(z_moved_shm_provider_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -size_t z_shm_provider_garbage_collect(const struct z_loaned_shm_provider_t *provider); +size_t z_shm_provider_garbage_collect(const z_loaned_shm_provider_t *provider); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3885,15 +4133,15 @@ size_t z_shm_provider_garbage_collect(const struct z_loaned_shm_provider_t *prov */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -const struct z_loaned_shm_provider_t *z_shm_provider_loan(const struct z_owned_shm_provider_t *this_); +const z_loaned_shm_provider_t *z_shm_provider_loan(const z_owned_shm_provider_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -z_result_t z_shm_provider_map(struct z_owned_shm_mut_t *out_result, - const struct z_loaned_shm_provider_t *provider, +z_result_t z_shm_provider_map(z_owned_shm_mut_t *out_result, + const z_loaned_shm_provider_t *provider, struct z_allocated_chunk_t allocated_chunk, size_t len); #endif @@ -3903,7 +4151,7 @@ z_result_t z_shm_provider_map(struct z_owned_shm_mut_t *out_result, */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_shm_provider_new(struct z_owned_shm_provider_t *this_, +void z_shm_provider_new(z_owned_shm_provider_t *this_, z_protocol_id_t id, struct zc_context_t context, struct zc_shm_provider_backend_callbacks_t callbacks); @@ -3914,7 +4162,7 @@ void z_shm_provider_new(struct z_owned_shm_provider_t *this_, */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void z_shm_provider_threadsafe_new(struct z_owned_shm_provider_t *this_, +void z_shm_provider_threadsafe_new(z_owned_shm_provider_t *this_, z_protocol_id_t id, struct zc_threadsafe_context_t context, struct zc_shm_provider_backend_callbacks_t callbacks); @@ -3925,7 +4173,7 @@ void z_shm_provider_threadsafe_new(struct z_owned_shm_provider_t *this_, */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -struct z_loaned_shm_mut_t *z_shm_try_mut(struct z_owned_shm_t *this_); +z_loaned_shm_mut_t *z_shm_try_mut(z_owned_shm_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3933,7 +4181,7 @@ struct z_loaned_shm_mut_t *z_shm_try_mut(struct z_owned_shm_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -struct z_loaned_shm_mut_t *z_shm_try_reloan_mut(struct z_loaned_shm_t *this_); +z_loaned_shm_mut_t *z_shm_try_reloan_mut(z_loaned_shm_t *this_); #endif /** * Puts current thread to sleep for specified amount of milliseconds. @@ -4006,7 +4254,7 @@ ZENOHC_API const struct z_loaned_slice_t *z_slice_loan(const struct z_owned_slic */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -void z_source_info_drop(struct z_moved_source_info_t *this_); +void z_source_info_drop(z_moved_source_info_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -4014,7 +4262,7 @@ void z_source_info_drop(struct z_moved_source_info_t *this_); */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -struct z_entity_global_id_t z_source_info_id(const struct z_loaned_source_info_t *this_); +z_entity_global_id_t z_source_info_id(const z_loaned_source_info_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -4022,7 +4270,7 @@ struct z_entity_global_id_t z_source_info_id(const struct z_loaned_source_info_t */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -const struct z_loaned_source_info_t *z_source_info_loan(const struct z_owned_source_info_t *this_); +const z_loaned_source_info_t *z_source_info_loan(const z_owned_source_info_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -4030,8 +4278,8 @@ const struct z_loaned_source_info_t *z_source_info_loan(const struct z_owned_sou */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -z_result_t z_source_info_new(struct z_owned_source_info_t *this_, - const struct z_entity_global_id_t *source_id, +z_result_t z_source_info_new(z_owned_source_info_t *this_, + const z_entity_global_id_t *source_id, uint32_t source_sn); #endif /** @@ -4040,7 +4288,7 @@ z_result_t z_source_info_new(struct z_owned_source_info_t *this_, */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -uint32_t z_source_info_sn(const struct z_loaned_source_info_t *this_); +uint32_t z_source_info_sn(const z_loaned_source_info_t *this_); #endif /** * Constructs an owned copy of a string array. @@ -4150,48 +4398,16 @@ z_result_t z_string_from_str(struct z_owned_string_t *this_, */ ZENOHC_API bool z_string_is_empty(const struct z_loaned_string_t *this_); /** - * @return the length of the string (without terminating 0 character). - */ -ZENOHC_API size_t z_string_len(const struct z_loaned_string_t *this_); -/** - * Borrows string. - */ -ZENOHC_API const struct z_loaned_string_t *z_string_loan(const struct z_owned_string_t *this_); -/** - * Constructs and declares a subscriber for a given key expression. Dropping subscriber undeclares its callback. - * - * @param this_: An uninitialized location in memory, where subscriber will be constructed. - * @param session: The zenoh session. - * @param key_expr: The key expression to subscribe. - * @param callback: The callback function that will be called each time a data matching the subscribed expression is received. - * @param _options: The options to be passed to the subscriber declaration. - * - * @return 0 in case of success, negative error code otherwise (in this case subscriber will be in its gravestone state). - */ -ZENOHC_API -z_result_t z_subscriber_declare(struct z_owned_subscriber_t *this_, - const struct z_loaned_session_t *session, - const struct z_loaned_keyexpr_t *key_expr, - struct z_moved_closure_sample_t *callback, - struct z_subscriber_options_t *_options); -/** - * Constructs and declares a background subscriber. Subscriber callback will be called to process the messages, - * until the corresponding session is closed or dropped. - * - * @param session: The zenoh session. - * @param key_expr: The key expression to subscribe. - * @param callback: The callback function that will be called each time a data matching the subscribed expression is received. - * @param _options: The options to be passed to the subscriber declaration. - * - * @return 0 in case of success, negative error code otherwise. + * @return the length of the string (without terminating 0 character). */ -ZENOHC_API -z_result_t z_subscriber_declare_background(const struct z_loaned_session_t *session, - const struct z_loaned_keyexpr_t *key_expr, - struct z_moved_closure_sample_t *callback, - struct z_subscriber_options_t *_options); +ZENOHC_API size_t z_string_len(const struct z_loaned_string_t *this_); +/** + * Borrows string. + */ +ZENOHC_API const struct z_loaned_string_t *z_string_loan(const struct z_owned_string_t *this_); /** * Undeclares subscriber callback and resets it to its gravestone state. + * This is equivalent to calling `z_undeclare_subscriber()` and discarding its return value. */ ZENOHC_API void z_subscriber_drop(struct z_moved_subscriber_t *this_); /** @@ -4265,7 +4481,7 @@ const char *z_time_now_as_str(const char *buf, */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -struct z_id_t z_timestamp_id(const struct z_timestamp_t *this_); +z_id_t z_timestamp_id(const struct z_timestamp_t *this_); #endif /** * Create uhlc timestamp from session id. @@ -4283,8 +4499,25 @@ ZENOHC_API uint64_t z_timestamp_ntp64_time(const struct z_timestamp_t *this_); * @return 0 in case of success, negative error code otherwise. */ ZENOHC_API -z_result_t z_undeclare_keyexpr(struct z_moved_keyexpr_t *this_, - const struct z_loaned_session_t *session); +z_result_t z_undeclare_keyexpr(const struct z_loaned_session_t *session, + struct z_moved_keyexpr_t *key_expr); +/** + * @brief Undeclares the given publisher. + * + * @return 0 in case of success, negative error code otherwise. + */ +ZENOHC_API z_result_t z_undeclare_publisher(struct z_moved_publisher_t *this_); +/** + * Undeclares a `z_owned_queryable_t`. + * Returns 0 in case of success, negative error code otherwise. + */ +ZENOHC_API z_result_t z_undeclare_queryable(struct z_moved_queryable_t *this_); +/** + * Undeclares the subscriber. + * + * @return 0 in case of success, negative error code otherwise. + */ +ZENOHC_API z_result_t z_undeclare_subscriber(struct z_moved_subscriber_t *this_); /** * Constructs a view key expression in empty state */ @@ -4639,7 +4872,7 @@ void zc_internal_closure_matching_status_null(struct zc_owned_closure_matching_s */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -bool zc_internal_liveliness_token_check(const struct zc_owned_liveliness_token_t *this_); +bool zc_internal_liveliness_token_check(const zc_owned_liveliness_token_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -4647,7 +4880,7 @@ bool zc_internal_liveliness_token_check(const struct zc_owned_liveliness_token_t */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -void zc_internal_liveliness_token_null(struct zc_owned_liveliness_token_t *this_); +void zc_internal_liveliness_token_null(zc_owned_liveliness_token_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -4655,7 +4888,7 @@ void zc_internal_liveliness_token_null(struct zc_owned_liveliness_token_t *this_ */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -bool zc_internal_matching_listener_check(const struct zc_owned_matching_listener_t *this_); +bool zc_internal_matching_listener_check(const zc_owned_matching_listener_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -4663,7 +4896,7 @@ bool zc_internal_matching_listener_check(const struct zc_owned_matching_listener */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -void zc_internal_matching_listener_null(struct zc_owned_matching_listener_t *this_); +void zc_internal_matching_listener_null(zc_owned_matching_listener_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -4671,7 +4904,7 @@ void zc_internal_matching_listener_null(struct zc_owned_matching_listener_t *thi */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -bool zc_internal_shm_client_list_check(const struct zc_owned_shm_client_list_t *this_); +bool zc_internal_shm_client_list_check(const zc_owned_shm_client_list_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -4679,7 +4912,7 @@ bool zc_internal_shm_client_list_check(const struct zc_owned_shm_client_list_t * */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void zc_internal_shm_client_list_null(struct zc_owned_shm_client_list_t *this_); +void zc_internal_shm_client_list_null(zc_owned_shm_client_list_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -4689,6 +4922,44 @@ void zc_internal_shm_client_list_null(struct zc_owned_shm_client_list_t *this_); ZENOHC_API void zc_liveliness_declaration_options_default(struct zc_liveliness_declaration_options_t *this_); #endif +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Declares a background subscriber on liveliness tokens that intersect `key_expr`. Subscriber callback will be called to process the messages, + * until the corresponding session is closed or dropped. + * @param session: The Zenoh session. + * @param key_expr: The key expression to subscribe to. + * @param callback: The callback function that will be called each time a liveliness token status is changed. + * @param options: The options to be passed to the liveliness subscriber declaration. + * + * @return 0 in case of success, negative error values otherwise. + */ +#if defined(Z_FEATURE_UNSTABLE_API) +ZENOHC_API +z_result_t zc_liveliness_declare_background_subscriber(const struct z_loaned_session_t *session, + const struct z_loaned_keyexpr_t *key_expr, + struct z_moved_closure_sample_t *callback, + struct zc_liveliness_subscriber_options_t *options); +#endif +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Declares a subscriber on liveliness tokens that intersect `key_expr`. + * + * @param session: A Zenoh session. + * @param subscriber: An uninitialized memory location where subscriber will be constructed. + * @param key_expr: The key expression to subscribe to. + * @param callback: The callback function that will be called each time a liveliness token status is changed. + * @param options: The options to be passed to the liveliness subscriber declaration. + * + * @return 0 in case of success, negative error values otherwise. + */ +#if defined(Z_FEATURE_UNSTABLE_API) +ZENOHC_API +z_result_t zc_liveliness_declare_subscriber(const struct z_loaned_session_t *session, + struct z_owned_subscriber_t *subscriber, + const struct z_loaned_keyexpr_t *key_expr, + struct z_moved_closure_sample_t *callback, + struct zc_liveliness_subscriber_options_t *options); +#endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. * @brief Constructs and declares a liveliness token on the network. @@ -4696,15 +4967,15 @@ void zc_liveliness_declaration_options_default(struct zc_liveliness_declaration_ * Liveliness token subscribers on an intersecting key expression will receive a PUT sample when connectivity * is achieved, and a DELETE sample if it's lost. * - * @param this_: An uninitialized memory location where liveliness token will be constructed. * @param session: A Zenos session to declare the liveliness token. + * @param token: An uninitialized memory location where liveliness token will be constructed. * @param key_expr: A keyexpr to declare a liveliess token for. * @param _options: Liveliness token declaration properties. */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -z_result_t zc_liveliness_declare_token(struct zc_owned_liveliness_token_t *this_, - const struct z_loaned_session_t *session, +z_result_t zc_liveliness_declare_token(const struct z_loaned_session_t *session, + zc_owned_liveliness_token_t *token, const struct z_loaned_keyexpr_t *key_expr, const struct zc_liveliness_declaration_options_t *_options); #endif @@ -4734,45 +5005,7 @@ void zc_liveliness_get_options_default(struct zc_liveliness_get_options_t *this_ #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * @brief Declares a subscriber on liveliness tokens that intersect `key_expr`. - * - * @param this_: An uninitialized memory location where subscriber will be constructed. - * @param session: The Zenoh session. - * @param key_expr: The key expression to subscribe to. - * @param callback: The callback function that will be called each time a liveliness token status is changed. - * @param options: The options to be passed to the liveliness subscriber declaration. - * - * @return 0 in case of success, negative error values otherwise. - */ -#if defined(Z_FEATURE_UNSTABLE_API) -ZENOHC_API -z_result_t zc_liveliness_subscriber_declare(struct z_owned_subscriber_t *this_, - const struct z_loaned_session_t *session, - const struct z_loaned_keyexpr_t *key_expr, - struct z_moved_closure_sample_t *callback, - struct zc_liveliness_subscriber_options_t *options); -#endif -/** - * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * @brief Declares a background subscriber on liveliness tokens that intersect `key_expr`. Subscriber callback will be called to process the messages, - * until the corresponding session is closed or dropped. - * @param session: The Zenoh session. - * @param key_expr: The key expression to subscribe to. - * @param callback: The callback function that will be called each time a liveliness token status is changed. - * @param options: The options to be passed to the liveliness subscriber declaration. - * - * @return 0 in case of success, negative error values otherwise. - */ -#if defined(Z_FEATURE_UNSTABLE_API) -ZENOHC_API -z_result_t zc_liveliness_subscriber_declare_background(const struct z_loaned_session_t *session, - const struct z_loaned_keyexpr_t *key_expr, - struct z_moved_closure_sample_t *callback, - struct zc_liveliness_subscriber_options_t *options); -#endif -/** - * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * @brief Constucts default value for `zc_liveliness_subscriber_declare_options_t`. + * @brief Constucts default value for `zc_liveliness_declare_subscriber_options_t`. */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API @@ -4784,7 +5017,7 @@ void zc_liveliness_subscriber_options_default(struct zc_liveliness_subscriber_op */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -void zc_liveliness_token_drop(struct zc_moved_liveliness_token_t *this_); +void zc_liveliness_token_drop(zc_moved_liveliness_token_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -4792,7 +5025,7 @@ void zc_liveliness_token_drop(struct zc_moved_liveliness_token_t *this_); */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -const struct zc_loaned_liveliness_token_t *zc_liveliness_token_loan(const struct zc_owned_liveliness_token_t *this_); +const zc_loaned_liveliness_token_t *zc_liveliness_token_loan(const zc_owned_liveliness_token_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -4800,7 +5033,7 @@ const struct zc_loaned_liveliness_token_t *zc_liveliness_token_loan(const struct */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -z_result_t zc_liveliness_undeclare_token(struct zc_moved_liveliness_token_t *this_); +z_result_t zc_liveliness_undeclare_token(zc_moved_liveliness_token_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -4812,45 +5045,45 @@ enum zc_locality_t zc_locality_default(void); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * @brief Gets publisher matching status - i.e. if there are any subscribers matching its key expression. + * @brief Declares a matching listener, registering a callback for notifying subscribers matching with a given publisher. + * The callback will be run in the background until the corresponding publisher is dropped. * - * @return 0 in case of success, negative error code otherwise (in this case matching_status is not updated). + * @param publisher: A publisher to associate with matching listener. + * @param callback: A closure that will be called every time the matching status of the publisher changes (If last subscriber, disconnects or when the first subscriber connects). + * + * @return 0 in case of success, negative error code otherwise. */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -z_result_t zc_publisher_get_matching_status(const struct z_loaned_publisher_t *this_, - struct zc_matching_status_t *matching_status); +z_result_t zc_publisher_declare_background_matching_listener(const struct z_loaned_publisher_t *publisher, + struct zc_moved_closure_matching_status_t *callback); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. * @brief Constructs matching listener, registering a callback for notifying subscribers matching with a given publisher. * - * @param this_: An unitilized memory location where matching listener will be constructed. The matching listener will be automatically dropped when publisher is dropped. * @param publisher: A publisher to associate with matching listener. + * @param matching_listener: An unitilized memory location where matching listener will be constructed. The matching listener will be automatically dropped when publisher is dropped. * @param callback: A closure that will be called every time the matching status of the publisher changes (If last subscriber, disconnects or when the first subscriber connects). * * @return 0 in case of success, negative error code otherwise. */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -z_result_t zc_publisher_matching_listener_declare(struct zc_owned_matching_listener_t *this_, - const struct z_loaned_publisher_t *publisher, +z_result_t zc_publisher_declare_matching_listener(const struct z_loaned_publisher_t *publisher, + zc_owned_matching_listener_t *matching_listener, struct zc_moved_closure_matching_status_t *callback); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * @brief Declares a matching listener, registering a callback for notifying subscribers matching with a given publisher. - * The callback will be run in the background until the corresponding publisher is dropped. - * - * @param publisher: A publisher to associate with matching listener. - * @param callback: A closure that will be called every time the matching status of the publisher changes (If last subscriber, disconnects or when the first subscriber connects). + * @brief Gets publisher matching status - i.e. if there are any subscribers matching its key expression. * - * @return 0 in case of success, negative error code otherwise. + * @return 0 in case of success, negative error code otherwise (in this case matching_status is not updated). */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -z_result_t zc_publisher_matching_listener_declare_background(const struct z_loaned_publisher_t *publisher, - struct zc_moved_closure_matching_status_t *callback); +z_result_t zc_publisher_get_matching_status(const struct z_loaned_publisher_t *this_, + struct zc_matching_status_t *matching_status); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -4858,7 +5091,7 @@ z_result_t zc_publisher_matching_listener_declare_background(const struct z_loan */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -void zc_publisher_matching_listener_drop(struct zc_moved_matching_listener_t *this_); +void zc_publisher_matching_listener_drop(zc_moved_matching_listener_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -4873,9 +5106,9 @@ enum zc_reply_keyexpr_t zc_reply_keyexpr_default(void); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -z_result_t zc_shm_client_list_add_client(struct zc_loaned_shm_client_list_t *this_, +z_result_t zc_shm_client_list_add_client(zc_loaned_shm_client_list_t *this_, z_protocol_id_t id, - struct z_moved_shm_client_t *client); + z_moved_shm_client_t *client); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -4883,7 +5116,7 @@ z_result_t zc_shm_client_list_add_client(struct zc_loaned_shm_client_list_t *thi */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void zc_shm_client_list_drop(struct zc_moved_shm_client_list_t *this_); +void zc_shm_client_list_drop(zc_moved_shm_client_list_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -4891,7 +5124,7 @@ void zc_shm_client_list_drop(struct zc_moved_shm_client_list_t *this_); */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -const struct zc_loaned_shm_client_list_t *zc_shm_client_list_loan(const struct zc_owned_shm_client_list_t *this_); +const zc_loaned_shm_client_list_t *zc_shm_client_list_loan(const zc_owned_shm_client_list_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -4899,7 +5132,7 @@ const struct zc_loaned_shm_client_list_t *zc_shm_client_list_loan(const struct z */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -struct zc_loaned_shm_client_list_t *zc_shm_client_list_loan_mut(struct zc_owned_shm_client_list_t *this_); +zc_loaned_shm_client_list_t *zc_shm_client_list_loan_mut(zc_owned_shm_client_list_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -4907,7 +5140,7 @@ struct zc_loaned_shm_client_list_t *zc_shm_client_list_loan_mut(struct zc_owned_ */ #if (defined(Z_FEATURE_SHARED_MEMORY) && defined(Z_FEATURE_UNSTABLE_API)) ZENOHC_API -void zc_shm_client_list_new(struct zc_owned_shm_client_list_t *this_); +void zc_shm_client_list_new(zc_owned_shm_client_list_t *this_); #endif /** * Stops all Zenoh tasks and drops all related static variables. @@ -4926,6 +5159,79 @@ void zc_stop_z_runtime(void); */ ZENOHC_API void zc_try_init_log_from_env(void); +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Declares a background publication cache. It will function in background until the corresponding session is closed or dropped. + * + * @param session: A Zenoh session. + * @param key_expr: The key expression to publish to. + * @param options: Additional options for the publication cache. + * + * @returns 0 in case of success, negative error code otherwise. + */ +#if defined(Z_FEATURE_UNSTABLE_API) +ZENOHC_API +z_result_t ze_declare_background_publication_cache(const struct z_loaned_session_t *session, + const struct z_loaned_keyexpr_t *key_expr, + struct ze_publication_cache_options_t *options); +#endif +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Declares a background querying subscriber for a given key expression. Subscriber callback will be called to process the messages, + * until the corresponding session is closed or dropped. + * + * @param session: A Zenoh session. + * @param key_expr: A key expression to subscribe to. + * @param callback: The callback function that will be called each time a data matching the subscribed expression is received. + * @param options: Additional options for the querying subscriber. + * + * @return 0 in case of success, negative error code otherwise. + */ +#if defined(Z_FEATURE_UNSTABLE_API) +ZENOHC_API +z_result_t ze_declare_background_querying_subscriber(const struct z_loaned_session_t *session, + const struct z_loaned_keyexpr_t *key_expr, + struct z_moved_closure_sample_t *callback, + struct ze_querying_subscriber_options_t *options); +#endif +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Constructs and declares a publication cache. + * + * @param session: A Zenoh session. + * @param pub_cache: An uninitialized location in memory where publication cache will be constructed. + * @param key_expr: The key expression to publish to. + * @param options: Additional options for the publication cache. + * + * @returns 0 in case of success, negative error code otherwise. + */ +#if defined(Z_FEATURE_UNSTABLE_API) +ZENOHC_API +z_result_t ze_declare_publication_cache(const struct z_loaned_session_t *session, + ze_owned_publication_cache_t *pub_cache, + const struct z_loaned_keyexpr_t *key_expr, + struct ze_publication_cache_options_t *options); +#endif +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Constructs and declares a querying subscriber for a given key expression. + * + * @param session: A Zenoh session. + * @param querying_subscriber: An uninitialized memory location where querying subscriber will be constructed. + * @param key_expr: A key expression to subscribe to. + * @param callback: The callback function that will be called each time a data matching the subscribed expression is received. + * @param options: Additional options for the querying subscriber. + * + * @return 0 in case of success, negative error code otherwise. + */ +#if defined(Z_FEATURE_UNSTABLE_API) +ZENOHC_API +z_result_t ze_declare_querying_subscriber(const struct z_loaned_session_t *session, + ze_owned_querying_subscriber_t *querying_subscriber, + const struct z_loaned_keyexpr_t *key_expr, + struct z_moved_closure_sample_t *callback, + struct ze_querying_subscriber_options_t *options); +#endif /** * @brief Deserializes into a bool. * @return 0 in case of success, negative error code otherwise. @@ -5105,7 +5411,7 @@ ZENOHC_API bool ze_deserializer_is_done(const struct ze_deserializer_t *this_); */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -bool ze_internal_publication_cache_check(const struct ze_owned_publication_cache_t *this_); +bool ze_internal_publication_cache_check(const ze_owned_publication_cache_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -5113,7 +5419,7 @@ bool ze_internal_publication_cache_check(const struct ze_owned_publication_cache */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -void ze_internal_publication_cache_null(struct ze_owned_publication_cache_t *this_); +void ze_internal_publication_cache_null(ze_owned_publication_cache_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -5121,13 +5427,13 @@ void ze_internal_publication_cache_null(struct ze_owned_publication_cache_t *thi */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -bool ze_internal_querying_subscriber_check(const struct ze_owned_querying_subscriber_t *this_); +bool ze_internal_querying_subscriber_check(const ze_owned_querying_subscriber_t *this_); #endif /** * Constructs a querying subscriber in a gravestone state. */ #if defined(Z_FEATURE_UNSTABLE_API) -ZENOHC_API void ze_internal_querying_subscriber_null(struct ze_owned_querying_subscriber_t *this_); +ZENOHC_API void ze_internal_querying_subscriber_null(ze_owned_querying_subscriber_t *this_); #endif /** * @brief Returns ``true`` if `this_` is in a valid state, ``false`` if it is in a gravestone state. @@ -5137,47 +5443,14 @@ ZENOHC_API bool ze_internal_serializer_check(const struct ze_owned_serializer_t * @brief Constructs a serializer in a gravestone state. */ ZENOHC_API void ze_internal_serializer_null(struct ze_owned_serializer_t *this_); -/** - * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * @brief Constructs and declares a publication cache. - * - * @param this_: An uninitialized location in memory where publication cache will be constructed. - * @param session: A Zenoh session. - * @param key_expr: The key expression to publish to. - * @param options: Additional options for the publication cache. - * - * @returns 0 in case of success, negative error code otherwise. - */ -#if defined(Z_FEATURE_UNSTABLE_API) -ZENOHC_API -z_result_t ze_publication_cache_declare(struct ze_owned_publication_cache_t *this_, - const struct z_loaned_session_t *session, - const struct z_loaned_keyexpr_t *key_expr, - struct ze_publication_cache_options_t *options); -#endif -/** - * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * @brief Declares a background publication cache. It will function in background until the corresponding session is closed or dropped. - * - * @param session: A Zenoh session. - * @param key_expr: The key expression to publish to. - * @param options: Additional options for the publication cache. - * - * @returns 0 in case of success, negative error code otherwise. - */ -#if defined(Z_FEATURE_UNSTABLE_API) -ZENOHC_API -z_result_t ze_publication_cache_declare_background(const struct z_loaned_session_t *session, - const struct z_loaned_keyexpr_t *key_expr, - struct ze_publication_cache_options_t *options); -#endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. * @brief Drops publication cache and resets it to its gravestone state. + * This is equivalent to calling `ze_undeclare_publication_cache()` and discarding its return value. */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -void ze_publication_cache_drop(struct ze_moved_publication_cache_t *this_); +void ze_publication_cache_drop(ze_moved_publication_cache_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -5185,7 +5458,7 @@ void ze_publication_cache_drop(struct ze_moved_publication_cache_t *this_); */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -const struct z_loaned_keyexpr_t *ze_publication_cache_keyexpr(const struct ze_loaned_publication_cache_t *this_); +const struct z_loaned_keyexpr_t *ze_publication_cache_keyexpr(const ze_loaned_publication_cache_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -5193,7 +5466,7 @@ const struct z_loaned_keyexpr_t *ze_publication_cache_keyexpr(const struct ze_lo */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -const struct ze_loaned_publication_cache_t *ze_publication_cache_loan(const struct ze_owned_publication_cache_t *this_); +const ze_loaned_publication_cache_t *ze_publication_cache_loan(const ze_owned_publication_cache_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -5203,52 +5476,14 @@ const struct ze_loaned_publication_cache_t *ze_publication_cache_loan(const stru ZENOHC_API void ze_publication_cache_options_default(struct ze_publication_cache_options_t *this_); #endif -/** - * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * @brief Constructs and declares a querying subscriber for a given key expression. - * - * @param this_: An uninitialized memory location where querying subscriber will be constructed. - * @param session: A Zenoh session. - * @param key_expr: A key expression to subscribe to. - * @param callback: The callback function that will be called each time a data matching the subscribed expression is received. - * @param options: Additional options for the querying subscriber. - * - * @return 0 in case of success, negative error code otherwise. - */ -#if defined(Z_FEATURE_UNSTABLE_API) -ZENOHC_API -z_result_t ze_querying_subscriber_declare(struct ze_owned_querying_subscriber_t *this_, - const struct z_loaned_session_t *session, - const struct z_loaned_keyexpr_t *key_expr, - struct z_moved_closure_sample_t *callback, - struct ze_querying_subscriber_options_t *options); -#endif -/** - * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * @brief Declares a background querying subscriber for a given key expression. Subscriber callback will be called to process the messages, - * until the corresponding session is closed or dropped. - * - * @param session: A Zenoh session. - * @param key_expr: A key expression to subscribe to. - * @param callback: The callback function that will be called each time a data matching the subscribed expression is received. - * @param options: Additional options for the querying subscriber. - * - * @return 0 in case of success, negative error code otherwise. - */ -#if defined(Z_FEATURE_UNSTABLE_API) -ZENOHC_API -z_result_t ze_querying_subscriber_declare_background(const struct z_loaned_session_t *session, - const struct z_loaned_keyexpr_t *key_expr, - struct z_moved_closure_sample_t *callback, - struct ze_querying_subscriber_options_t *options); -#endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. * @brief Undeclares querying subscriber callback and resets it to its gravestone state. + * This is equivalent to calling `ze_undeclare_querying_subscriber()` and discarding its return value. */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -void ze_querying_subscriber_drop(struct ze_moved_querying_subscriber_t *this_); +void ze_querying_subscriber_drop(ze_moved_querying_subscriber_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -5258,7 +5493,7 @@ void ze_querying_subscriber_drop(struct ze_moved_querying_subscriber_t *this_); */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -z_result_t ze_querying_subscriber_get(const struct ze_loaned_querying_subscriber_t *this_, +z_result_t ze_querying_subscriber_get(const ze_loaned_querying_subscriber_t *this_, const struct z_loaned_keyexpr_t *selector, struct z_get_options_t *options); #endif @@ -5268,7 +5503,7 @@ z_result_t ze_querying_subscriber_get(const struct ze_loaned_querying_subscriber */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -const struct ze_loaned_querying_subscriber_t *ze_querying_subscriber_loan(const struct ze_owned_querying_subscriber_t *this_); +const ze_loaned_querying_subscriber_t *ze_querying_subscriber_loan(const ze_owned_querying_subscriber_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -5453,3 +5688,22 @@ ZENOHC_API void ze_serializer_serialize_uint64(struct ze_loaned_serializer_t *th * @brief Serializes an unsigned integer. */ ZENOHC_API void ze_serializer_serialize_uint8(struct ze_loaned_serializer_t *this_, uint8_t val); +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Undeclares publication cache. + * @return 0 in case of success, negative error code otherwise. + */ +#if defined(Z_FEATURE_UNSTABLE_API) +ZENOHC_API +z_result_t ze_undeclare_publication_cache(ze_moved_publication_cache_t *this_); +#endif +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Undeclares the given querying subscriber. + * + * @return 0 in case of success, negative error code otherwise. + */ +#if defined(Z_FEATURE_UNSTABLE_API) +ZENOHC_API +z_result_t ze_undeclare_querying_subscriber(ze_moved_querying_subscriber_t *this_); +#endif diff --git a/include/zenoh_macros.h b/include/zenoh_macros.h index 8aa32d4d1..0782ee0a6 100644 --- a/include/zenoh_macros.h +++ b/include/zenoh_macros.h @@ -4,15 +4,12 @@ #ifndef __cplusplus -static inline z_moved_alloc_layout_t* z_alloc_layout_move(z_owned_alloc_layout_t* x) { return (z_moved_alloc_layout_t*)(x); } static inline z_moved_bytes_t* z_bytes_move(z_owned_bytes_t* x) { return (z_moved_bytes_t*)(x); } static inline z_moved_bytes_writer_t* z_bytes_writer_move(z_owned_bytes_writer_t* x) { return (z_moved_bytes_writer_t*)(x); } -static inline z_moved_chunk_alloc_result_t* z_chunk_alloc_result_move(z_owned_chunk_alloc_result_t* x) { return (z_moved_chunk_alloc_result_t*)(x); } static inline z_moved_closure_hello_t* z_closure_hello_move(z_owned_closure_hello_t* x) { return (z_moved_closure_hello_t*)(x); } static inline z_moved_closure_query_t* z_closure_query_move(z_owned_closure_query_t* x) { return (z_moved_closure_query_t*)(x); } static inline z_moved_closure_reply_t* z_closure_reply_move(z_owned_closure_reply_t* x) { return (z_moved_closure_reply_t*)(x); } static inline z_moved_closure_sample_t* z_closure_sample_move(z_owned_closure_sample_t* x) { return (z_moved_closure_sample_t*)(x); } -static inline z_moved_closure_zid_t* z_closure_zid_move(z_owned_closure_zid_t* x) { return (z_moved_closure_zid_t*)(x); } static inline z_moved_condvar_t* z_condvar_move(z_owned_condvar_t* x) { return (z_moved_condvar_t*)(x); } static inline z_moved_config_t* z_config_move(z_owned_config_t* x) { return (z_moved_config_t*)(x); } static inline z_moved_encoding_t* z_encoding_move(z_owned_encoding_t* x) { return (z_moved_encoding_t*)(x); } @@ -21,7 +18,6 @@ static inline z_moved_fifo_handler_reply_t* z_fifo_handler_reply_move(z_owned_fi static inline z_moved_fifo_handler_sample_t* z_fifo_handler_sample_move(z_owned_fifo_handler_sample_t* x) { return (z_moved_fifo_handler_sample_t*)(x); } static inline z_moved_hello_t* z_hello_move(z_owned_hello_t* x) { return (z_moved_hello_t*)(x); } static inline z_moved_keyexpr_t* z_keyexpr_move(z_owned_keyexpr_t* x) { return (z_moved_keyexpr_t*)(x); } -static inline z_moved_memory_layout_t* z_memory_layout_move(z_owned_memory_layout_t* x) { return (z_moved_memory_layout_t*)(x); } static inline z_moved_mutex_t* z_mutex_move(z_owned_mutex_t* x) { return (z_moved_mutex_t*)(x); } static inline z_moved_publisher_t* z_publisher_move(z_owned_publisher_t* x) { return (z_moved_publisher_t*)(x); } static inline z_moved_query_t* z_query_move(z_owned_query_t* x) { return (z_moved_query_t*)(x); } @@ -33,38 +29,23 @@ static inline z_moved_ring_handler_reply_t* z_ring_handler_reply_move(z_owned_ri static inline z_moved_ring_handler_sample_t* z_ring_handler_sample_move(z_owned_ring_handler_sample_t* x) { return (z_moved_ring_handler_sample_t*)(x); } static inline z_moved_sample_t* z_sample_move(z_owned_sample_t* x) { return (z_moved_sample_t*)(x); } static inline z_moved_session_t* z_session_move(z_owned_session_t* x) { return (z_moved_session_t*)(x); } -static inline z_moved_shm_client_t* z_shm_client_move(z_owned_shm_client_t* x) { return (z_moved_shm_client_t*)(x); } -static inline z_moved_shm_client_storage_t* z_shm_client_storage_move(z_owned_shm_client_storage_t* x) { return (z_moved_shm_client_storage_t*)(x); } -static inline z_moved_shm_t* z_shm_move(z_owned_shm_t* x) { return (z_moved_shm_t*)(x); } -static inline z_moved_shm_mut_t* z_shm_mut_move(z_owned_shm_mut_t* x) { return (z_moved_shm_mut_t*)(x); } -static inline z_moved_shm_provider_t* z_shm_provider_move(z_owned_shm_provider_t* x) { return (z_moved_shm_provider_t*)(x); } static inline z_moved_slice_t* z_slice_move(z_owned_slice_t* x) { return (z_moved_slice_t*)(x); } -static inline z_moved_source_info_t* z_source_info_move(z_owned_source_info_t* x) { return (z_moved_source_info_t*)(x); } static inline z_moved_string_array_t* z_string_array_move(z_owned_string_array_t* x) { return (z_moved_string_array_t*)(x); } static inline z_moved_string_t* z_string_move(z_owned_string_t* x) { return (z_moved_string_t*)(x); } static inline z_moved_subscriber_t* z_subscriber_move(z_owned_subscriber_t* x) { return (z_moved_subscriber_t*)(x); } static inline z_moved_task_t* z_task_move(z_owned_task_t* x) { return (z_moved_task_t*)(x); } static inline zc_moved_closure_log_t* zc_closure_log_move(zc_owned_closure_log_t* x) { return (zc_moved_closure_log_t*)(x); } -static inline zc_moved_closure_matching_status_t* zc_closure_matching_status_move(zc_owned_closure_matching_status_t* x) { return (zc_moved_closure_matching_status_t*)(x); } -static inline zc_moved_liveliness_token_t* zc_liveliness_token_move(zc_owned_liveliness_token_t* x) { return (zc_moved_liveliness_token_t*)(x); } -static inline zc_moved_matching_listener_t* zc_publisher_matching_listener_move(zc_owned_matching_listener_t* x) { return (zc_moved_matching_listener_t*)(x); } -static inline zc_moved_shm_client_list_t* zc_shm_client_list_move(zc_owned_shm_client_list_t* x) { return (zc_moved_shm_client_list_t*)(x); } -static inline ze_moved_publication_cache_t* ze_publication_cache_move(ze_owned_publication_cache_t* x) { return (ze_moved_publication_cache_t*)(x); } -static inline ze_moved_querying_subscriber_t* ze_querying_subscriber_move(ze_owned_querying_subscriber_t* x) { return (ze_moved_querying_subscriber_t*)(x); } static inline ze_moved_serializer_t* ze_serializer_move(ze_owned_serializer_t* x) { return (ze_moved_serializer_t*)(x); } #define z_loan(this_) \ _Generic((this_), \ - z_owned_alloc_layout_t : z_alloc_layout_loan, \ z_owned_bytes_t : z_bytes_loan, \ z_owned_bytes_writer_t : z_bytes_writer_loan, \ - z_owned_chunk_alloc_result_t : z_chunk_alloc_result_loan, \ z_owned_closure_hello_t : z_closure_hello_loan, \ z_owned_closure_query_t : z_closure_query_loan, \ z_owned_closure_reply_t : z_closure_reply_loan, \ z_owned_closure_sample_t : z_closure_sample_loan, \ - z_owned_closure_zid_t : z_closure_zid_loan, \ z_owned_condvar_t : z_condvar_loan, \ z_owned_config_t : z_config_loan, \ z_owned_encoding_t : z_encoding_loan, \ @@ -73,7 +54,6 @@ static inline ze_moved_serializer_t* ze_serializer_move(ze_owned_serializer_t* x z_owned_fifo_handler_sample_t : z_fifo_handler_sample_loan, \ z_owned_hello_t : z_hello_loan, \ z_owned_keyexpr_t : z_keyexpr_loan, \ - z_owned_memory_layout_t : z_memory_layout_loan, \ z_owned_publisher_t : z_publisher_loan, \ z_owned_query_t : z_query_loan, \ z_owned_queryable_t : z_queryable_loan, \ @@ -84,12 +64,7 @@ static inline ze_moved_serializer_t* ze_serializer_move(ze_owned_serializer_t* x z_owned_ring_handler_sample_t : z_ring_handler_sample_loan, \ z_owned_sample_t : z_sample_loan, \ z_owned_session_t : z_session_loan, \ - z_owned_shm_client_storage_t : z_shm_client_storage_loan, \ - z_owned_shm_t : z_shm_loan, \ - z_owned_shm_mut_t : z_shm_mut_loan, \ - z_owned_shm_provider_t : z_shm_provider_loan, \ z_owned_slice_t : z_slice_loan, \ - z_owned_source_info_t : z_source_info_loan, \ z_owned_string_array_t : z_string_array_loan, \ z_owned_string_t : z_string_loan, \ z_owned_subscriber_t : z_subscriber_loan, \ @@ -97,11 +72,6 @@ static inline ze_moved_serializer_t* ze_serializer_move(ze_owned_serializer_t* x z_view_slice_t : z_view_slice_loan, \ z_view_string_t : z_view_string_loan, \ zc_owned_closure_log_t : zc_closure_log_loan, \ - zc_owned_closure_matching_status_t : zc_closure_matching_status_loan, \ - zc_owned_liveliness_token_t : zc_liveliness_token_loan, \ - zc_owned_shm_client_list_t : zc_shm_client_list_loan, \ - ze_owned_publication_cache_t : ze_publication_cache_loan, \ - ze_owned_querying_subscriber_t : ze_querying_subscriber_loan, \ ze_owned_serializer_t : ze_serializer_loan \ )(&this_) @@ -115,24 +85,18 @@ static inline ze_moved_serializer_t* ze_serializer_move(ze_owned_serializer_t* x z_owned_mutex_t : z_mutex_loan_mut, \ z_owned_publisher_t : z_publisher_loan_mut, \ z_owned_session_t : z_session_loan_mut, \ - z_owned_shm_t : z_shm_loan_mut, \ - z_owned_shm_mut_t : z_shm_mut_loan_mut, \ z_owned_string_array_t : z_string_array_loan_mut, \ - zc_owned_shm_client_list_t : zc_shm_client_list_loan_mut, \ ze_owned_serializer_t : ze_serializer_loan_mut \ )(&this_) #define z_drop(this_) \ _Generic((this_), \ - z_moved_alloc_layout_t* : z_alloc_layout_drop, \ z_moved_bytes_t* : z_bytes_drop, \ z_moved_bytes_writer_t* : z_bytes_writer_drop, \ - z_moved_chunk_alloc_result_t* : z_chunk_alloc_result_drop, \ z_moved_closure_hello_t* : z_closure_hello_drop, \ z_moved_closure_query_t* : z_closure_query_drop, \ z_moved_closure_reply_t* : z_closure_reply_drop, \ z_moved_closure_sample_t* : z_closure_sample_drop, \ - z_moved_closure_zid_t* : z_closure_zid_drop, \ z_moved_condvar_t* : z_condvar_drop, \ z_moved_config_t* : z_config_drop, \ z_moved_encoding_t* : z_encoding_drop, \ @@ -141,7 +105,6 @@ static inline ze_moved_serializer_t* ze_serializer_move(ze_owned_serializer_t* x z_moved_fifo_handler_sample_t* : z_fifo_handler_sample_drop, \ z_moved_hello_t* : z_hello_drop, \ z_moved_keyexpr_t* : z_keyexpr_drop, \ - z_moved_memory_layout_t* : z_memory_layout_drop, \ z_moved_mutex_t* : z_mutex_drop, \ z_moved_publisher_t* : z_publisher_drop, \ z_moved_query_t* : z_query_drop, \ @@ -153,38 +116,23 @@ static inline ze_moved_serializer_t* ze_serializer_move(ze_owned_serializer_t* x z_moved_ring_handler_sample_t* : z_ring_handler_sample_drop, \ z_moved_sample_t* : z_sample_drop, \ z_moved_session_t* : z_session_drop, \ - z_moved_shm_client_t* : z_shm_client_drop, \ - z_moved_shm_client_storage_t* : z_shm_client_storage_drop, \ - z_moved_shm_t* : z_shm_drop, \ - z_moved_shm_mut_t* : z_shm_mut_drop, \ - z_moved_shm_provider_t* : z_shm_provider_drop, \ z_moved_slice_t* : z_slice_drop, \ - z_moved_source_info_t* : z_source_info_drop, \ z_moved_string_array_t* : z_string_array_drop, \ z_moved_string_t* : z_string_drop, \ z_moved_subscriber_t* : z_subscriber_drop, \ z_moved_task_t* : z_task_drop, \ zc_moved_closure_log_t* : zc_closure_log_drop, \ - zc_moved_closure_matching_status_t* : zc_closure_matching_status_drop, \ - zc_moved_liveliness_token_t* : zc_liveliness_token_drop, \ - zc_moved_matching_listener_t* : zc_publisher_matching_listener_drop, \ - zc_moved_shm_client_list_t* : zc_shm_client_list_drop, \ - ze_moved_publication_cache_t* : ze_publication_cache_drop, \ - ze_moved_querying_subscriber_t* : ze_querying_subscriber_drop, \ ze_moved_serializer_t* : ze_serializer_drop \ )(this_) #define z_move(this_) \ _Generic((this_), \ - z_owned_alloc_layout_t : z_alloc_layout_move, \ z_owned_bytes_t : z_bytes_move, \ z_owned_bytes_writer_t : z_bytes_writer_move, \ - z_owned_chunk_alloc_result_t : z_chunk_alloc_result_move, \ z_owned_closure_hello_t : z_closure_hello_move, \ z_owned_closure_query_t : z_closure_query_move, \ z_owned_closure_reply_t : z_closure_reply_move, \ z_owned_closure_sample_t : z_closure_sample_move, \ - z_owned_closure_zid_t : z_closure_zid_move, \ z_owned_condvar_t : z_condvar_move, \ z_owned_config_t : z_config_move, \ z_owned_encoding_t : z_encoding_move, \ @@ -193,7 +141,6 @@ static inline ze_moved_serializer_t* ze_serializer_move(ze_owned_serializer_t* x z_owned_fifo_handler_sample_t : z_fifo_handler_sample_move, \ z_owned_hello_t : z_hello_move, \ z_owned_keyexpr_t : z_keyexpr_move, \ - z_owned_memory_layout_t : z_memory_layout_move, \ z_owned_mutex_t : z_mutex_move, \ z_owned_publisher_t : z_publisher_move, \ z_owned_query_t : z_query_move, \ @@ -205,38 +152,23 @@ static inline ze_moved_serializer_t* ze_serializer_move(ze_owned_serializer_t* x z_owned_ring_handler_sample_t : z_ring_handler_sample_move, \ z_owned_sample_t : z_sample_move, \ z_owned_session_t : z_session_move, \ - z_owned_shm_client_t : z_shm_client_move, \ - z_owned_shm_client_storage_t : z_shm_client_storage_move, \ - z_owned_shm_t : z_shm_move, \ - z_owned_shm_mut_t : z_shm_mut_move, \ - z_owned_shm_provider_t : z_shm_provider_move, \ z_owned_slice_t : z_slice_move, \ - z_owned_source_info_t : z_source_info_move, \ z_owned_string_array_t : z_string_array_move, \ z_owned_string_t : z_string_move, \ z_owned_subscriber_t : z_subscriber_move, \ z_owned_task_t : z_task_move, \ zc_owned_closure_log_t : zc_closure_log_move, \ - zc_owned_closure_matching_status_t : zc_closure_matching_status_move, \ - zc_owned_liveliness_token_t : zc_liveliness_token_move, \ - zc_owned_matching_listener_t : zc_publisher_matching_listener_move, \ - zc_owned_shm_client_list_t : zc_shm_client_list_move, \ - ze_owned_publication_cache_t : ze_publication_cache_move, \ - ze_owned_querying_subscriber_t : ze_querying_subscriber_move, \ ze_owned_serializer_t : ze_serializer_move \ )(&this_) #define z_internal_null(this_) \ _Generic((this_), \ - z_owned_alloc_layout_t* : z_internal_alloc_layout_null, \ z_owned_bytes_t* : z_internal_bytes_null, \ z_owned_bytes_writer_t* : z_internal_bytes_writer_null, \ - z_owned_chunk_alloc_result_t* : z_internal_chunk_alloc_result_null, \ z_owned_closure_hello_t* : z_internal_closure_hello_null, \ z_owned_closure_query_t* : z_internal_closure_query_null, \ z_owned_closure_reply_t* : z_internal_closure_reply_null, \ z_owned_closure_sample_t* : z_internal_closure_sample_null, \ - z_owned_closure_zid_t* : z_internal_closure_zid_null, \ z_owned_condvar_t* : z_internal_condvar_null, \ z_owned_config_t* : z_internal_config_null, \ z_owned_encoding_t* : z_internal_encoding_null, \ @@ -245,7 +177,6 @@ static inline ze_moved_serializer_t* ze_serializer_move(ze_owned_serializer_t* x z_owned_fifo_handler_sample_t* : z_internal_fifo_handler_sample_null, \ z_owned_hello_t* : z_internal_hello_null, \ z_owned_keyexpr_t* : z_internal_keyexpr_null, \ - z_owned_memory_layout_t* : z_internal_memory_layout_null, \ z_owned_mutex_t* : z_internal_mutex_null, \ z_owned_publisher_t* : z_internal_publisher_null, \ z_owned_query_t* : z_internal_query_null, \ @@ -257,36 +188,21 @@ static inline ze_moved_serializer_t* ze_serializer_move(ze_owned_serializer_t* x z_owned_ring_handler_sample_t* : z_internal_ring_handler_sample_null, \ z_owned_sample_t* : z_internal_sample_null, \ z_owned_session_t* : z_internal_session_null, \ - z_owned_shm_client_t* : z_internal_shm_client_null, \ - z_owned_shm_client_storage_t* : z_internal_shm_client_storage_null, \ - z_owned_shm_mut_t* : z_internal_shm_mut_null, \ - z_owned_shm_t* : z_internal_shm_null, \ - z_owned_shm_provider_t* : z_internal_shm_provider_null, \ z_owned_slice_t* : z_internal_slice_null, \ - z_owned_source_info_t* : z_internal_source_info_null, \ z_owned_string_array_t* : z_internal_string_array_null, \ z_owned_string_t* : z_internal_string_null, \ z_owned_subscriber_t* : z_internal_subscriber_null, \ z_owned_task_t* : z_internal_task_null, \ zc_owned_closure_log_t* : zc_internal_closure_log_null, \ - zc_owned_closure_matching_status_t* : zc_internal_closure_matching_status_null, \ - zc_owned_liveliness_token_t* : zc_internal_liveliness_token_null, \ - zc_owned_matching_listener_t* : zc_internal_matching_listener_null, \ - zc_owned_shm_client_list_t* : zc_internal_shm_client_list_null, \ - ze_owned_publication_cache_t* : ze_internal_publication_cache_null, \ - ze_owned_querying_subscriber_t* : ze_internal_querying_subscriber_null, \ ze_owned_serializer_t* : ze_internal_serializer_null \ )(this_) -static inline void z_alloc_layout_take(z_owned_alloc_layout_t* this_, z_moved_alloc_layout_t* x) { *this_ = x->_this; z_internal_alloc_layout_null(&x->_this); } static inline void z_bytes_take(z_owned_bytes_t* this_, z_moved_bytes_t* x) { *this_ = x->_this; z_internal_bytes_null(&x->_this); } static inline void z_bytes_writer_take(z_owned_bytes_writer_t* this_, z_moved_bytes_writer_t* x) { *this_ = x->_this; z_internal_bytes_writer_null(&x->_this); } -static inline void z_chunk_alloc_result_take(z_owned_chunk_alloc_result_t* this_, z_moved_chunk_alloc_result_t* x) { *this_ = x->_this; z_internal_chunk_alloc_result_null(&x->_this); } static inline void z_closure_hello_take(z_owned_closure_hello_t* this_, z_moved_closure_hello_t* x) { *this_ = x->_this; z_internal_closure_hello_null(&x->_this); } static inline void z_closure_query_take(z_owned_closure_query_t* closure_, z_moved_closure_query_t* x) { *closure_ = x->_this; z_internal_closure_query_null(&x->_this); } static inline void z_closure_reply_take(z_owned_closure_reply_t* closure_, z_moved_closure_reply_t* x) { *closure_ = x->_this; z_internal_closure_reply_null(&x->_this); } static inline void z_closure_sample_take(z_owned_closure_sample_t* closure_, z_moved_closure_sample_t* x) { *closure_ = x->_this; z_internal_closure_sample_null(&x->_this); } -static inline void z_closure_zid_take(z_owned_closure_zid_t* closure_, z_moved_closure_zid_t* x) { *closure_ = x->_this; z_internal_closure_zid_null(&x->_this); } static inline void z_condvar_take(z_owned_condvar_t* this_, z_moved_condvar_t* x) { *this_ = x->_this; z_internal_condvar_null(&x->_this); } static inline void z_config_take(z_owned_config_t* this_, z_moved_config_t* x) { *this_ = x->_this; z_internal_config_null(&x->_this); } static inline void z_encoding_take(z_owned_encoding_t* this_, z_moved_encoding_t* x) { *this_ = x->_this; z_internal_encoding_null(&x->_this); } @@ -295,7 +211,6 @@ static inline void z_fifo_handler_reply_take(z_owned_fifo_handler_reply_t* this_ static inline void z_fifo_handler_sample_take(z_owned_fifo_handler_sample_t* this_, z_moved_fifo_handler_sample_t* x) { *this_ = x->_this; z_internal_fifo_handler_sample_null(&x->_this); } static inline void z_hello_take(z_owned_hello_t* this_, z_moved_hello_t* x) { *this_ = x->_this; z_internal_hello_null(&x->_this); } static inline void z_keyexpr_take(z_owned_keyexpr_t* this_, z_moved_keyexpr_t* x) { *this_ = x->_this; z_internal_keyexpr_null(&x->_this); } -static inline void z_memory_layout_take(z_owned_memory_layout_t* this_, z_moved_memory_layout_t* x) { *this_ = x->_this; z_internal_memory_layout_null(&x->_this); } static inline void z_mutex_take(z_owned_mutex_t* this_, z_moved_mutex_t* x) { *this_ = x->_this; z_internal_mutex_null(&x->_this); } static inline void z_publisher_take(z_owned_publisher_t* this_, z_moved_publisher_t* x) { *this_ = x->_this; z_internal_publisher_null(&x->_this); } static inline void z_query_take(z_owned_query_t* this_, z_moved_query_t* x) { *this_ = x->_this; z_internal_query_null(&x->_this); } @@ -307,38 +222,23 @@ static inline void z_ring_handler_reply_take(z_owned_ring_handler_reply_t* this_ static inline void z_ring_handler_sample_take(z_owned_ring_handler_sample_t* this_, z_moved_ring_handler_sample_t* x) { *this_ = x->_this; z_internal_ring_handler_sample_null(&x->_this); } static inline void z_sample_take(z_owned_sample_t* this_, z_moved_sample_t* x) { *this_ = x->_this; z_internal_sample_null(&x->_this); } static inline void z_session_take(z_owned_session_t* this_, z_moved_session_t* x) { *this_ = x->_this; z_internal_session_null(&x->_this); } -static inline void z_shm_client_take(z_owned_shm_client_t* this_, z_moved_shm_client_t* x) { *this_ = x->_this; z_internal_shm_client_null(&x->_this); } -static inline void z_shm_client_storage_take(z_owned_shm_client_storage_t* this_, z_moved_shm_client_storage_t* x) { *this_ = x->_this; z_internal_shm_client_storage_null(&x->_this); } -static inline void z_shm_take(z_owned_shm_t* this_, z_moved_shm_t* x) { *this_ = x->_this; z_internal_shm_null(&x->_this); } -static inline void z_shm_mut_take(z_owned_shm_mut_t* this_, z_moved_shm_mut_t* x) { *this_ = x->_this; z_internal_shm_mut_null(&x->_this); } -static inline void z_shm_provider_take(z_owned_shm_provider_t* this_, z_moved_shm_provider_t* x) { *this_ = x->_this; z_internal_shm_provider_null(&x->_this); } static inline void z_slice_take(z_owned_slice_t* this_, z_moved_slice_t* x) { *this_ = x->_this; z_internal_slice_null(&x->_this); } -static inline void z_source_info_take(z_owned_source_info_t* this_, z_moved_source_info_t* x) { *this_ = x->_this; z_internal_source_info_null(&x->_this); } static inline void z_string_array_take(z_owned_string_array_t* this_, z_moved_string_array_t* x) { *this_ = x->_this; z_internal_string_array_null(&x->_this); } static inline void z_string_take(z_owned_string_t* this_, z_moved_string_t* x) { *this_ = x->_this; z_internal_string_null(&x->_this); } static inline void z_subscriber_take(z_owned_subscriber_t* this_, z_moved_subscriber_t* x) { *this_ = x->_this; z_internal_subscriber_null(&x->_this); } static inline void z_task_take(z_owned_task_t* this_, z_moved_task_t* x) { *this_ = x->_this; z_internal_task_null(&x->_this); } static inline void zc_closure_log_take(zc_owned_closure_log_t* closure_, zc_moved_closure_log_t* x) { *closure_ = x->_this; zc_internal_closure_log_null(&x->_this); } -static inline void zc_closure_matching_status_take(zc_owned_closure_matching_status_t* closure_, zc_moved_closure_matching_status_t* x) { *closure_ = x->_this; zc_internal_closure_matching_status_null(&x->_this); } -static inline void zc_liveliness_token_take(zc_owned_liveliness_token_t* this_, zc_moved_liveliness_token_t* x) { *this_ = x->_this; zc_internal_liveliness_token_null(&x->_this); } -static inline void zc_publisher_matching_listener_take(zc_owned_matching_listener_t* this_, zc_moved_matching_listener_t* x) { *this_ = x->_this; zc_internal_matching_listener_null(&x->_this); } -static inline void zc_shm_client_list_take(zc_owned_shm_client_list_t* this_, zc_moved_shm_client_list_t* x) { *this_ = x->_this; zc_internal_shm_client_list_null(&x->_this); } -static inline void ze_publication_cache_take(ze_owned_publication_cache_t* this_, ze_moved_publication_cache_t* x) { *this_ = x->_this; ze_internal_publication_cache_null(&x->_this); } -static inline void ze_querying_subscriber_take(ze_owned_querying_subscriber_t* this_, ze_moved_querying_subscriber_t* x) { *this_ = x->_this; ze_internal_querying_subscriber_null(&x->_this); } static inline void ze_serializer_take(ze_owned_serializer_t* this_, ze_moved_serializer_t* x) { *this_ = x->_this; ze_internal_serializer_null(&x->_this); } #define z_take(this_, x) \ _Generic((this_), \ - z_owned_alloc_layout_t* : z_alloc_layout_take, \ z_owned_bytes_t* : z_bytes_take, \ z_owned_bytes_writer_t* : z_bytes_writer_take, \ - z_owned_chunk_alloc_result_t* : z_chunk_alloc_result_take, \ z_owned_closure_hello_t* : z_closure_hello_take, \ z_owned_closure_query_t* : z_closure_query_take, \ z_owned_closure_reply_t* : z_closure_reply_take, \ z_owned_closure_sample_t* : z_closure_sample_take, \ - z_owned_closure_zid_t* : z_closure_zid_take, \ z_owned_condvar_t* : z_condvar_take, \ z_owned_config_t* : z_config_take, \ z_owned_encoding_t* : z_encoding_take, \ @@ -347,7 +247,6 @@ static inline void ze_serializer_take(ze_owned_serializer_t* this_, ze_moved_ser z_owned_fifo_handler_sample_t* : z_fifo_handler_sample_take, \ z_owned_hello_t* : z_hello_take, \ z_owned_keyexpr_t* : z_keyexpr_take, \ - z_owned_memory_layout_t* : z_memory_layout_take, \ z_owned_mutex_t* : z_mutex_take, \ z_owned_publisher_t* : z_publisher_take, \ z_owned_query_t* : z_query_take, \ @@ -359,38 +258,23 @@ static inline void ze_serializer_take(ze_owned_serializer_t* this_, ze_moved_ser z_owned_ring_handler_sample_t* : z_ring_handler_sample_take, \ z_owned_sample_t* : z_sample_take, \ z_owned_session_t* : z_session_take, \ - z_owned_shm_client_t* : z_shm_client_take, \ - z_owned_shm_client_storage_t* : z_shm_client_storage_take, \ - z_owned_shm_t* : z_shm_take, \ - z_owned_shm_mut_t* : z_shm_mut_take, \ - z_owned_shm_provider_t* : z_shm_provider_take, \ z_owned_slice_t* : z_slice_take, \ - z_owned_source_info_t* : z_source_info_take, \ z_owned_string_array_t* : z_string_array_take, \ z_owned_string_t* : z_string_take, \ z_owned_subscriber_t* : z_subscriber_take, \ z_owned_task_t* : z_task_take, \ zc_owned_closure_log_t* : zc_closure_log_take, \ - zc_owned_closure_matching_status_t* : zc_closure_matching_status_take, \ - zc_owned_liveliness_token_t* : zc_liveliness_token_take, \ - zc_owned_matching_listener_t* : zc_publisher_matching_listener_take, \ - zc_owned_shm_client_list_t* : zc_shm_client_list_take, \ - ze_owned_publication_cache_t* : ze_publication_cache_take, \ - ze_owned_querying_subscriber_t* : ze_querying_subscriber_take, \ ze_owned_serializer_t* : ze_serializer_take \ )(this_, x) #define z_internal_check(this_) \ _Generic((this_), \ - z_owned_alloc_layout_t : z_internal_alloc_layout_check, \ z_owned_bytes_t : z_internal_bytes_check, \ z_owned_bytes_writer_t : z_internal_bytes_writer_check, \ - z_owned_chunk_alloc_result_t : z_internal_chunk_alloc_result_check, \ z_owned_closure_hello_t : z_internal_closure_hello_check, \ z_owned_closure_query_t : z_internal_closure_query_check, \ z_owned_closure_reply_t : z_internal_closure_reply_check, \ z_owned_closure_sample_t : z_internal_closure_sample_check, \ - z_owned_closure_zid_t : z_internal_closure_zid_check, \ z_owned_condvar_t : z_internal_condvar_check, \ z_owned_config_t : z_internal_config_check, \ z_owned_encoding_t : z_internal_encoding_check, \ @@ -399,7 +283,6 @@ static inline void ze_serializer_take(ze_owned_serializer_t* this_, ze_moved_ser z_owned_fifo_handler_sample_t : z_internal_fifo_handler_sample_check, \ z_owned_hello_t : z_internal_hello_check, \ z_owned_keyexpr_t : z_internal_keyexpr_check, \ - z_owned_memory_layout_t : z_internal_memory_layout_check, \ z_owned_mutex_t : z_internal_mutex_check, \ z_owned_publisher_t : z_internal_publisher_check, \ z_owned_query_t : z_internal_query_check, \ @@ -411,24 +294,12 @@ static inline void ze_serializer_take(ze_owned_serializer_t* this_, ze_moved_ser z_owned_ring_handler_sample_t : z_internal_ring_handler_sample_check, \ z_owned_sample_t : z_internal_sample_check, \ z_owned_session_t : z_internal_session_check, \ - z_owned_shm_t : z_internal_shm_check, \ - z_owned_shm_client_t : z_internal_shm_client_check, \ - z_owned_shm_client_storage_t : z_internal_shm_client_storage_check, \ - z_owned_shm_mut_t : z_internal_shm_mut_check, \ - z_owned_shm_provider_t : z_internal_shm_provider_check, \ z_owned_slice_t : z_internal_slice_check, \ - z_owned_source_info_t : z_internal_source_info_check, \ z_owned_string_array_t : z_internal_string_array_check, \ z_owned_string_t : z_internal_string_check, \ z_owned_subscriber_t : z_internal_subscriber_check, \ z_owned_task_t : z_internal_task_check, \ zc_owned_closure_log_t : zc_internal_closure_log_check, \ - zc_owned_closure_matching_status_t : zc_internal_closure_matching_status_check, \ - zc_owned_liveliness_token_t : zc_internal_liveliness_token_check, \ - zc_owned_matching_listener_t : zc_internal_matching_listener_check, \ - zc_owned_shm_client_list_t : zc_internal_shm_client_list_check, \ - ze_owned_publication_cache_t : ze_internal_publication_cache_check, \ - ze_owned_querying_subscriber_t : ze_internal_querying_subscriber_check, \ ze_owned_serializer_t : ze_internal_serializer_check \ )(&this_) @@ -437,9 +308,7 @@ static inline void ze_serializer_take(ze_owned_serializer_t* this_, ze_moved_ser const z_loaned_closure_hello_t* : z_closure_hello_call, \ const z_loaned_closure_query_t* : z_closure_query_call, \ const z_loaned_closure_reply_t* : z_closure_reply_call, \ - const z_loaned_closure_sample_t* : z_closure_sample_call, \ - const z_loaned_closure_zid_t* : z_closure_zid_call, \ - const zc_loaned_closure_matching_status_t* : zc_closure_matching_status_call \ + const z_loaned_closure_sample_t* : z_closure_sample_call \ )(closure, hello) #define z_closure(this_, call, drop, context) \ @@ -448,9 +317,7 @@ static inline void ze_serializer_take(ze_owned_serializer_t* this_, ze_moved_ser z_owned_closure_query_t* : z_closure_query, \ z_owned_closure_reply_t* : z_closure_reply, \ z_owned_closure_sample_t* : z_closure_sample, \ - z_owned_closure_zid_t* : z_closure_zid, \ - zc_owned_closure_log_t* : zc_closure_log, \ - zc_owned_closure_matching_status_t* : zc_closure_matching_status \ + zc_owned_closure_log_t* : zc_closure_log \ )(this_, call, drop, context) #define z_try_recv(this_, query) \ @@ -484,8 +351,6 @@ static inline void ze_serializer_take(ze_owned_serializer_t* this_, ze_moved_ser z_owned_reply_t* : z_reply_clone, \ z_owned_reply_err_t* : z_reply_err_clone, \ z_owned_sample_t* : z_sample_clone, \ - z_owned_shm_client_storage_t* : z_shm_client_storage_clone, \ - z_owned_shm_t* : z_shm_clone, \ z_owned_slice_t* : z_slice_clone, \ z_owned_string_array_t* : z_string_array_clone, \ z_owned_string_t* : z_string_clone \ @@ -493,15 +358,12 @@ static inline void ze_serializer_take(ze_owned_serializer_t* this_, ze_moved_ser #else // #ifndef __cplusplus -static inline z_moved_alloc_layout_t* z_alloc_layout_move(z_owned_alloc_layout_t* x) { return reinterpret_cast(x); } static inline z_moved_bytes_t* z_bytes_move(z_owned_bytes_t* x) { return reinterpret_cast(x); } static inline z_moved_bytes_writer_t* z_bytes_writer_move(z_owned_bytes_writer_t* x) { return reinterpret_cast(x); } -static inline z_moved_chunk_alloc_result_t* z_chunk_alloc_result_move(z_owned_chunk_alloc_result_t* x) { return reinterpret_cast(x); } static inline z_moved_closure_hello_t* z_closure_hello_move(z_owned_closure_hello_t* x) { return reinterpret_cast(x); } static inline z_moved_closure_query_t* z_closure_query_move(z_owned_closure_query_t* x) { return reinterpret_cast(x); } static inline z_moved_closure_reply_t* z_closure_reply_move(z_owned_closure_reply_t* x) { return reinterpret_cast(x); } static inline z_moved_closure_sample_t* z_closure_sample_move(z_owned_closure_sample_t* x) { return reinterpret_cast(x); } -static inline z_moved_closure_zid_t* z_closure_zid_move(z_owned_closure_zid_t* x) { return reinterpret_cast(x); } static inline z_moved_condvar_t* z_condvar_move(z_owned_condvar_t* x) { return reinterpret_cast(x); } static inline z_moved_config_t* z_config_move(z_owned_config_t* x) { return reinterpret_cast(x); } static inline z_moved_encoding_t* z_encoding_move(z_owned_encoding_t* x) { return reinterpret_cast(x); } @@ -510,7 +372,6 @@ static inline z_moved_fifo_handler_reply_t* z_fifo_handler_reply_move(z_owned_fi static inline z_moved_fifo_handler_sample_t* z_fifo_handler_sample_move(z_owned_fifo_handler_sample_t* x) { return reinterpret_cast(x); } static inline z_moved_hello_t* z_hello_move(z_owned_hello_t* x) { return reinterpret_cast(x); } static inline z_moved_keyexpr_t* z_keyexpr_move(z_owned_keyexpr_t* x) { return reinterpret_cast(x); } -static inline z_moved_memory_layout_t* z_memory_layout_move(z_owned_memory_layout_t* x) { return reinterpret_cast(x); } static inline z_moved_mutex_t* z_mutex_move(z_owned_mutex_t* x) { return reinterpret_cast(x); } static inline z_moved_publisher_t* z_publisher_move(z_owned_publisher_t* x) { return reinterpret_cast(x); } static inline z_moved_query_t* z_query_move(z_owned_query_t* x) { return reinterpret_cast(x); } @@ -522,37 +383,22 @@ static inline z_moved_ring_handler_reply_t* z_ring_handler_reply_move(z_owned_ri static inline z_moved_ring_handler_sample_t* z_ring_handler_sample_move(z_owned_ring_handler_sample_t* x) { return reinterpret_cast(x); } static inline z_moved_sample_t* z_sample_move(z_owned_sample_t* x) { return reinterpret_cast(x); } static inline z_moved_session_t* z_session_move(z_owned_session_t* x) { return reinterpret_cast(x); } -static inline z_moved_shm_client_t* z_shm_client_move(z_owned_shm_client_t* x) { return reinterpret_cast(x); } -static inline z_moved_shm_client_storage_t* z_shm_client_storage_move(z_owned_shm_client_storage_t* x) { return reinterpret_cast(x); } -static inline z_moved_shm_t* z_shm_move(z_owned_shm_t* x) { return reinterpret_cast(x); } -static inline z_moved_shm_mut_t* z_shm_mut_move(z_owned_shm_mut_t* x) { return reinterpret_cast(x); } -static inline z_moved_shm_provider_t* z_shm_provider_move(z_owned_shm_provider_t* x) { return reinterpret_cast(x); } static inline z_moved_slice_t* z_slice_move(z_owned_slice_t* x) { return reinterpret_cast(x); } -static inline z_moved_source_info_t* z_source_info_move(z_owned_source_info_t* x) { return reinterpret_cast(x); } static inline z_moved_string_array_t* z_string_array_move(z_owned_string_array_t* x) { return reinterpret_cast(x); } static inline z_moved_string_t* z_string_move(z_owned_string_t* x) { return reinterpret_cast(x); } static inline z_moved_subscriber_t* z_subscriber_move(z_owned_subscriber_t* x) { return reinterpret_cast(x); } static inline z_moved_task_t* z_task_move(z_owned_task_t* x) { return reinterpret_cast(x); } static inline zc_moved_closure_log_t* zc_closure_log_move(zc_owned_closure_log_t* x) { return reinterpret_cast(x); } -static inline zc_moved_closure_matching_status_t* zc_closure_matching_status_move(zc_owned_closure_matching_status_t* x) { return reinterpret_cast(x); } -static inline zc_moved_liveliness_token_t* zc_liveliness_token_move(zc_owned_liveliness_token_t* x) { return reinterpret_cast(x); } -static inline zc_moved_matching_listener_t* zc_publisher_matching_listener_move(zc_owned_matching_listener_t* x) { return reinterpret_cast(x); } -static inline zc_moved_shm_client_list_t* zc_shm_client_list_move(zc_owned_shm_client_list_t* x) { return reinterpret_cast(x); } -static inline ze_moved_publication_cache_t* ze_publication_cache_move(ze_owned_publication_cache_t* x) { return reinterpret_cast(x); } -static inline ze_moved_querying_subscriber_t* ze_querying_subscriber_move(ze_owned_querying_subscriber_t* x) { return reinterpret_cast(x); } static inline ze_moved_serializer_t* ze_serializer_move(ze_owned_serializer_t* x) { return reinterpret_cast(x); } -inline const z_loaned_alloc_layout_t* z_loan(const z_owned_alloc_layout_t& this_) { return z_alloc_layout_loan(&this_); }; inline const z_loaned_bytes_t* z_loan(const z_owned_bytes_t& this_) { return z_bytes_loan(&this_); }; inline const z_loaned_bytes_writer_t* z_loan(const z_owned_bytes_writer_t& this_) { return z_bytes_writer_loan(&this_); }; -inline const z_loaned_chunk_alloc_result_t* z_loan(const z_owned_chunk_alloc_result_t& this_) { return z_chunk_alloc_result_loan(&this_); }; inline const z_loaned_closure_hello_t* z_loan(const z_owned_closure_hello_t& closure) { return z_closure_hello_loan(&closure); }; inline const z_loaned_closure_query_t* z_loan(const z_owned_closure_query_t& closure) { return z_closure_query_loan(&closure); }; inline const z_loaned_closure_reply_t* z_loan(const z_owned_closure_reply_t& closure) { return z_closure_reply_loan(&closure); }; inline const z_loaned_closure_sample_t* z_loan(const z_owned_closure_sample_t& closure) { return z_closure_sample_loan(&closure); }; -inline const z_loaned_closure_zid_t* z_loan(const z_owned_closure_zid_t& closure) { return z_closure_zid_loan(&closure); }; inline const z_loaned_condvar_t* z_loan(const z_owned_condvar_t& this_) { return z_condvar_loan(&this_); }; inline const z_loaned_config_t* z_loan(const z_owned_config_t& this_) { return z_config_loan(&this_); }; inline const z_loaned_encoding_t* z_loan(const z_owned_encoding_t& this_) { return z_encoding_loan(&this_); }; @@ -561,7 +407,6 @@ inline const z_loaned_fifo_handler_reply_t* z_loan(const z_owned_fifo_handler_re inline const z_loaned_fifo_handler_sample_t* z_loan(const z_owned_fifo_handler_sample_t& this_) { return z_fifo_handler_sample_loan(&this_); }; inline const z_loaned_hello_t* z_loan(const z_owned_hello_t& this_) { return z_hello_loan(&this_); }; inline const z_loaned_keyexpr_t* z_loan(const z_owned_keyexpr_t& this_) { return z_keyexpr_loan(&this_); }; -inline const z_loaned_memory_layout_t* z_loan(const z_owned_memory_layout_t& this_) { return z_memory_layout_loan(&this_); }; inline const z_loaned_publisher_t* z_loan(const z_owned_publisher_t& this_) { return z_publisher_loan(&this_); }; inline const z_loaned_query_t* z_loan(const z_owned_query_t& this_) { return z_query_loan(&this_); }; inline const z_loaned_queryable_t* z_loan(const z_owned_queryable_t& this_) { return z_queryable_loan(&this_); }; @@ -572,12 +417,7 @@ inline const z_loaned_ring_handler_reply_t* z_loan(const z_owned_ring_handler_re inline const z_loaned_ring_handler_sample_t* z_loan(const z_owned_ring_handler_sample_t& this_) { return z_ring_handler_sample_loan(&this_); }; inline const z_loaned_sample_t* z_loan(const z_owned_sample_t& this_) { return z_sample_loan(&this_); }; inline const z_loaned_session_t* z_loan(const z_owned_session_t& this_) { return z_session_loan(&this_); }; -inline const z_loaned_shm_client_storage_t* z_loan(const z_owned_shm_client_storage_t& this_) { return z_shm_client_storage_loan(&this_); }; -inline const z_loaned_shm_t* z_loan(const z_owned_shm_t& this_) { return z_shm_loan(&this_); }; -inline const z_loaned_shm_mut_t* z_loan(const z_owned_shm_mut_t& this_) { return z_shm_mut_loan(&this_); }; -inline const z_loaned_shm_provider_t* z_loan(const z_owned_shm_provider_t& this_) { return z_shm_provider_loan(&this_); }; inline const z_loaned_slice_t* z_loan(const z_owned_slice_t& this_) { return z_slice_loan(&this_); }; -inline const z_loaned_source_info_t* z_loan(const z_owned_source_info_t& this_) { return z_source_info_loan(&this_); }; inline const z_loaned_string_array_t* z_loan(const z_owned_string_array_t& this_) { return z_string_array_loan(&this_); }; inline const z_loaned_string_t* z_loan(const z_owned_string_t& this_) { return z_string_loan(&this_); }; inline const z_loaned_subscriber_t* z_loan(const z_owned_subscriber_t& this_) { return z_subscriber_loan(&this_); }; @@ -585,11 +425,6 @@ inline const z_loaned_keyexpr_t* z_loan(const z_view_keyexpr_t& this_) { return inline const z_loaned_slice_t* z_loan(const z_view_slice_t& this_) { return z_view_slice_loan(&this_); }; inline const z_loaned_string_t* z_loan(const z_view_string_t& this_) { return z_view_string_loan(&this_); }; inline const zc_loaned_closure_log_t* z_loan(const zc_owned_closure_log_t& closure) { return zc_closure_log_loan(&closure); }; -inline const zc_loaned_closure_matching_status_t* z_loan(const zc_owned_closure_matching_status_t& closure) { return zc_closure_matching_status_loan(&closure); }; -inline const zc_loaned_liveliness_token_t* z_loan(const zc_owned_liveliness_token_t& this_) { return zc_liveliness_token_loan(&this_); }; -inline const zc_loaned_shm_client_list_t* z_loan(const zc_owned_shm_client_list_t& this_) { return zc_shm_client_list_loan(&this_); }; -inline const ze_loaned_publication_cache_t* z_loan(const ze_owned_publication_cache_t& this_) { return ze_publication_cache_loan(&this_); }; -inline const ze_loaned_querying_subscriber_t* z_loan(const ze_owned_querying_subscriber_t& this_) { return ze_querying_subscriber_loan(&this_); }; inline const ze_loaned_serializer_t* z_loan(const ze_owned_serializer_t& this_) { return ze_serializer_loan(&this_); }; @@ -601,22 +436,16 @@ inline z_loaned_encoding_t* z_loan_mut(z_owned_encoding_t& this_) { return z_enc inline z_loaned_mutex_t* z_loan_mut(z_owned_mutex_t& this_) { return z_mutex_loan_mut(&this_); }; inline z_loaned_publisher_t* z_loan_mut(z_owned_publisher_t& this_) { return z_publisher_loan_mut(&this_); }; inline z_loaned_session_t* z_loan_mut(z_owned_session_t& this_) { return z_session_loan_mut(&this_); }; -inline z_loaned_shm_t* z_loan_mut(z_owned_shm_t& this_) { return z_shm_loan_mut(&this_); }; -inline z_loaned_shm_mut_t* z_loan_mut(z_owned_shm_mut_t& this_) { return z_shm_mut_loan_mut(&this_); }; inline z_loaned_string_array_t* z_loan_mut(z_owned_string_array_t& this_) { return z_string_array_loan_mut(&this_); }; -inline zc_loaned_shm_client_list_t* z_loan_mut(zc_owned_shm_client_list_t& this_) { return zc_shm_client_list_loan_mut(&this_); }; inline ze_loaned_serializer_t* z_loan_mut(ze_owned_serializer_t& this_) { return ze_serializer_loan_mut(&this_); }; -inline void z_drop(z_moved_alloc_layout_t* this_) { z_alloc_layout_drop(this_); }; inline void z_drop(z_moved_bytes_t* this_) { z_bytes_drop(this_); }; inline void z_drop(z_moved_bytes_writer_t* this_) { z_bytes_writer_drop(this_); }; -inline void z_drop(z_moved_chunk_alloc_result_t* this_) { z_chunk_alloc_result_drop(this_); }; inline void z_drop(z_moved_closure_hello_t* this_) { z_closure_hello_drop(this_); }; inline void z_drop(z_moved_closure_query_t* closure_) { z_closure_query_drop(closure_); }; inline void z_drop(z_moved_closure_reply_t* closure_) { z_closure_reply_drop(closure_); }; inline void z_drop(z_moved_closure_sample_t* closure_) { z_closure_sample_drop(closure_); }; -inline void z_drop(z_moved_closure_zid_t* closure_) { z_closure_zid_drop(closure_); }; inline void z_drop(z_moved_condvar_t* this_) { z_condvar_drop(this_); }; inline void z_drop(z_moved_config_t* this_) { z_config_drop(this_); }; inline void z_drop(z_moved_encoding_t* this_) { z_encoding_drop(this_); }; @@ -625,7 +454,6 @@ inline void z_drop(z_moved_fifo_handler_reply_t* this_) { z_fifo_handler_reply_d inline void z_drop(z_moved_fifo_handler_sample_t* this_) { z_fifo_handler_sample_drop(this_); }; inline void z_drop(z_moved_hello_t* this_) { z_hello_drop(this_); }; inline void z_drop(z_moved_keyexpr_t* this_) { z_keyexpr_drop(this_); }; -inline void z_drop(z_moved_memory_layout_t* this_) { z_memory_layout_drop(this_); }; inline void z_drop(z_moved_mutex_t* this_) { z_mutex_drop(this_); }; inline void z_drop(z_moved_publisher_t* this_) { z_publisher_drop(this_); }; inline void z_drop(z_moved_query_t* this_) { z_query_drop(this_); }; @@ -637,36 +465,21 @@ inline void z_drop(z_moved_ring_handler_reply_t* this_) { z_ring_handler_reply_d inline void z_drop(z_moved_ring_handler_sample_t* this_) { z_ring_handler_sample_drop(this_); }; inline void z_drop(z_moved_sample_t* this_) { z_sample_drop(this_); }; inline void z_drop(z_moved_session_t* this_) { z_session_drop(this_); }; -inline void z_drop(z_moved_shm_client_t* this_) { z_shm_client_drop(this_); }; -inline void z_drop(z_moved_shm_client_storage_t* this_) { z_shm_client_storage_drop(this_); }; -inline void z_drop(z_moved_shm_t* this_) { z_shm_drop(this_); }; -inline void z_drop(z_moved_shm_mut_t* this_) { z_shm_mut_drop(this_); }; -inline void z_drop(z_moved_shm_provider_t* this_) { z_shm_provider_drop(this_); }; inline void z_drop(z_moved_slice_t* this_) { z_slice_drop(this_); }; -inline void z_drop(z_moved_source_info_t* this_) { z_source_info_drop(this_); }; inline void z_drop(z_moved_string_array_t* this_) { z_string_array_drop(this_); }; inline void z_drop(z_moved_string_t* this_) { z_string_drop(this_); }; inline void z_drop(z_moved_subscriber_t* this_) { z_subscriber_drop(this_); }; inline void z_drop(z_moved_task_t* this_) { z_task_drop(this_); }; inline void z_drop(zc_moved_closure_log_t* closure_) { zc_closure_log_drop(closure_); }; -inline void z_drop(zc_moved_closure_matching_status_t* closure_) { zc_closure_matching_status_drop(closure_); }; -inline void z_drop(zc_moved_liveliness_token_t* this_) { zc_liveliness_token_drop(this_); }; -inline void z_drop(zc_moved_matching_listener_t* this_) { zc_publisher_matching_listener_drop(this_); }; -inline void z_drop(zc_moved_shm_client_list_t* this_) { zc_shm_client_list_drop(this_); }; -inline void z_drop(ze_moved_publication_cache_t* this_) { ze_publication_cache_drop(this_); }; -inline void z_drop(ze_moved_querying_subscriber_t* this_) { ze_querying_subscriber_drop(this_); }; inline void z_drop(ze_moved_serializer_t* this_) { ze_serializer_drop(this_); }; -inline z_moved_alloc_layout_t* z_move(z_owned_alloc_layout_t& this_) { return z_alloc_layout_move(&this_); }; inline z_moved_bytes_t* z_move(z_owned_bytes_t& this_) { return z_bytes_move(&this_); }; inline z_moved_bytes_writer_t* z_move(z_owned_bytes_writer_t& this_) { return z_bytes_writer_move(&this_); }; -inline z_moved_chunk_alloc_result_t* z_move(z_owned_chunk_alloc_result_t& this_) { return z_chunk_alloc_result_move(&this_); }; inline z_moved_closure_hello_t* z_move(z_owned_closure_hello_t& this_) { return z_closure_hello_move(&this_); }; inline z_moved_closure_query_t* z_move(z_owned_closure_query_t& closure_) { return z_closure_query_move(&closure_); }; inline z_moved_closure_reply_t* z_move(z_owned_closure_reply_t& closure_) { return z_closure_reply_move(&closure_); }; inline z_moved_closure_sample_t* z_move(z_owned_closure_sample_t& closure_) { return z_closure_sample_move(&closure_); }; -inline z_moved_closure_zid_t* z_move(z_owned_closure_zid_t& closure_) { return z_closure_zid_move(&closure_); }; inline z_moved_condvar_t* z_move(z_owned_condvar_t& this_) { return z_condvar_move(&this_); }; inline z_moved_config_t* z_move(z_owned_config_t& this_) { return z_config_move(&this_); }; inline z_moved_encoding_t* z_move(z_owned_encoding_t& this_) { return z_encoding_move(&this_); }; @@ -675,7 +488,6 @@ inline z_moved_fifo_handler_reply_t* z_move(z_owned_fifo_handler_reply_t& this_) inline z_moved_fifo_handler_sample_t* z_move(z_owned_fifo_handler_sample_t& this_) { return z_fifo_handler_sample_move(&this_); }; inline z_moved_hello_t* z_move(z_owned_hello_t& this_) { return z_hello_move(&this_); }; inline z_moved_keyexpr_t* z_move(z_owned_keyexpr_t& this_) { return z_keyexpr_move(&this_); }; -inline z_moved_memory_layout_t* z_move(z_owned_memory_layout_t& this_) { return z_memory_layout_move(&this_); }; inline z_moved_mutex_t* z_move(z_owned_mutex_t& this_) { return z_mutex_move(&this_); }; inline z_moved_publisher_t* z_move(z_owned_publisher_t& this_) { return z_publisher_move(&this_); }; inline z_moved_query_t* z_move(z_owned_query_t& this_) { return z_query_move(&this_); }; @@ -687,36 +499,21 @@ inline z_moved_ring_handler_reply_t* z_move(z_owned_ring_handler_reply_t& this_) inline z_moved_ring_handler_sample_t* z_move(z_owned_ring_handler_sample_t& this_) { return z_ring_handler_sample_move(&this_); }; inline z_moved_sample_t* z_move(z_owned_sample_t& this_) { return z_sample_move(&this_); }; inline z_moved_session_t* z_move(z_owned_session_t& this_) { return z_session_move(&this_); }; -inline z_moved_shm_client_t* z_move(z_owned_shm_client_t& this_) { return z_shm_client_move(&this_); }; -inline z_moved_shm_client_storage_t* z_move(z_owned_shm_client_storage_t& this_) { return z_shm_client_storage_move(&this_); }; -inline z_moved_shm_t* z_move(z_owned_shm_t& this_) { return z_shm_move(&this_); }; -inline z_moved_shm_mut_t* z_move(z_owned_shm_mut_t& this_) { return z_shm_mut_move(&this_); }; -inline z_moved_shm_provider_t* z_move(z_owned_shm_provider_t& this_) { return z_shm_provider_move(&this_); }; inline z_moved_slice_t* z_move(z_owned_slice_t& this_) { return z_slice_move(&this_); }; -inline z_moved_source_info_t* z_move(z_owned_source_info_t& this_) { return z_source_info_move(&this_); }; inline z_moved_string_array_t* z_move(z_owned_string_array_t& this_) { return z_string_array_move(&this_); }; inline z_moved_string_t* z_move(z_owned_string_t& this_) { return z_string_move(&this_); }; inline z_moved_subscriber_t* z_move(z_owned_subscriber_t& this_) { return z_subscriber_move(&this_); }; inline z_moved_task_t* z_move(z_owned_task_t& this_) { return z_task_move(&this_); }; inline zc_moved_closure_log_t* z_move(zc_owned_closure_log_t& closure_) { return zc_closure_log_move(&closure_); }; -inline zc_moved_closure_matching_status_t* z_move(zc_owned_closure_matching_status_t& closure_) { return zc_closure_matching_status_move(&closure_); }; -inline zc_moved_liveliness_token_t* z_move(zc_owned_liveliness_token_t& this_) { return zc_liveliness_token_move(&this_); }; -inline zc_moved_matching_listener_t* z_move(zc_owned_matching_listener_t& this_) { return zc_publisher_matching_listener_move(&this_); }; -inline zc_moved_shm_client_list_t* z_move(zc_owned_shm_client_list_t& this_) { return zc_shm_client_list_move(&this_); }; -inline ze_moved_publication_cache_t* z_move(ze_owned_publication_cache_t& this_) { return ze_publication_cache_move(&this_); }; -inline ze_moved_querying_subscriber_t* z_move(ze_owned_querying_subscriber_t& this_) { return ze_querying_subscriber_move(&this_); }; inline ze_moved_serializer_t* z_move(ze_owned_serializer_t& this_) { return ze_serializer_move(&this_); }; -inline void z_internal_null(z_owned_alloc_layout_t* this_) { z_internal_alloc_layout_null(this_); }; inline void z_internal_null(z_owned_bytes_t* this_) { z_internal_bytes_null(this_); }; inline void z_internal_null(z_owned_bytes_writer_t* this_) { z_internal_bytes_writer_null(this_); }; -inline void z_internal_null(z_owned_chunk_alloc_result_t* this_) { z_internal_chunk_alloc_result_null(this_); }; inline void z_internal_null(z_owned_closure_hello_t* this_) { z_internal_closure_hello_null(this_); }; inline void z_internal_null(z_owned_closure_query_t* this_) { z_internal_closure_query_null(this_); }; inline void z_internal_null(z_owned_closure_reply_t* this_) { z_internal_closure_reply_null(this_); }; inline void z_internal_null(z_owned_closure_sample_t* this_) { z_internal_closure_sample_null(this_); }; -inline void z_internal_null(z_owned_closure_zid_t* this_) { z_internal_closure_zid_null(this_); }; inline void z_internal_null(z_owned_condvar_t* this_) { z_internal_condvar_null(this_); }; inline void z_internal_null(z_owned_config_t* this_) { z_internal_config_null(this_); }; inline void z_internal_null(z_owned_encoding_t* this_) { z_internal_encoding_null(this_); }; @@ -725,7 +522,6 @@ inline void z_internal_null(z_owned_fifo_handler_reply_t* this_) { z_internal_fi inline void z_internal_null(z_owned_fifo_handler_sample_t* this_) { z_internal_fifo_handler_sample_null(this_); }; inline void z_internal_null(z_owned_hello_t* this_) { z_internal_hello_null(this_); }; inline void z_internal_null(z_owned_keyexpr_t* this_) { z_internal_keyexpr_null(this_); }; -inline void z_internal_null(z_owned_memory_layout_t* this_) { z_internal_memory_layout_null(this_); }; inline void z_internal_null(z_owned_mutex_t* this_) { z_internal_mutex_null(this_); }; inline void z_internal_null(z_owned_publisher_t* this_) { z_internal_publisher_null(this_); }; inline void z_internal_null(z_owned_query_t* this_) { z_internal_query_null(this_); }; @@ -737,35 +533,20 @@ inline void z_internal_null(z_owned_ring_handler_reply_t* this_) { z_internal_ri inline void z_internal_null(z_owned_ring_handler_sample_t* this_) { z_internal_ring_handler_sample_null(this_); }; inline void z_internal_null(z_owned_sample_t* this_) { z_internal_sample_null(this_); }; inline void z_internal_null(z_owned_session_t* this_) { z_internal_session_null(this_); }; -inline void z_internal_null(z_owned_shm_client_t* this_) { z_internal_shm_client_null(this_); }; -inline void z_internal_null(z_owned_shm_client_storage_t* this_) { z_internal_shm_client_storage_null(this_); }; -inline void z_internal_null(z_owned_shm_mut_t* this_) { z_internal_shm_mut_null(this_); }; -inline void z_internal_null(z_owned_shm_t* this_) { z_internal_shm_null(this_); }; -inline void z_internal_null(z_owned_shm_provider_t* this_) { z_internal_shm_provider_null(this_); }; inline void z_internal_null(z_owned_slice_t* this_) { z_internal_slice_null(this_); }; -inline void z_internal_null(z_owned_source_info_t* this_) { z_internal_source_info_null(this_); }; inline void z_internal_null(z_owned_string_array_t* this_) { z_internal_string_array_null(this_); }; inline void z_internal_null(z_owned_string_t* this_) { z_internal_string_null(this_); }; inline void z_internal_null(z_owned_subscriber_t* this_) { z_internal_subscriber_null(this_); }; inline void z_internal_null(z_owned_task_t* this_) { z_internal_task_null(this_); }; inline void z_internal_null(zc_owned_closure_log_t* this_) { zc_internal_closure_log_null(this_); }; -inline void z_internal_null(zc_owned_closure_matching_status_t* this_) { zc_internal_closure_matching_status_null(this_); }; -inline void z_internal_null(zc_owned_liveliness_token_t* this_) { zc_internal_liveliness_token_null(this_); }; -inline void z_internal_null(zc_owned_matching_listener_t* this_) { zc_internal_matching_listener_null(this_); }; -inline void z_internal_null(zc_owned_shm_client_list_t* this_) { zc_internal_shm_client_list_null(this_); }; -inline void z_internal_null(ze_owned_publication_cache_t* this_) { ze_internal_publication_cache_null(this_); }; -inline void z_internal_null(ze_owned_querying_subscriber_t* this_) { ze_internal_querying_subscriber_null(this_); }; inline void z_internal_null(ze_owned_serializer_t* this_) { ze_internal_serializer_null(this_); }; -static inline void z_alloc_layout_take(z_owned_alloc_layout_t* this_, z_moved_alloc_layout_t* x) { *this_ = x->_this; z_internal_alloc_layout_null(&x->_this); } static inline void z_bytes_take(z_owned_bytes_t* this_, z_moved_bytes_t* x) { *this_ = x->_this; z_internal_bytes_null(&x->_this); } static inline void z_bytes_writer_take(z_owned_bytes_writer_t* this_, z_moved_bytes_writer_t* x) { *this_ = x->_this; z_internal_bytes_writer_null(&x->_this); } -static inline void z_chunk_alloc_result_take(z_owned_chunk_alloc_result_t* this_, z_moved_chunk_alloc_result_t* x) { *this_ = x->_this; z_internal_chunk_alloc_result_null(&x->_this); } static inline void z_closure_hello_take(z_owned_closure_hello_t* this_, z_moved_closure_hello_t* x) { *this_ = x->_this; z_internal_closure_hello_null(&x->_this); } static inline void z_closure_query_take(z_owned_closure_query_t* closure_, z_moved_closure_query_t* x) { *closure_ = x->_this; z_internal_closure_query_null(&x->_this); } static inline void z_closure_reply_take(z_owned_closure_reply_t* closure_, z_moved_closure_reply_t* x) { *closure_ = x->_this; z_internal_closure_reply_null(&x->_this); } static inline void z_closure_sample_take(z_owned_closure_sample_t* closure_, z_moved_closure_sample_t* x) { *closure_ = x->_this; z_internal_closure_sample_null(&x->_this); } -static inline void z_closure_zid_take(z_owned_closure_zid_t* closure_, z_moved_closure_zid_t* x) { *closure_ = x->_this; z_internal_closure_zid_null(&x->_this); } static inline void z_condvar_take(z_owned_condvar_t* this_, z_moved_condvar_t* x) { *this_ = x->_this; z_internal_condvar_null(&x->_this); } static inline void z_config_take(z_owned_config_t* this_, z_moved_config_t* x) { *this_ = x->_this; z_internal_config_null(&x->_this); } static inline void z_encoding_take(z_owned_encoding_t* this_, z_moved_encoding_t* x) { *this_ = x->_this; z_internal_encoding_null(&x->_this); } @@ -774,7 +555,6 @@ static inline void z_fifo_handler_reply_take(z_owned_fifo_handler_reply_t* this_ static inline void z_fifo_handler_sample_take(z_owned_fifo_handler_sample_t* this_, z_moved_fifo_handler_sample_t* x) { *this_ = x->_this; z_internal_fifo_handler_sample_null(&x->_this); } static inline void z_hello_take(z_owned_hello_t* this_, z_moved_hello_t* x) { *this_ = x->_this; z_internal_hello_null(&x->_this); } static inline void z_keyexpr_take(z_owned_keyexpr_t* this_, z_moved_keyexpr_t* x) { *this_ = x->_this; z_internal_keyexpr_null(&x->_this); } -static inline void z_memory_layout_take(z_owned_memory_layout_t* this_, z_moved_memory_layout_t* x) { *this_ = x->_this; z_internal_memory_layout_null(&x->_this); } static inline void z_mutex_take(z_owned_mutex_t* this_, z_moved_mutex_t* x) { *this_ = x->_this; z_internal_mutex_null(&x->_this); } static inline void z_publisher_take(z_owned_publisher_t* this_, z_moved_publisher_t* x) { *this_ = x->_this; z_internal_publisher_null(&x->_this); } static inline void z_query_take(z_owned_query_t* this_, z_moved_query_t* x) { *this_ = x->_this; z_internal_query_null(&x->_this); } @@ -786,40 +566,22 @@ static inline void z_ring_handler_reply_take(z_owned_ring_handler_reply_t* this_ static inline void z_ring_handler_sample_take(z_owned_ring_handler_sample_t* this_, z_moved_ring_handler_sample_t* x) { *this_ = x->_this; z_internal_ring_handler_sample_null(&x->_this); } static inline void z_sample_take(z_owned_sample_t* this_, z_moved_sample_t* x) { *this_ = x->_this; z_internal_sample_null(&x->_this); } static inline void z_session_take(z_owned_session_t* this_, z_moved_session_t* x) { *this_ = x->_this; z_internal_session_null(&x->_this); } -static inline void z_shm_client_take(z_owned_shm_client_t* this_, z_moved_shm_client_t* x) { *this_ = x->_this; z_internal_shm_client_null(&x->_this); } -static inline void z_shm_client_storage_take(z_owned_shm_client_storage_t* this_, z_moved_shm_client_storage_t* x) { *this_ = x->_this; z_internal_shm_client_storage_null(&x->_this); } -static inline void z_shm_take(z_owned_shm_t* this_, z_moved_shm_t* x) { *this_ = x->_this; z_internal_shm_null(&x->_this); } -static inline void z_shm_mut_take(z_owned_shm_mut_t* this_, z_moved_shm_mut_t* x) { *this_ = x->_this; z_internal_shm_mut_null(&x->_this); } -static inline void z_shm_provider_take(z_owned_shm_provider_t* this_, z_moved_shm_provider_t* x) { *this_ = x->_this; z_internal_shm_provider_null(&x->_this); } static inline void z_slice_take(z_owned_slice_t* this_, z_moved_slice_t* x) { *this_ = x->_this; z_internal_slice_null(&x->_this); } -static inline void z_source_info_take(z_owned_source_info_t* this_, z_moved_source_info_t* x) { *this_ = x->_this; z_internal_source_info_null(&x->_this); } static inline void z_string_array_take(z_owned_string_array_t* this_, z_moved_string_array_t* x) { *this_ = x->_this; z_internal_string_array_null(&x->_this); } static inline void z_string_take(z_owned_string_t* this_, z_moved_string_t* x) { *this_ = x->_this; z_internal_string_null(&x->_this); } static inline void z_subscriber_take(z_owned_subscriber_t* this_, z_moved_subscriber_t* x) { *this_ = x->_this; z_internal_subscriber_null(&x->_this); } static inline void z_task_take(z_owned_task_t* this_, z_moved_task_t* x) { *this_ = x->_this; z_internal_task_null(&x->_this); } static inline void zc_closure_log_take(zc_owned_closure_log_t* closure_, zc_moved_closure_log_t* x) { *closure_ = x->_this; zc_internal_closure_log_null(&x->_this); } -static inline void zc_closure_matching_status_take(zc_owned_closure_matching_status_t* closure_, zc_moved_closure_matching_status_t* x) { *closure_ = x->_this; zc_internal_closure_matching_status_null(&x->_this); } -static inline void zc_liveliness_token_take(zc_owned_liveliness_token_t* this_, zc_moved_liveliness_token_t* x) { *this_ = x->_this; zc_internal_liveliness_token_null(&x->_this); } -static inline void zc_publisher_matching_listener_take(zc_owned_matching_listener_t* this_, zc_moved_matching_listener_t* x) { *this_ = x->_this; zc_internal_matching_listener_null(&x->_this); } -static inline void zc_shm_client_list_take(zc_owned_shm_client_list_t* this_, zc_moved_shm_client_list_t* x) { *this_ = x->_this; zc_internal_shm_client_list_null(&x->_this); } -static inline void ze_publication_cache_take(ze_owned_publication_cache_t* this_, ze_moved_publication_cache_t* x) { *this_ = x->_this; ze_internal_publication_cache_null(&x->_this); } -static inline void ze_querying_subscriber_take(ze_owned_querying_subscriber_t* this_, ze_moved_querying_subscriber_t* x) { *this_ = x->_this; ze_internal_querying_subscriber_null(&x->_this); } static inline void ze_serializer_take(ze_owned_serializer_t* this_, ze_moved_serializer_t* x) { *this_ = x->_this; ze_internal_serializer_null(&x->_this); } -inline void z_take(z_owned_alloc_layout_t* this_, z_moved_alloc_layout_t* x) { - z_alloc_layout_take(this_, x); -}; inline void z_take(z_owned_bytes_t* this_, z_moved_bytes_t* x) { z_bytes_take(this_, x); }; inline void z_take(z_owned_bytes_writer_t* this_, z_moved_bytes_writer_t* x) { z_bytes_writer_take(this_, x); }; -inline void z_take(z_owned_chunk_alloc_result_t* this_, z_moved_chunk_alloc_result_t* x) { - z_chunk_alloc_result_take(this_, x); -}; inline void z_take(z_owned_closure_hello_t* this_, z_moved_closure_hello_t* x) { z_closure_hello_take(this_, x); }; @@ -832,9 +594,6 @@ inline void z_take(z_owned_closure_reply_t* closure_, z_moved_closure_reply_t* x inline void z_take(z_owned_closure_sample_t* closure_, z_moved_closure_sample_t* x) { z_closure_sample_take(closure_, x); }; -inline void z_take(z_owned_closure_zid_t* closure_, z_moved_closure_zid_t* x) { - z_closure_zid_take(closure_, x); -}; inline void z_take(z_owned_condvar_t* this_, z_moved_condvar_t* x) { z_condvar_take(this_, x); }; @@ -859,9 +618,6 @@ inline void z_take(z_owned_hello_t* this_, z_moved_hello_t* x) { inline void z_take(z_owned_keyexpr_t* this_, z_moved_keyexpr_t* x) { z_keyexpr_take(this_, x); }; -inline void z_take(z_owned_memory_layout_t* this_, z_moved_memory_layout_t* x) { - z_memory_layout_take(this_, x); -}; inline void z_take(z_owned_mutex_t* this_, z_moved_mutex_t* x) { z_mutex_take(this_, x); }; @@ -895,27 +651,9 @@ inline void z_take(z_owned_sample_t* this_, z_moved_sample_t* x) { inline void z_take(z_owned_session_t* this_, z_moved_session_t* x) { z_session_take(this_, x); }; -inline void z_take(z_owned_shm_client_t* this_, z_moved_shm_client_t* x) { - z_shm_client_take(this_, x); -}; -inline void z_take(z_owned_shm_client_storage_t* this_, z_moved_shm_client_storage_t* x) { - z_shm_client_storage_take(this_, x); -}; -inline void z_take(z_owned_shm_t* this_, z_moved_shm_t* x) { - z_shm_take(this_, x); -}; -inline void z_take(z_owned_shm_mut_t* this_, z_moved_shm_mut_t* x) { - z_shm_mut_take(this_, x); -}; -inline void z_take(z_owned_shm_provider_t* this_, z_moved_shm_provider_t* x) { - z_shm_provider_take(this_, x); -}; inline void z_take(z_owned_slice_t* this_, z_moved_slice_t* x) { z_slice_take(this_, x); }; -inline void z_take(z_owned_source_info_t* this_, z_moved_source_info_t* x) { - z_source_info_take(this_, x); -}; inline void z_take(z_owned_string_array_t* this_, z_moved_string_array_t* x) { z_string_array_take(this_, x); }; @@ -931,38 +669,17 @@ inline void z_take(z_owned_task_t* this_, z_moved_task_t* x) { inline void z_take(zc_owned_closure_log_t* closure_, zc_moved_closure_log_t* x) { zc_closure_log_take(closure_, x); }; -inline void z_take(zc_owned_closure_matching_status_t* closure_, zc_moved_closure_matching_status_t* x) { - zc_closure_matching_status_take(closure_, x); -}; -inline void z_take(zc_owned_liveliness_token_t* this_, zc_moved_liveliness_token_t* x) { - zc_liveliness_token_take(this_, x); -}; -inline void z_take(zc_owned_matching_listener_t* this_, zc_moved_matching_listener_t* x) { - zc_publisher_matching_listener_take(this_, x); -}; -inline void z_take(zc_owned_shm_client_list_t* this_, zc_moved_shm_client_list_t* x) { - zc_shm_client_list_take(this_, x); -}; -inline void z_take(ze_owned_publication_cache_t* this_, ze_moved_publication_cache_t* x) { - ze_publication_cache_take(this_, x); -}; -inline void z_take(ze_owned_querying_subscriber_t* this_, ze_moved_querying_subscriber_t* x) { - ze_querying_subscriber_take(this_, x); -}; inline void z_take(ze_owned_serializer_t* this_, ze_moved_serializer_t* x) { ze_serializer_take(this_, x); }; -inline bool z_internal_check(const z_owned_alloc_layout_t& this_) { return z_internal_alloc_layout_check(&this_); }; inline bool z_internal_check(const z_owned_bytes_t& this_) { return z_internal_bytes_check(&this_); }; inline bool z_internal_check(const z_owned_bytes_writer_t& this_) { return z_internal_bytes_writer_check(&this_); }; -inline bool z_internal_check(const z_owned_chunk_alloc_result_t& this_) { return z_internal_chunk_alloc_result_check(&this_); }; inline bool z_internal_check(const z_owned_closure_hello_t& this_) { return z_internal_closure_hello_check(&this_); }; inline bool z_internal_check(const z_owned_closure_query_t& this_) { return z_internal_closure_query_check(&this_); }; inline bool z_internal_check(const z_owned_closure_reply_t& this_) { return z_internal_closure_reply_check(&this_); }; inline bool z_internal_check(const z_owned_closure_sample_t& this_) { return z_internal_closure_sample_check(&this_); }; -inline bool z_internal_check(const z_owned_closure_zid_t& this_) { return z_internal_closure_zid_check(&this_); }; inline bool z_internal_check(const z_owned_condvar_t& this_) { return z_internal_condvar_check(&this_); }; inline bool z_internal_check(const z_owned_config_t& this_) { return z_internal_config_check(&this_); }; inline bool z_internal_check(const z_owned_encoding_t& this_) { return z_internal_encoding_check(&this_); }; @@ -971,7 +688,6 @@ inline bool z_internal_check(const z_owned_fifo_handler_reply_t& this_) { return inline bool z_internal_check(const z_owned_fifo_handler_sample_t& this_) { return z_internal_fifo_handler_sample_check(&this_); }; inline bool z_internal_check(const z_owned_hello_t& this_) { return z_internal_hello_check(&this_); }; inline bool z_internal_check(const z_owned_keyexpr_t& this_) { return z_internal_keyexpr_check(&this_); }; -inline bool z_internal_check(const z_owned_memory_layout_t& this_) { return z_internal_memory_layout_check(&this_); }; inline bool z_internal_check(const z_owned_mutex_t& this_) { return z_internal_mutex_check(&this_); }; inline bool z_internal_check(const z_owned_publisher_t& this_) { return z_internal_publisher_check(&this_); }; inline bool z_internal_check(const z_owned_query_t& query) { return z_internal_query_check(&query); }; @@ -983,24 +699,12 @@ inline bool z_internal_check(const z_owned_ring_handler_reply_t& this_) { return inline bool z_internal_check(const z_owned_ring_handler_sample_t& this_) { return z_internal_ring_handler_sample_check(&this_); }; inline bool z_internal_check(const z_owned_sample_t& this_) { return z_internal_sample_check(&this_); }; inline bool z_internal_check(const z_owned_session_t& this_) { return z_internal_session_check(&this_); }; -inline bool z_internal_check(const z_owned_shm_t& this_) { return z_internal_shm_check(&this_); }; -inline bool z_internal_check(const z_owned_shm_client_t& this_) { return z_internal_shm_client_check(&this_); }; -inline bool z_internal_check(const z_owned_shm_client_storage_t& this_) { return z_internal_shm_client_storage_check(&this_); }; -inline bool z_internal_check(const z_owned_shm_mut_t& this_) { return z_internal_shm_mut_check(&this_); }; -inline bool z_internal_check(const z_owned_shm_provider_t& this_) { return z_internal_shm_provider_check(&this_); }; inline bool z_internal_check(const z_owned_slice_t& this_) { return z_internal_slice_check(&this_); }; -inline bool z_internal_check(const z_owned_source_info_t& this_) { return z_internal_source_info_check(&this_); }; inline bool z_internal_check(const z_owned_string_array_t& this_) { return z_internal_string_array_check(&this_); }; inline bool z_internal_check(const z_owned_string_t& this_) { return z_internal_string_check(&this_); }; inline bool z_internal_check(const z_owned_subscriber_t& this_) { return z_internal_subscriber_check(&this_); }; inline bool z_internal_check(const z_owned_task_t& this_) { return z_internal_task_check(&this_); }; inline bool z_internal_check(const zc_owned_closure_log_t& this_) { return zc_internal_closure_log_check(&this_); }; -inline bool z_internal_check(const zc_owned_closure_matching_status_t& this_) { return zc_internal_closure_matching_status_check(&this_); }; -inline bool z_internal_check(const zc_owned_liveliness_token_t& this_) { return zc_internal_liveliness_token_check(&this_); }; -inline bool z_internal_check(const zc_owned_matching_listener_t& this_) { return zc_internal_matching_listener_check(&this_); }; -inline bool z_internal_check(const zc_owned_shm_client_list_t& this_) { return zc_internal_shm_client_list_check(&this_); }; -inline bool z_internal_check(const ze_owned_publication_cache_t& this_) { return ze_internal_publication_cache_check(&this_); }; -inline bool z_internal_check(const ze_owned_querying_subscriber_t& this_) { return ze_internal_querying_subscriber_check(&this_); }; inline bool z_internal_check(const ze_owned_serializer_t& this_) { return ze_internal_serializer_check(&this_); }; @@ -1016,21 +720,13 @@ inline void z_call(const z_loaned_closure_reply_t* closure, z_loaned_reply_t* re inline void z_call(const z_loaned_closure_sample_t* closure, z_loaned_sample_t* sample) { z_closure_sample_call(closure, sample); }; -inline void z_call(const z_loaned_closure_zid_t* closure, const z_id_t* z_id) { - z_closure_zid_call(closure, z_id); -}; -inline void z_call(const zc_loaned_closure_matching_status_t* closure, const zc_matching_status_t* mathing_status) { - zc_closure_matching_status_call(closure, mathing_status); -}; extern "C" using z_closure_drop_callback_t = void(void* context); extern "C" using z_closure_hello_callabck_t = void(z_loaned_hello_t *hello, void *context); extern "C" using z_closure_query_callabck_t = void(z_loaned_query_t *query, void *context); extern "C" using z_closure_reply_callabck_t = void(z_loaned_reply_t *reply, void *context); extern "C" using z_closure_sample_callabck_t = void(z_loaned_sample_t *sample, void *context); -extern "C" using z_closure_zid_callabck_t = void(const z_id_t *z_id, void *context); extern "C" using zc_closure_log_callabck_t = void(zc_log_severity_t severity, const z_loaned_string_t *msg, void *context); -extern "C" using zc_closure_matching_status_callabck_t = void(const zc_matching_status_t *matching_status, void *context); inline void z_closure(z_owned_closure_hello_t* this_, z_closure_hello_callabck_t* call, z_closure_drop_callback_t* drop, void* context) { @@ -1048,18 +744,10 @@ inline void z_closure(z_owned_closure_sample_t* this_, z_closure_sample_callabck z_closure_drop_callback_t* drop, void* context) { z_closure_sample(this_, call, drop, context); }; -inline void z_closure(z_owned_closure_zid_t* this_, z_closure_zid_callabck_t* call, - z_closure_drop_callback_t* drop, void* context) { - z_closure_zid(this_, call, drop, context); -}; inline void z_closure(zc_owned_closure_log_t* this_, zc_closure_log_callabck_t* call, z_closure_drop_callback_t* drop, void* context) { zc_closure_log(this_, call, drop, context); }; -inline void z_closure(zc_owned_closure_matching_status_t* this_, zc_closure_matching_status_callabck_t* call, - z_closure_drop_callback_t* drop, void* context) { - zc_closure_matching_status(this_, call, drop, context); -}; inline z_result_t z_try_recv(const z_loaned_fifo_handler_query_t* this_, z_owned_query_t* query) { @@ -1129,12 +817,6 @@ inline void z_clone(z_owned_reply_err_t* dst, z_loaned_reply_err_t* this_) { inline void z_clone(z_owned_sample_t* dst, z_loaned_sample_t* this_) { z_sample_clone(dst, this_); }; -inline void z_clone(z_owned_shm_client_storage_t* this_, z_loaned_shm_client_storage_t* from) { - z_shm_client_storage_clone(this_, from); -}; -inline void z_clone(z_owned_shm_t* out, z_loaned_shm_t* this_) { - z_shm_clone(out, this_); -}; inline void z_clone(z_owned_slice_t* dst, z_loaned_slice_t* this_) { z_slice_clone(dst, this_); }; @@ -1147,14 +829,10 @@ inline void z_clone(z_owned_string_t* dst, z_loaned_string_t* this_) { template struct z_loaned_to_owned_type_t {}; template struct z_owned_to_loaned_type_t {}; -template<> struct z_loaned_to_owned_type_t { typedef z_owned_alloc_layout_t type; }; -template<> struct z_owned_to_loaned_type_t { typedef z_loaned_alloc_layout_t type; }; template<> struct z_loaned_to_owned_type_t { typedef z_owned_bytes_t type; }; template<> struct z_owned_to_loaned_type_t { typedef z_loaned_bytes_t type; }; template<> struct z_loaned_to_owned_type_t { typedef z_owned_bytes_writer_t type; }; template<> struct z_owned_to_loaned_type_t { typedef z_loaned_bytes_writer_t type; }; -template<> struct z_loaned_to_owned_type_t { typedef z_owned_chunk_alloc_result_t type; }; -template<> struct z_owned_to_loaned_type_t { typedef z_loaned_chunk_alloc_result_t type; }; template<> struct z_loaned_to_owned_type_t { typedef z_owned_closure_hello_t type; }; template<> struct z_owned_to_loaned_type_t { typedef z_loaned_closure_hello_t type; }; template<> struct z_loaned_to_owned_type_t { typedef z_owned_closure_query_t type; }; @@ -1163,8 +841,6 @@ template<> struct z_loaned_to_owned_type_t { typedef z template<> struct z_owned_to_loaned_type_t { typedef z_loaned_closure_reply_t type; }; template<> struct z_loaned_to_owned_type_t { typedef z_owned_closure_sample_t type; }; template<> struct z_owned_to_loaned_type_t { typedef z_loaned_closure_sample_t type; }; -template<> struct z_loaned_to_owned_type_t { typedef z_owned_closure_zid_t type; }; -template<> struct z_owned_to_loaned_type_t { typedef z_loaned_closure_zid_t type; }; template<> struct z_loaned_to_owned_type_t { typedef z_owned_condvar_t type; }; template<> struct z_owned_to_loaned_type_t { typedef z_loaned_condvar_t type; }; template<> struct z_loaned_to_owned_type_t { typedef z_owned_config_t type; }; @@ -1181,8 +857,6 @@ template<> struct z_loaned_to_owned_type_t { typedef z_owned_h template<> struct z_owned_to_loaned_type_t { typedef z_loaned_hello_t type; }; template<> struct z_loaned_to_owned_type_t { typedef z_owned_keyexpr_t type; }; template<> struct z_owned_to_loaned_type_t { typedef z_loaned_keyexpr_t type; }; -template<> struct z_loaned_to_owned_type_t { typedef z_owned_memory_layout_t type; }; -template<> struct z_owned_to_loaned_type_t { typedef z_loaned_memory_layout_t type; }; template<> struct z_loaned_to_owned_type_t { typedef z_owned_publisher_t type; }; template<> struct z_owned_to_loaned_type_t { typedef z_loaned_publisher_t type; }; template<> struct z_loaned_to_owned_type_t { typedef z_owned_query_t type; }; @@ -1203,18 +877,8 @@ template<> struct z_loaned_to_owned_type_t { typedef z_owned_ template<> struct z_owned_to_loaned_type_t { typedef z_loaned_sample_t type; }; template<> struct z_loaned_to_owned_type_t { typedef z_owned_session_t type; }; template<> struct z_owned_to_loaned_type_t { typedef z_loaned_session_t type; }; -template<> struct z_loaned_to_owned_type_t { typedef z_owned_shm_client_storage_t type; }; -template<> struct z_owned_to_loaned_type_t { typedef z_loaned_shm_client_storage_t type; }; -template<> struct z_loaned_to_owned_type_t { typedef z_owned_shm_t type; }; -template<> struct z_owned_to_loaned_type_t { typedef z_loaned_shm_t type; }; -template<> struct z_loaned_to_owned_type_t { typedef z_owned_shm_mut_t type; }; -template<> struct z_owned_to_loaned_type_t { typedef z_loaned_shm_mut_t type; }; -template<> struct z_loaned_to_owned_type_t { typedef z_owned_shm_provider_t type; }; -template<> struct z_owned_to_loaned_type_t { typedef z_loaned_shm_provider_t type; }; template<> struct z_loaned_to_owned_type_t { typedef z_owned_slice_t type; }; template<> struct z_owned_to_loaned_type_t { typedef z_loaned_slice_t type; }; -template<> struct z_loaned_to_owned_type_t { typedef z_owned_source_info_t type; }; -template<> struct z_owned_to_loaned_type_t { typedef z_loaned_source_info_t type; }; template<> struct z_loaned_to_owned_type_t { typedef z_owned_string_array_t type; }; template<> struct z_owned_to_loaned_type_t { typedef z_loaned_string_array_t type; }; template<> struct z_loaned_to_owned_type_t { typedef z_owned_string_t type; }; @@ -1223,16 +887,6 @@ template<> struct z_loaned_to_owned_type_t { typedef z_ow template<> struct z_owned_to_loaned_type_t { typedef z_loaned_subscriber_t type; }; template<> struct z_loaned_to_owned_type_t { typedef zc_owned_closure_log_t type; }; template<> struct z_owned_to_loaned_type_t { typedef zc_loaned_closure_log_t type; }; -template<> struct z_loaned_to_owned_type_t { typedef zc_owned_closure_matching_status_t type; }; -template<> struct z_owned_to_loaned_type_t { typedef zc_loaned_closure_matching_status_t type; }; -template<> struct z_loaned_to_owned_type_t { typedef zc_owned_liveliness_token_t type; }; -template<> struct z_owned_to_loaned_type_t { typedef zc_loaned_liveliness_token_t type; }; -template<> struct z_loaned_to_owned_type_t { typedef zc_owned_shm_client_list_t type; }; -template<> struct z_owned_to_loaned_type_t { typedef zc_loaned_shm_client_list_t type; }; -template<> struct z_loaned_to_owned_type_t { typedef ze_owned_publication_cache_t type; }; -template<> struct z_owned_to_loaned_type_t { typedef ze_loaned_publication_cache_t type; }; -template<> struct z_loaned_to_owned_type_t { typedef ze_owned_querying_subscriber_t type; }; -template<> struct z_owned_to_loaned_type_t { typedef ze_loaned_querying_subscriber_t type; }; template<> struct z_loaned_to_owned_type_t { typedef ze_owned_serializer_t type; }; template<> struct z_owned_to_loaned_type_t { typedef ze_loaned_serializer_t type; }; template<> struct z_loaned_to_owned_type_t { typedef z_owned_mutex_t type; }; diff --git a/src/keyexpr.rs b/src/keyexpr.rs index ad26cf9b3..651cecd67 100644 --- a/src/keyexpr.rs +++ b/src/keyexpr.rs @@ -460,17 +460,17 @@ pub unsafe extern "C" fn z_keyexpr_as_view_string( /// Constructs and declares a key expression on the network. This reduces key key expression to a numerical id, /// which allows to save the bandwith, when passing key expression between Zenoh entities. /// -/// @param this_: An uninitialized location in memory where key expression will be constructed. /// @param session: Session on which to declare key expression. +/// @param declared_key_expr: An uninitialized location in memory where key expression will be constructed. /// @param key_expr: Key expression to declare on network. /// @return 0 in case of success, negative error code otherwise. #[no_mangle] pub extern "C" fn z_declare_keyexpr( - this: &mut MaybeUninit, session: &z_loaned_session_t, + declared_key_expr: &mut MaybeUninit, key_expr: &z_loaned_keyexpr_t, ) -> z_result_t { - let this = this.as_rust_type_mut_uninit(); + let this = declared_key_expr.as_rust_type_mut_uninit(); let key_expr = key_expr.as_rust_type_ref(); let session = session.as_rust_type_ref(); match session.declare_keyexpr(key_expr).wait() { @@ -491,10 +491,10 @@ pub extern "C" fn z_declare_keyexpr( /// @return 0 in case of success, negative error code otherwise. #[no_mangle] pub extern "C" fn z_undeclare_keyexpr( - this: &mut z_moved_keyexpr_t, session: &z_loaned_session_t, + key_expr: &mut z_moved_keyexpr_t, ) -> result::z_result_t { - let Some(kexpr) = this.take_rust_type() else { + let Some(kexpr) = key_expr.take_rust_type() else { tracing::debug!("Attempted to undeclare dropped keyexpr"); return result::Z_EINVAL; }; diff --git a/src/liveliness.rs b/src/liveliness.rs index 76ae3f895..61641ab01 100644 --- a/src/liveliness.rs +++ b/src/liveliness.rs @@ -92,18 +92,18 @@ pub unsafe extern "C" fn zc_liveliness_token_loan( /// Liveliness token subscribers on an intersecting key expression will receive a PUT sample when connectivity /// is achieved, and a DELETE sample if it's lost. /// -/// @param this_: An uninitialized memory location where liveliness token will be constructed. /// @param session: A Zenos session to declare the liveliness token. +/// @param token: An uninitialized memory location where liveliness token will be constructed. /// @param key_expr: A keyexpr to declare a liveliess token for. /// @param _options: Liveliness token declaration properties. #[no_mangle] pub extern "C" fn zc_liveliness_declare_token( - this: &mut MaybeUninit, session: &z_loaned_session_t, + token: &mut MaybeUninit, key_expr: &z_loaned_keyexpr_t, _options: Option<&zc_liveliness_declaration_options_t>, ) -> result::z_result_t { - let this = this.as_rust_type_mut_uninit(); + let this = token.as_rust_type_mut_uninit(); let session = session.as_rust_type_ref(); let key_expr = key_expr.as_rust_type_ref(); match session.liveliness().declare_token(key_expr).wait() { @@ -135,14 +135,14 @@ pub extern "C" fn zc_liveliness_undeclare_token( } /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. -/// @brief The options for `zc_liveliness_subscriber_declare()` +/// @brief The options for `zc_liveliness_declare_subscriber()` #[repr(C)] pub struct zc_liveliness_subscriber_options_t { history: bool, } /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. -/// @brief Constucts default value for `zc_liveliness_subscriber_declare_options_t`. +/// @brief Constucts default value for `zc_liveliness_declare_subscriber_options_t`. #[no_mangle] pub extern "C" fn zc_liveliness_subscriber_options_default( this: &mut MaybeUninit, @@ -177,22 +177,22 @@ fn _liveliness_declare_subscriber_inner<'a, 'b>( /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. /// @brief Declares a subscriber on liveliness tokens that intersect `key_expr`. /// -/// @param this_: An uninitialized memory location where subscriber will be constructed. -/// @param session: The Zenoh session. +/// @param session: A Zenoh session. +/// @param subscriber: An uninitialized memory location where subscriber will be constructed. /// @param key_expr: The key expression to subscribe to. /// @param callback: The callback function that will be called each time a liveliness token status is changed. /// @param options: The options to be passed to the liveliness subscriber declaration. /// /// @return 0 in case of success, negative error values otherwise. #[no_mangle] -pub extern "C" fn zc_liveliness_subscriber_declare( - this: &mut MaybeUninit, +pub extern "C" fn zc_liveliness_declare_subscriber( session: &z_loaned_session_t, + subscriber: &mut MaybeUninit, key_expr: &z_loaned_keyexpr_t, callback: &mut z_moved_closure_sample_t, options: Option<&mut zc_liveliness_subscriber_options_t>, ) -> result::z_result_t { - let this = this.as_rust_type_mut_uninit(); + let this = subscriber.as_rust_type_mut_uninit(); let subscriber = _liveliness_declare_subscriber_inner(session, key_expr, callback, options); match subscriber.wait() { Ok(subscriber) => { @@ -217,7 +217,7 @@ pub extern "C" fn zc_liveliness_subscriber_declare( /// /// @return 0 in case of success, negative error values otherwise. #[no_mangle] -pub extern "C" fn zc_liveliness_subscriber_declare_background( +pub extern "C" fn zc_liveliness_declare_background_subscriber( session: &z_loaned_session_t, key_expr: &z_loaned_keyexpr_t, callback: &mut z_moved_closure_sample_t, diff --git a/src/publication_cache.rs b/src/publication_cache.rs index d689c30f4..5325bb22c 100644 --- a/src/publication_cache.rs +++ b/src/publication_cache.rs @@ -26,7 +26,7 @@ use crate::{ use crate::{zc_locality_default, zc_locality_t}; /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. -/// @brief Options passed to the `ze_publication_cache_declare()` function. +/// @brief Options passed to the `ze_declare_publication_cache()` function. #[repr(C)] pub struct ze_publication_cache_options_t { /// The prefix used for queryable. @@ -98,20 +98,20 @@ fn _declare_publication_cache_inner<'a, 'b, 'c>( /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. /// @brief Constructs and declares a publication cache. /// -/// @param this_: An uninitialized location in memory where publication cache will be constructed. /// @param session: A Zenoh session. +/// @param pub_cache: An uninitialized location in memory where publication cache will be constructed. /// @param key_expr: The key expression to publish to. /// @param options: Additional options for the publication cache. /// /// @returns 0 in case of success, negative error code otherwise. #[no_mangle] -pub extern "C" fn ze_publication_cache_declare( - this: &mut MaybeUninit, +pub extern "C" fn ze_declare_publication_cache( session: &z_loaned_session_t, + pub_cache: &mut MaybeUninit, key_expr: &z_loaned_keyexpr_t, options: Option<&mut ze_publication_cache_options_t>, ) -> result::z_result_t { - let this = this.as_rust_type_mut_uninit(); + let this = pub_cache.as_rust_type_mut_uninit(); let p = _declare_publication_cache_inner(session, key_expr, options); match p.wait() { Ok(publication_cache) => { @@ -135,7 +135,7 @@ pub extern "C" fn ze_publication_cache_declare( /// /// @returns 0 in case of success, negative error code otherwise. #[no_mangle] -pub extern "C" fn ze_publication_cache_declare_background( +pub extern "C" fn ze_declare_background_publication_cache( session: &z_loaned_session_t, key_expr: &z_loaned_keyexpr_t, options: Option<&mut ze_publication_cache_options_t>, @@ -172,6 +172,7 @@ pub extern "C" fn ze_internal_publication_cache_check( /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. /// @brief Drops publication cache and resets it to its gravestone state. +/// This is equivalent to calling `ze_undeclare_publication_cache()` and discarding its return value. #[no_mangle] #[allow(clippy::missing_safety_doc)] pub extern "C" fn ze_publication_cache_drop(this: &mut ze_moved_publication_cache_t) { @@ -200,3 +201,19 @@ pub unsafe extern "C" fn ze_publication_cache_loan( .unwrap_unchecked() .as_loaned_c_type_ref() } + +/// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. +/// @brief Undeclares publication cache. +/// @return 0 in case of success, negative error code otherwise. +#[no_mangle] +pub extern "C" fn ze_undeclare_publication_cache( + this: &mut ze_moved_publication_cache_t, +) -> result::z_result_t { + if let Some(p) = this.take_rust_type() { + if let Err(e) = p.undeclare().wait() { + tracing::error!("{}", e); + return result::Z_EGENERIC; + } + } + result::Z_OK +} diff --git a/src/publisher.rs b/src/publisher.rs index d22bef600..70f8282a2 100644 --- a/src/publisher.rs +++ b/src/publisher.rs @@ -43,7 +43,7 @@ use crate::{ zc_locality_t, }; -/// Options passed to the `z_publisher_declare()` function. +/// Options passed to the `z_declare_publisher()` function. #[repr(C)] pub struct z_publisher_options_t { /// Default encoding for messages put by this publisher. @@ -92,21 +92,21 @@ decl_c_type!( /// Data can be put and deleted with this publisher with the help of the /// `z_publisher_put()` and `z_publisher_delete()` functions. /// -/// @param this_: An unitilized location in memory where publisher will be constructed. /// @param session: The Zenoh session. +/// @param publisher: An unitilized location in memory where publisher will be constructed. /// @param key_expr: The key expression to publish. /// @param options: Additional options for the publisher. /// /// @return 0 in case of success, negative error code otherwise. #[no_mangle] #[allow(clippy::missing_safety_doc)] -pub extern "C" fn z_publisher_declare( - this: &mut MaybeUninit, +pub extern "C" fn z_declare_publisher( session: &z_loaned_session_t, + publisher: &mut MaybeUninit, key_expr: &z_loaned_keyexpr_t, options: Option<&mut z_publisher_options_t>, ) -> result::z_result_t { - let this = this.as_rust_type_mut_uninit(); + let this = publisher.as_rust_type_mut_uninit(); let session = session.as_rust_type_ref(); let key_expr = key_expr.as_rust_type_ref().clone().into_owned(); let mut p = session.declare_publisher(key_expr); @@ -367,18 +367,18 @@ fn _publisher_matching_listener_declare_inner<'a, 'b>( /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. /// @brief Constructs matching listener, registering a callback for notifying subscribers matching with a given publisher. /// -/// @param this_: An unitilized memory location where matching listener will be constructed. The matching listener will be automatically dropped when publisher is dropped. /// @param publisher: A publisher to associate with matching listener. +/// @param matching_listener: An unitilized memory location where matching listener will be constructed. The matching listener will be automatically dropped when publisher is dropped. /// @param callback: A closure that will be called every time the matching status of the publisher changes (If last subscriber, disconnects or when the first subscriber connects). /// /// @return 0 in case of success, negative error code otherwise. #[no_mangle] -pub extern "C" fn zc_publisher_matching_listener_declare( - this: &mut MaybeUninit, +pub extern "C" fn zc_publisher_declare_matching_listener( publisher: &'static z_loaned_publisher_t, + matching_listener: &mut MaybeUninit, callback: &mut zc_moved_closure_matching_status_t, ) -> result::z_result_t { - let this = this.as_rust_type_mut_uninit(); + let this = matching_listener.as_rust_type_mut_uninit(); let listener = _publisher_matching_listener_declare_inner(publisher, callback); match listener.wait() { Ok(listener) => { @@ -403,7 +403,7 @@ pub extern "C" fn zc_publisher_matching_listener_declare( /// /// @return 0 in case of success, negative error code otherwise. #[no_mangle] -pub extern "C" fn zc_publisher_matching_listener_declare_background( +pub extern "C" fn zc_publisher_declare_background_matching_listener( publisher: &'static z_loaned_publisher_t, callback: &mut zc_moved_closure_matching_status_t, ) -> result::z_result_t { @@ -452,8 +452,23 @@ pub extern "C" fn zc_publisher_get_matching_status( } /// Frees memory and resets publisher to its gravestone state. +/// This is equivalent to calling `z_undeclare_publisher()` and discarding its return value. #[no_mangle] #[allow(clippy::missing_safety_doc)] pub extern "C" fn z_publisher_drop(this: &mut z_moved_publisher_t) { std::mem::drop(this.take_rust_type()) } + +#[no_mangle] +/// @brief Undeclares the given publisher. +/// +/// @return 0 in case of success, negative error code otherwise. +pub extern "C" fn z_undeclare_publisher(this_: &mut z_moved_publisher_t) -> result::z_result_t { + if let Some(p) = this_.take_rust_type() { + if let Err(e) = p.undeclare().wait() { + tracing::error!("{}", e); + return result::Z_ENETWORK; + } + } + result::Z_OK +} diff --git a/src/queryable.rs b/src/queryable.rs index d9598c3ae..5a537e1bd 100644 --- a/src/queryable.rs +++ b/src/queryable.rs @@ -96,7 +96,7 @@ pub extern "C" fn z_query_clone(dst: &mut MaybeUninit, this_: & .write(Some(this_.as_rust_type_ref().clone())); } -/// Options passed to the `z_queryable_declare()` function. +/// Options passed to the `z_declare_queryable()` function. #[allow(non_camel_case_types)] #[repr(C)] pub struct z_queryable_options_t { @@ -234,22 +234,22 @@ fn _declare_queryable_inner<'a, 'b>( /// Constructs a Queryable for the given key expression. /// -/// @param this_: An uninitialized memory location where queryable will be constructed. -/// @param session: The zenoh session. +/// @param session: A Zenoh session. +/// @param queryable: An uninitialized memory location where queryable will be constructed. /// @param key_expr: The key expression the Queryable will reply to. /// @param callback: The callback function that will be called each time a matching query is received. Its ownership is passed to queryable. /// @param options: Options for the queryable. /// /// @return 0 in case of success, negative error code otherwise (in this case ) #[no_mangle] -pub extern "C" fn z_queryable_declare( - this: &mut MaybeUninit, +pub extern "C" fn z_declare_queryable( session: &z_loaned_session_t, + queryable: &mut MaybeUninit, key_expr: &z_loaned_keyexpr_t, callback: &mut z_moved_closure_query_t, options: Option<&mut z_queryable_options_t>, ) -> result::z_result_t { - let this = this.as_rust_type_mut_uninit(); + let this = queryable.as_rust_type_mut_uninit(); let queryable = _declare_queryable_inner(session, key_expr, callback, options); match queryable.wait() { Ok(q) => { @@ -274,7 +274,7 @@ pub extern "C" fn z_queryable_declare( /// /// @return 0 in case of success, negative error code otherwise (in this case ) #[no_mangle] -pub extern "C" fn z_queryable_declare_background( +pub extern "C" fn z_declare_background_queryable( session: &z_loaned_session_t, key_expr: &z_loaned_keyexpr_t, callback: &mut z_moved_closure_query_t, @@ -291,6 +291,7 @@ pub extern "C" fn z_queryable_declare_background( } /// Undeclares queryable callback and resets it to its gravestone state. +/// This is equivalent to calling `z_undeclare_queryable()` and discarding its return value. #[allow(clippy::missing_safety_doc)] #[no_mangle] pub extern "C" fn z_queryable_drop(this_: &mut z_moved_queryable_t) { @@ -494,3 +495,16 @@ pub extern "C" fn z_query_attachment(this_: &z_loaned_query_t) -> Option<&z_loan .attachment() .map(|a| a.as_loaned_c_type_ref()) } + +/// Undeclares a `z_owned_queryable_t`. +/// Returns 0 in case of success, negative error code otherwise. +#[no_mangle] +pub extern "C" fn z_undeclare_queryable(this_: &mut z_moved_queryable_t) -> result::z_result_t { + if let Some(qable) = this_.take_rust_type() { + if let Err(e) = qable.undeclare().wait() { + tracing::error!("{}", e); + return result::Z_EGENERIC; + } + } + result::Z_OK +} diff --git a/src/querying_subscriber.rs b/src/querying_subscriber.rs index 100e1b26b..919d748d5 100644 --- a/src/querying_subscriber.rs +++ b/src/querying_subscriber.rs @@ -49,7 +49,7 @@ pub extern "C" fn ze_internal_querying_subscriber_null( /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. /// @brief A set of options that can be applied to a querying subscriber, -/// upon its declaration via `ze_querying_subscriber_declare()`. +/// upon its declaration via `ze_declare_querying_subscriber()`. /// #[repr(C)] #[allow(non_camel_case_types)] @@ -132,8 +132,8 @@ unsafe fn _declare_querying_subscriber_inner<'a, 'b>( /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. /// @brief Constructs and declares a querying subscriber for a given key expression. /// -/// @param this_: An uninitialized memory location where querying subscriber will be constructed. /// @param session: A Zenoh session. +/// @param querying_subscriber: An uninitialized memory location where querying subscriber will be constructed. /// @param key_expr: A key expression to subscribe to. /// @param callback: The callback function that will be called each time a data matching the subscribed expression is received. /// @param options: Additional options for the querying subscriber. @@ -141,14 +141,14 @@ unsafe fn _declare_querying_subscriber_inner<'a, 'b>( /// @return 0 in case of success, negative error code otherwise. #[no_mangle] #[allow(clippy::missing_safety_doc)] -pub unsafe extern "C" fn ze_querying_subscriber_declare( - this: &mut MaybeUninit, +pub unsafe extern "C" fn ze_declare_querying_subscriber( session: &'static z_loaned_session_t, + querying_subscriber: &mut MaybeUninit, key_expr: &z_loaned_keyexpr_t, callback: &mut z_moved_closure_sample_t, options: Option<&mut ze_querying_subscriber_options_t>, ) -> result::z_result_t { - let this = this.as_rust_type_mut_uninit(); + let this = querying_subscriber.as_rust_type_mut_uninit(); let sub = _declare_querying_subscriber_inner(session, key_expr, callback, options); match sub.wait() { Ok(sub) => { @@ -176,7 +176,7 @@ pub unsafe extern "C" fn ze_querying_subscriber_declare( /// @return 0 in case of success, negative error code otherwise. #[no_mangle] #[allow(clippy::missing_safety_doc)] -pub unsafe extern "C" fn ze_querying_subscriber_declare_background( +pub unsafe extern "C" fn ze_declare_background_querying_subscriber( session: &'static z_loaned_session_t, key_expr: &z_loaned_keyexpr_t, callback: &mut z_moved_closure_sample_t, @@ -259,6 +259,7 @@ pub unsafe extern "C" fn ze_querying_subscriber_get( /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. /// @brief Undeclares querying subscriber callback and resets it to its gravestone state. +/// This is equivalent to calling `ze_undeclare_querying_subscriber()` and discarding its return value. #[no_mangle] pub extern "C" fn ze_querying_subscriber_drop(this_: &mut ze_moved_querying_subscriber_t) { std::mem::drop(this_.take_rust_type()) @@ -285,3 +286,20 @@ pub unsafe extern "C" fn ze_querying_subscriber_loan( .unwrap_unchecked() .as_loaned_c_type_ref() } + +/// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. +/// @brief Undeclares the given querying subscriber. +/// +/// @return 0 in case of success, negative error code otherwise. +#[no_mangle] +pub extern "C" fn ze_undeclare_querying_subscriber( + this_: &mut ze_moved_querying_subscriber_t, +) -> result::z_result_t { + if let Some(s) = this_.take_rust_type() { + if let Err(e) = s.0.undeclare().wait() { + tracing::error!("{}", e); + return result::Z_EGENERIC; + } + } + result::Z_OK +} diff --git a/src/subscriber.rs b/src/subscriber.rs index 69886ec50..60aa5c57b 100644 --- a/src/subscriber.rs +++ b/src/subscriber.rs @@ -50,7 +50,7 @@ pub unsafe extern "C" fn z_subscriber_loan(this_: &z_owned_subscriber_t) -> &z_l .as_loaned_c_type_ref() } -/// Options passed to the `z_subscriber_declare()` function. +/// Options passed to the `z_declare_subscriber()` function. #[allow(non_camel_case_types)] #[repr(C)] pub struct z_subscriber_options_t { @@ -89,24 +89,24 @@ fn _declare_subscriber_inner<'a, 'b>( /// Constructs and declares a subscriber for a given key expression. Dropping subscriber undeclares its callback. /// -/// @param this_: An uninitialized location in memory, where subscriber will be constructed. /// @param session: The zenoh session. +/// @param subscriber: An uninitialized location in memory, where subscriber will be constructed. /// @param key_expr: The key expression to subscribe. /// @param callback: The callback function that will be called each time a data matching the subscribed expression is received. /// @param _options: The options to be passed to the subscriber declaration. /// /// @return 0 in case of success, negative error code otherwise (in this case subscriber will be in its gravestone state). #[no_mangle] -pub extern "C" fn z_subscriber_declare( - this: &mut MaybeUninit, +pub extern "C" fn z_declare_subscriber( session: &z_loaned_session_t, + subscriber: &mut MaybeUninit, key_expr: &z_loaned_keyexpr_t, callback: &mut z_moved_closure_sample_t, _options: Option<&mut z_subscriber_options_t>, ) -> result::z_result_t { - let this = this.as_rust_type_mut_uninit(); - let subscriber = _declare_subscriber_inner(session, key_expr, callback, _options); - match subscriber.wait() { + let this = subscriber.as_rust_type_mut_uninit(); + let s = _declare_subscriber_inner(session, key_expr, callback, _options); + match s.wait() { Ok(sub) => { this.write(Some(sub)); result::Z_OK @@ -129,7 +129,7 @@ pub extern "C" fn z_subscriber_declare( /// /// @return 0 in case of success, negative error code otherwise. #[no_mangle] -pub extern "C" fn z_subscriber_declare_background( +pub extern "C" fn z_declare_background_subscriber( session: &z_loaned_session_t, key_expr: &z_loaned_keyexpr_t, callback: &mut z_moved_closure_sample_t, @@ -156,6 +156,7 @@ pub extern "C" fn z_subscriber_keyexpr(subscriber: &z_loaned_subscriber_t) -> &z } /// Undeclares subscriber callback and resets it to its gravestone state. +/// This is equivalent to calling `z_undeclare_subscriber()` and discarding its return value. #[no_mangle] pub extern "C" fn z_subscriber_drop(this_: &mut z_moved_subscriber_t) { std::mem::drop(this_.take_rust_type()) @@ -166,3 +167,17 @@ pub extern "C" fn z_subscriber_drop(this_: &mut z_moved_subscriber_t) { pub extern "C" fn z_internal_subscriber_check(this_: &z_owned_subscriber_t) -> bool { this_.as_rust_type_ref().is_some() } + +/// Undeclares the subscriber. +/// +/// @return 0 in case of success, negative error code otherwise. +#[no_mangle] +pub extern "C" fn z_undeclare_subscriber(this_: &mut z_moved_subscriber_t) -> result::z_result_t { + if let Some(s) = this_.take_rust_type() { + if let Err(e) = s.undeclare().wait() { + tracing::error!("{}", e); + return result::Z_EGENERIC; + } + } + result::Z_OK +} diff --git a/tests/z_api_alignment_test.c b/tests/z_api_alignment_test.c index 410f22952..c73a89855 100644 --- a/tests/z_api_alignment_test.c +++ b/tests/z_api_alignment_test.c @@ -268,7 +268,7 @@ int main(int argc, char **argv) { z_view_keyexpr_t ke; z_view_keyexpr_from_str(&ke, keyexpr_str); z_owned_subscriber_t _ret_sub; - z_subscriber_declare(&_ret_sub, z_loan(s2), z_loan(ke), z_move(_ret_closure_sample), &_ret_sub_opt); + z_declare_subscriber(z_loan(s2), &_ret_sub, z_loan(ke), z_move(_ret_closure_sample), &_ret_sub_opt); assert(z_internal_check(_ret_sub)); z_sleep_s(SLEEP); @@ -278,7 +278,7 @@ int main(int argc, char **argv) { z_view_keyexpr_t s1_key; z_view_keyexpr_from_str(&s1_key, s1_res); z_owned_keyexpr_t _ret_expr; - z_declare_keyexpr(&_ret_expr, z_loan(s1), z_loan(s1_key)); + z_declare_keyexpr(z_loan(s1), &_ret_expr, z_loan(s1_key)); assert(z_internal_check(_ret_expr)); z_put_options_t _ret_put_opt; z_put_options_default(&_ret_put_opt); @@ -301,7 +301,7 @@ int main(int argc, char **argv) { z_sleep_s(SLEEP); assert(datas == 2); - _ret_int8 = z_undeclare_keyexpr(z_move(_ret_expr), z_loan(s1)); + _ret_int8 = z_undeclare_keyexpr(z_loan(s1), z_move(_ret_expr)); assert(_ret_int8 == 0); assert(!z_internal_check(_ret_expr)); @@ -314,7 +314,7 @@ int main(int argc, char **argv) { z_queryable_options_t _ret_qle_opt; z_queryable_options_default(&_ret_qle_opt); z_owned_queryable_t qle; - z_queryable_declare(&qle, z_loan(s1), z_loan(s1_key), z_move(_ret_closure_query), &_ret_qle_opt); + z_declare_queryable(z_loan(s1), &qle, z_loan(s1_key), z_move(_ret_closure_query), &_ret_qle_opt); assert(z_internal_check(qle)); z_sleep_s(SLEEP); diff --git a/tests/z_api_double_drop_test.c b/tests/z_api_double_drop_test.c index aa58603bc..03f74620c 100644 --- a/tests/z_api_double_drop_test.c +++ b/tests/z_api_double_drop_test.c @@ -45,7 +45,7 @@ void test_publisher() { z_keyexpr_from_str(&keyexpr, URL); z_owned_publisher_t pub; - z_publisher_declare(&pub, z_loan(s), z_loan(keyexpr), NULL); + z_declare_publisher(z_loan(s), &pub, z_loan(keyexpr), NULL); assert(z_internal_check(pub)); z_drop(z_move(pub)); assert(!z_internal_check(pub)); @@ -88,7 +88,7 @@ void test_subscriber() { z_view_keyexpr_t keyexpr; z_view_keyexpr_from_str(&keyexpr, URL); z_owned_subscriber_t sub; - z_subscriber_declare(&sub, z_loan(s), z_loan(keyexpr), z_move(callback), NULL); + z_declare_subscriber(z_loan(s), &sub, z_loan(keyexpr), z_move(callback), NULL); assert(z_internal_check(sub)); z_drop(z_move(sub)); assert(!z_internal_check(sub)); @@ -110,7 +110,7 @@ void test_queryable() { z_view_keyexpr_t keyexpr; z_view_keyexpr_from_str(&keyexpr, URL); z_owned_queryable_t queryable; - z_queryable_declare(&queryable, z_loan(s), z_loan(keyexpr), z_move(callback), NULL); + z_declare_queryable(z_loan(s), &queryable, z_loan(keyexpr), z_move(callback), NULL); assert(z_internal_check(queryable)); z_drop(z_move(queryable)); assert(!z_internal_check(queryable)); diff --git a/tests/z_api_keyexpr_drop_test.c b/tests/z_api_keyexpr_drop_test.c index 2597884d8..c415c6684 100644 --- a/tests/z_api_keyexpr_drop_test.c +++ b/tests/z_api_keyexpr_drop_test.c @@ -31,7 +31,7 @@ void test_publisher() { z_view_keyexpr_t ke; z_view_keyexpr_from_str(&ke, keyexpr); z_owned_publisher_t pub; - z_publisher_declare(&pub, z_loan(s), z_loan(ke), NULL); + z_declare_publisher(z_loan(s), &pub, z_loan(ke), NULL); strncpy(keyexpr, "baz/quax", 256); // Update source string to ensure that the keyexpr is copied into publisher z_view_keyexpr_from_str(&ke, keyexpr); const z_loaned_keyexpr_t *pub_ke = z_publisher_keyexpr(z_loan(pub)); @@ -57,7 +57,7 @@ void test_subscriber() { z_view_keyexpr_t ke; z_view_keyexpr_from_str(&ke, keyexpr); z_owned_subscriber_t sub; - z_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL); + z_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(callback), NULL); strncpy(keyexpr, "baz/quax", 256); // Update source string to ensure that the keyexpr is copied into the subscriber z_view_keyexpr_from_str(&ke, keyexpr); const z_loaned_keyexpr_t *sub_ke = z_subscriber_keyexpr(z_loan(sub)); diff --git a/tests/z_api_keyexpr_test.c b/tests/z_api_keyexpr_test.c index 24d4e7063..8a5c50120 100644 --- a/tests/z_api_keyexpr_test.c +++ b/tests/z_api_keyexpr_test.c @@ -91,9 +91,9 @@ void undeclare() { z_view_keyexpr_t view_ke; z_view_keyexpr_from_str(&view_ke, "test/thr"); z_owned_keyexpr_t ke; - z_declare_keyexpr(&ke, z_loan(s), z_loan(view_ke)); + z_declare_keyexpr(z_loan(s), &ke, z_loan(view_ke)); assert(z_internal_keyexpr_check(&ke)); - z_undeclare_keyexpr(z_move(ke), z_loan(s)); + z_undeclare_keyexpr(z_loan(s), z_move(ke)); assert(!z_internal_keyexpr_check(&ke)); } diff --git a/tests/z_api_liveliness.c b/tests/z_api_liveliness.c index d7c2c1939..d68aff490 100644 --- a/tests/z_api_liveliness.c +++ b/tests/z_api_liveliness.c @@ -71,12 +71,12 @@ void test_liveliness_sub() { z_closure(&closure, on_receive, NULL, (void*)(&context)); z_owned_subscriber_t sub; - zc_liveliness_subscriber_declare(&sub, z_loan(s2), z_loan(k), z_move(closure), NULL); + zc_liveliness_declare_subscriber(z_loan(s2), &sub, z_loan(k), z_move(closure), NULL); z_sleep_s(1); zc_owned_liveliness_token_t t1, t2; - zc_liveliness_declare_token(&t1, z_loan(s1), z_loan(k1), NULL); - zc_liveliness_declare_token(&t2, z_loan(s1), z_loan(k2), NULL); + zc_liveliness_declare_token(z_loan(s1), &t1, z_loan(k1), NULL); + zc_liveliness_declare_token(z_loan(s1), &t2, z_loan(k2), NULL); z_sleep_s(1); @@ -110,7 +110,7 @@ void test_liveliness_get() { z_sleep_s(1); zc_owned_liveliness_token_t t1; - zc_liveliness_declare_token(&t1, z_loan(s1), z_loan(k1), NULL); + zc_liveliness_declare_token(z_loan(s1), &t1, z_loan(k1), NULL); z_sleep_s(1); z_owned_fifo_handler_reply_t handler; diff --git a/tests/z_int_pub_cache_query_sub_test.c b/tests/z_int_pub_cache_query_sub_test.c index 2248c05ad..ec1e8579d 100644 --- a/tests/z_int_pub_cache_query_sub_test.c +++ b/tests/z_int_pub_cache_query_sub_test.c @@ -52,13 +52,13 @@ int run_publisher() { z_view_keyexpr_from_str(&ke, keyexpr); ze_owned_publication_cache_t pub_cache; ; - if (ze_publication_cache_declare(&pub_cache, z_loan(s), z_loan(ke), &pub_cache_opts) < 0) { + if (ze_declare_publication_cache(z_loan(s), &pub_cache, z_loan(ke), &pub_cache_opts) < 0) { perror("Unable to declare publication cache for key expression!\n"); return -1; } z_owned_publisher_t pub; - if (z_publisher_declare(&pub, z_loan(s), z_loan(ke), NULL) < 0) { + if (z_declare_publisher(z_loan(s), &pub, z_loan(ke), NULL) < 0) { perror("Unable to declare Publisher for key expression!"); return -1; } @@ -135,7 +135,7 @@ int run_subscriber() { z_closure(&callback, data_handler, NULL, NULL); ze_owned_querying_subscriber_t sub; ; - if (ze_querying_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL) != Z_OK) { + if (ze_declare_querying_subscriber(z_loan(s), &sub, z_loan(ke), z_move(callback), NULL) != Z_OK) { perror("Unable to declare subscriber!"); return -1; } diff --git a/tests/z_int_pub_sub_attachment_test.c b/tests/z_int_pub_sub_attachment_test.c index 1056174ce..3eb53ee74 100644 --- a/tests/z_int_pub_sub_attachment_test.c +++ b/tests/z_int_pub_sub_attachment_test.c @@ -94,7 +94,7 @@ int run_publisher() { z_view_keyexpr_t ke; z_view_keyexpr_from_str(&ke, keyexpr); z_owned_publisher_t pub; - if (z_publisher_declare(&pub, z_loan(s), z_loan(ke), NULL) < 0) { + if (z_declare_publisher(z_loan(s), &pub, z_loan(ke), NULL) < 0) { perror("Unable to declare Publisher for key expression!"); return -1; } @@ -182,7 +182,7 @@ int run_subscriber() { z_closure(&callback, data_handler, NULL, NULL); z_owned_subscriber_t sub; - if (z_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) { + if (z_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(callback), NULL) < 0) { perror("Unable to declare subscriber!"); return -1; } diff --git a/tests/z_int_pub_sub_test.c b/tests/z_int_pub_sub_test.c index 4f502fda0..b19267211 100644 --- a/tests/z_int_pub_sub_test.c +++ b/tests/z_int_pub_sub_test.c @@ -50,7 +50,7 @@ int run_publisher() { publisher_options.congestion_control = Z_CONGESTION_CONTROL_BLOCK; z_owned_publisher_t pub; - if (z_publisher_declare(&pub, z_loan(s), z_loan(ke), &publisher_options) != Z_OK) { + if (z_declare_publisher(z_loan(s), &pub, z_loan(ke), &publisher_options) != Z_OK) { perror("Unable to declare Publisher for key expression!"); return -1; } @@ -156,7 +156,7 @@ int run_subscriber() { z_owned_closure_sample_t callback; z_closure(&callback, data_handler, NULL, NULL); z_owned_subscriber_t sub; - if (z_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) { + if (z_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(callback), NULL) < 0) { perror("Unable to declare subscriber!"); return -1; } diff --git a/tests/z_int_queryable_attachment_test.c b/tests/z_int_queryable_attachment_test.c index edb8fa656..0fbf8caba 100644 --- a/tests/z_int_queryable_attachment_test.c +++ b/tests/z_int_queryable_attachment_test.c @@ -142,7 +142,7 @@ int run_queryable() { z_view_keyexpr_from_str(&ke, keyexpr); z_owned_queryable_t qable; - if (z_queryable_declare(&qable, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) { + if (z_declare_queryable(z_loan(s), &qable, z_loan(ke), z_move(callback), NULL) < 0) { printf("Unable to create queryable.\n"); return -1; } diff --git a/tests/z_int_queryable_test.c b/tests/z_int_queryable_test.c index a033da90d..4c1d5902e 100644 --- a/tests/z_int_queryable_test.c +++ b/tests/z_int_queryable_test.c @@ -74,7 +74,7 @@ int run_queryable() { z_closure(&callback, query_handler, NULL, (void *)keyexpr); z_owned_queryable_t qable; ; - if (z_queryable_declare(&qable, z_loan(s), z_loan(ke), z_move(callback), NULL) != Z_OK) { + if (z_declare_queryable(z_loan(s), &qable, z_loan(ke), z_move(callback), NULL) != Z_OK) { printf("Unable to create queryable.\n"); return -1; } diff --git a/tests/z_leak_pub_sub_test.c b/tests/z_leak_pub_sub_test.c index 98bb0504b..09cc05709 100644 --- a/tests/z_leak_pub_sub_test.c +++ b/tests/z_leak_pub_sub_test.c @@ -51,7 +51,7 @@ int main(int argc, char **argv) { z_open(&pub_session, z_move(pub_config), NULL); z_owned_publisher_t publisher; - z_publisher_declare(&publisher, z_loan(pub_session), z_loan(pub_keyexpr), NULL); + z_declare_publisher(z_loan(pub_session), &publisher, z_loan(pub_keyexpr), NULL); printf("Declaring Subscriber on %s\n", SUB_KEY_EXPR); @@ -68,7 +68,7 @@ int main(int argc, char **argv) { z_closure(&callback, data_handler, NULL, NULL); z_owned_subscriber_t subscriber; - z_subscriber_declare(&subscriber, z_loan(sub_session), z_loan(sub_keyexpr), z_move(callback), NULL); + z_declare_subscriber(z_loan(sub_session), &subscriber, z_loan(sub_keyexpr), z_move(callback), NULL); z_sleep_s(1); diff --git a/tests/z_leak_queryable_get_test.c b/tests/z_leak_queryable_get_test.c index ee5d0bda1..1a3a728f6 100644 --- a/tests/z_leak_queryable_get_test.c +++ b/tests/z_leak_queryable_get_test.c @@ -65,7 +65,7 @@ int main(int argc, char **argv) { z_owned_closure_query_t callback; z_closure(&callback, query_handler, NULL, NULL); z_owned_queryable_t queryable; - z_queryable_declare(&queryable, z_loan(queryable_session), z_loan(queryable_keyexpr), z_move(callback), NULL); + z_declare_queryable(z_loan(queryable_session), &queryable, z_loan(queryable_keyexpr), z_move(callback), NULL); z_view_keyexpr_t get_keyexpr; z_view_keyexpr_from_str(&get_keyexpr, GET_KEY_EXPR);