Skip to content

Commit

Permalink
Add zenoh macroses for liveliness
Browse files Browse the repository at this point in the history
  • Loading branch information
sashacmc committed Nov 9, 2023
1 parent 4e14797 commit 9cada9f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion examples/z_liveliness.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int main(int argc, char **argv) {

printf("Declaring liveliness token '%s'...\n", expr);
zc_owned_liveliness_token_t token = zc_liveliness_declare_token(z_loan(s), keyexpr, NULL);
if (!zc_liveliness_token_check(&token)) {
if (!z_check(token)) {
printf("Unable to create liveliness token!\n");
exit(-1);
}
Expand Down
38 changes: 20 additions & 18 deletions include/zenoh_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,29 @@
z_owned_reply_channel_t * : z_reply_channel_null, \
zc_owned_payload_t * : zc_payload_null, \
zc_owned_shmbuf_t * : zc_shmbuf_null, \
zc_owned_shm_manager_t * : zc_shm_manager_null \
zc_owned_shm_manager_t * : zc_shm_manager_null, \
zc_owned_liveliness_token_t * : zc_liveliness_token_null \
)())

#define z_check(x) \
_Generic((x), z_owned_session_t : z_session_check, \
z_owned_publisher_t : z_publisher_check, \
z_owned_keyexpr_t : z_keyexpr_check, \
z_keyexpr_t : z_keyexpr_is_initialized, \
z_owned_config_t : z_config_check, \
z_owned_scouting_config_t : z_scouting_config_check, \
z_bytes_t : z_bytes_check, \
z_owned_subscriber_t : z_subscriber_check, \
z_owned_pull_subscriber_t : z_pull_subscriber_check, \
z_owned_queryable_t : z_queryable_check, \
z_owned_encoding_t : z_encoding_check, \
z_owned_reply_t : z_reply_check, \
z_owned_hello_t : z_hello_check, \
z_owned_str_t : z_str_check, \
zc_owned_payload_t : zc_payload_check, \
zc_owned_shmbuf_t : zc_shmbuf_check, \
zc_owned_shm_manager_t : zc_shm_manager_check \
_Generic((x), z_owned_session_t : z_session_check, \
z_owned_publisher_t : z_publisher_check, \
z_owned_keyexpr_t : z_keyexpr_check, \
z_keyexpr_t : z_keyexpr_is_initialized, \
z_owned_config_t : z_config_check, \
z_owned_scouting_config_t : z_scouting_config_check, \
z_bytes_t : z_bytes_check, \
z_owned_subscriber_t : z_subscriber_check, \
z_owned_pull_subscriber_t : z_pull_subscriber_check, \
z_owned_queryable_t : z_queryable_check, \
z_owned_encoding_t : z_encoding_check, \
z_owned_reply_t : z_reply_check, \
z_owned_hello_t : z_hello_check, \
z_owned_str_t : z_str_check, \
zc_owned_payload_t : zc_payload_check, \
zc_owned_shmbuf_t : zc_shmbuf_check, \
zc_owned_shm_manager_t : zc_shm_manager_check, \
zc_owned_liveliness_token_t : zc_liveliness_token_check \
)(&x)

#define z_call(x, ...) \
Expand Down

0 comments on commit 9cada9f

Please sign in to comment.