diff --git a/examples/universal/z_pub.cxx b/examples/universal/z_pub.cxx index 938df2d..7f8d466 100644 --- a/examples/universal/z_pub.cxx +++ b/examples/universal/z_pub.cxx @@ -42,7 +42,7 @@ int _main(int argc, char **argv) { .named_value({"k", "key"}, "KEY_EXPRESSION", "Key expression to publish to (string)", default_keyexpr) .named_value({"p", "payload"}, "PAYLOAD", "Payload to publish (string)", default_value) .named_value({"a", "attach"}, "ATTACHMENT", "Attachment to add to each put (string)", "") -#if defined(Z_FEATURE_UNSTABLE_API) && defined(ZENOHCXX_ZENOHC) +#if defined(Z_FEATURE_UNSTABLE_API) && (defined(ZENOHCXX_ZENOHC) || Z_FEATURE_MATCHING == 1) .named_flag({"add-matching-listener"}, "Add matching listener") #endif .run(); @@ -56,7 +56,7 @@ int _main(int argc, char **argv) { std::cout << "Declaring Publisher on '" << keyexpr << "'..." << std::endl; auto pub = session.declare_publisher(KeyExpr(keyexpr)); -#if defined(Z_FEATURE_UNSTABLE_API) && defined(ZENOHCXX_ZENOHC) +#if defined(Z_FEATURE_UNSTABLE_API) && (defined(ZENOHCXX_ZENOHC) || Z_FEATURE_MATCHING == 1) if (args.flag("add-matching-listener")) { pub.declare_background_matching_listener( [](const MatchingStatus &s) { diff --git a/examples/universal/z_querier.cxx b/examples/universal/z_querier.cxx index d475d99..ea2bf14 100644 --- a/examples/universal/z_querier.cxx +++ b/examples/universal/z_querier.cxx @@ -34,7 +34,7 @@ int _main(int argc, char **argv) { .named_value({"t", "target"}, "TARGET", "Query target (BEST_MATCHING | ALL | ALL_COMPLETE)", "BEST_MATCHING") .named_value({"o", "timeout"}, "TIMEOUT", "Timeout in ms (number)", "10000") -#if defined(ZENOHCXX_ZENOHC) && defined(Z_FEATURE_UNSTABLE_API) +#if defined(Z_FEATURE_UNSTABLE_API) && (defined(ZENOHCXX_ZENOHC) || Z_FEATURE_MATCHING == 1) .named_flag({"add-matching-listener"}, "Add matching listener") #endif .run(); @@ -53,7 +53,7 @@ int _main(int argc, char **argv) { options.timeout_ms = timeout_ms; auto querier = session.declare_querier(selector.key_expr, std::move(options)); -#if defined(ZENOHCXX_ZENOHC) && defined(Z_FEATURE_UNSTABLE_API) +#if defined(Z_FEATURE_UNSTABLE_API) && (defined(ZENOHCXX_ZENOHC) || Z_FEATURE_MATCHING == 1) if (args.flag("add-matching-listener")) { querier.declare_background_matching_listener( [](const MatchingStatus &s) { diff --git a/include/zenoh/api/ext/advanced_publisher.hxx b/include/zenoh/api/ext/advanced_publisher.hxx index a53b210..90d6c25 100644 --- a/include/zenoh/api/ext/advanced_publisher.hxx +++ b/include/zenoh/api/ext/advanced_publisher.hxx @@ -160,7 +160,7 @@ class AdvancedPublisher : public Owned<::ze_owned_advanced_publisher_t> { "zenoh::MatchingStatus& status)"); static_assert(std::is_invocable_r::value, "on_drop should be callable with the following signature: void on_drop()"); - ::zc_owned_closure_matching_status_t c_closure; + ::z_owned_closure_matching_status_t c_closure; using Cval = std::remove_reference_t; using Dval = std::remove_reference_t; using ClosureType = typename zenoh::detail::closures::Closure; @@ -190,7 +190,7 @@ class AdvancedPublisher : public Owned<::ze_owned_advanced_publisher_t> { Channel channel, zenoh::ZResult* err = nullptr) const { auto cb_handler_pair = channel.template into_cb_handler_pair(); auto m = zenoh::interop::detail::null>(); - zenoh::ZResult res = ::zc_publisher_declare_matching_listener( + zenoh::ZResult res = ::z_publisher_declare_matching_listener( interop::as_loaned_c_ptr(*this), interop::as_owned_c_ptr(m), ::z_move(cb_handler_pair.first)); __ZENOH_RESULT_CHECK(res, err, "Failed to declare Matching Listener"); if (res != Z_OK) ::z_drop(zenoh::interop::as_moved_c_ptr(cb_handler_pair.second)); @@ -216,7 +216,7 @@ class AdvancedPublisher : public Owned<::ze_owned_advanced_publisher_t> { "zenoh::MatchingStatus& status)"); static_assert(std::is_invocable_r::value, "on_drop should be callable with the following signature: void on_drop()"); - ::zc_owned_closure_matching_status_t c_closure; + ::z_owned_closure_matching_status_t c_closure; using Cval = std::remove_reference_t; using Dval = std::remove_reference_t; using ClosureType = typename zenoh::detail::closures::Closure; @@ -235,7 +235,7 @@ class AdvancedPublisher : public Owned<::ze_owned_advanced_publisher_t> { /// thrown in case of error. /// @note Zenoh-c only. MatchingStatus get_matching_status(zenoh::ZResult* err = nullptr) const { - ::zc_matching_status_t m; + ::z_matching_status_t m; zenoh::ZResult res = ::ze_advanced_publisher_get_matching_status(zenoh::interop::as_loaned_c_ptr(*this), &m); __ZENOH_RESULT_CHECK(res, err, "Failed to get matching status"); return {m.matching}; diff --git a/include/zenoh/api/matching.hxx b/include/zenoh/api/matching.hxx index 422d374..3e14509 100644 --- a/include/zenoh/api/matching.hxx +++ b/include/zenoh/api/matching.hxx @@ -36,17 +36,17 @@ struct MatchingStatus { namespace detail::closures { extern "C" { -inline void _zenoh_on_status_change_call(const ::zc_matching_status_t* status, void* context) { +inline void _zenoh_on_status_change_call(const ::z_matching_status_t* status, void* context) { IClosure::call_from_context(context, MatchingStatus{status->matching}); } } } // namespace detail::closures namespace detail { -class MatchingListenerBase : public Owned<::zc_owned_matching_listener_t> { +class MatchingListenerBase : public Owned<::z_owned_matching_listener_t> { protected: MatchingListenerBase(zenoh::detail::null_object_t) : Owned(nullptr){}; - MatchingListenerBase(::zc_owned_matching_listener_t* m) : Owned(m){}; + MatchingListenerBase(::z_owned_matching_listener_t* m) : Owned(m){}; friend struct interop::detail::Converter; }; } // namespace detail @@ -68,7 +68,7 @@ class MatchingListener : public detail::MatchingListenerBase { /// @param err if not null, the result code will be written to this location, otherwise ZException exception will be /// thrown in case of error. void undeclare(ZResult* err = nullptr) && { - __ZENOH_RESULT_CHECK(::zc_undeclare_matching_listener(interop::as_moved_c_ptr(*this)), err, + __ZENOH_RESULT_CHECK(::z_undeclare_matching_listener(interop::as_moved_c_ptr(*this)), err, "Failed to undeclare matching listener"); } }; @@ -103,7 +103,7 @@ class MatchingListener : public detail::MatchingListenerBase { /// @param err if not null, the result code will be written to this location, otherwise ZException exception will be /// thrown in case of error. Handler undeclare(ZResult* err = nullptr) && { - __ZENOH_RESULT_CHECK(::zc_undeclare_matching_listener(interop::as_moved_c_ptr(*this)), err, + __ZENOH_RESULT_CHECK(::z_undeclare_matching_listener(interop::as_moved_c_ptr(*this)), err, "Failed to undeclare matching listener"); return std::move(this->_handler); } @@ -154,4 +154,4 @@ auto move_to_c_obj(MatchingListener&& m) { } } // namespace interop -} // namespace zenoh \ No newline at end of file +} // namespace zenoh diff --git a/include/zenoh/api/publisher.hxx b/include/zenoh/api/publisher.hxx index b96ff4e..c7bcdce 100644 --- a/include/zenoh/api/publisher.hxx +++ b/include/zenoh/api/publisher.hxx @@ -23,8 +23,10 @@ #include "interop.hxx" #include "keyexpr.hxx" #include "timestamp.hxx" -#if defined(ZENOHCXX_ZENOHC) && defined(Z_FEATURE_UNSTABLE_API) +#if defined(Z_FEATURE_UNSTABLE_API) && (defined(ZENOHCXX_ZENOHC) || Z_FEATURE_MATCHING == 1) #include "matching.hxx" +#endif +#if defined(ZENOHCXX_ZENOHC) && defined(Z_FEATURE_UNSTABLE_API) #include "source_info.hxx" #endif #include @@ -145,7 +147,7 @@ class Publisher : public Owned<::z_owned_publisher_t> { } #endif -#if defined(ZENOHCXX_ZENOHC) && defined(Z_FEATURE_UNSTABLE_API) +#if defined(Z_FEATURE_UNSTABLE_API) && (defined(ZENOHCXX_ZENOHC) || Z_FEATURE_MATCHING == 1) /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future /// release. /// @brief Construct matching listener, registering a callback for notifying subscribers matching with a given @@ -166,7 +168,7 @@ class Publisher : public Owned<::z_owned_publisher_t> { "zenoh::MatchingStatus& status)"); static_assert(std::is_invocable_r::value, "on_drop should be callable with the following signature: void on_drop()"); - ::zc_owned_closure_matching_status_t c_closure; + ::z_owned_closure_matching_status_t c_closure; using Cval = std::remove_reference_t; using Dval = std::remove_reference_t; using ClosureType = typename detail::closures::Closure; @@ -174,8 +176,8 @@ class Publisher : public Owned<::z_owned_publisher_t> { ::z_closure(&c_closure, detail::closures::_zenoh_on_status_change_call, detail::closures::_zenoh_on_drop, closure); MatchingListener m(zenoh::detail::null_object); - ZResult res = ::zc_publisher_declare_matching_listener(interop::as_loaned_c_ptr(*this), - interop::as_owned_c_ptr(m), ::z_move(c_closure)); + ZResult res = ::z_publisher_declare_matching_listener(interop::as_loaned_c_ptr(*this), + interop::as_owned_c_ptr(m), ::z_move(c_closure)); __ZENOH_RESULT_CHECK(res, err, "Failed to declare Matching Listener"); return m; } @@ -196,7 +198,7 @@ class Publisher : public Owned<::z_owned_publisher_t> { Channel channel, ZResult* err = nullptr) const { auto cb_handler_pair = channel.template into_cb_handler_pair(); MatchingListener m(zenoh::detail::null_object); - ZResult res = ::zc_publisher_declare_matching_listener( + ZResult res = ::z_publisher_declare_matching_listener( interop::as_loaned_c_ptr(*this), interop::as_owned_c_ptr(m), ::z_move(cb_handler_pair.first)); __ZENOH_RESULT_CHECK(res, err, "Failed to declare Matching Listener"); if (res != Z_OK) ::z_drop(interop::as_moved_c_ptr(cb_handler_pair.second)); @@ -222,7 +224,7 @@ class Publisher : public Owned<::z_owned_publisher_t> { "zenoh::MatchingStatus& status)"); static_assert(std::is_invocable_r::value, "on_drop should be callable with the following signature: void on_drop()"); - ::zc_owned_closure_matching_status_t c_closure; + ::z_owned_closure_matching_status_t c_closure; using Cval = std::remove_reference_t; using Dval = std::remove_reference_t; using ClosureType = typename detail::closures::Closure; @@ -230,7 +232,7 @@ class Publisher : public Owned<::z_owned_publisher_t> { ::z_closure(&c_closure, detail::closures::_zenoh_on_status_change_call, detail::closures::_zenoh_on_drop, closure); ZResult res = - ::zc_publisher_declare_background_matching_listener(interop::as_loaned_c_ptr(*this), ::z_move(c_closure)); + ::z_publisher_declare_background_matching_listener(interop::as_loaned_c_ptr(*this), ::z_move(c_closure)); __ZENOH_RESULT_CHECK(res, err, "Failed to declare background Matching Listener"); } @@ -241,8 +243,8 @@ class Publisher : public Owned<::z_owned_publisher_t> { /// thrown in case of error. /// @note Zenoh-c only. MatchingStatus get_matching_status(ZResult* err = nullptr) const { - ::zc_matching_status_t m; - ZResult res = ::zc_publisher_get_matching_status(interop::as_loaned_c_ptr(*this), &m); + ::z_matching_status_t m; + ZResult res = ::z_publisher_get_matching_status(interop::as_loaned_c_ptr(*this), &m); __ZENOH_RESULT_CHECK(res, err, "Failed to get matching status"); return {m.matching}; } @@ -250,4 +252,4 @@ class Publisher : public Owned<::z_owned_publisher_t> { }; } // namespace zenoh -#endif \ No newline at end of file +#endif diff --git a/include/zenoh/api/querier.hxx b/include/zenoh/api/querier.hxx index 73b2b90..c1e2585 100644 --- a/include/zenoh/api/querier.hxx +++ b/include/zenoh/api/querier.hxx @@ -23,8 +23,10 @@ #include "interop.hxx" #include "keyexpr.hxx" #include "reply.hxx" -#if defined(ZENOHCXX_ZENOHC) && defined(Z_FEATURE_UNSTABLE_API) +#if defined(Z_FEATURE_UNSTABLE_API) && (defined(ZENOHCXX_ZENOHC) || Z_FEATURE_MATCHING == 1) #include "matching.hxx" +#endif +#if defined(ZENOHCXX_ZENOHC) && defined(Z_FEATURE_UNSTABLE_API) #include "source_info.hxx" #endif #include @@ -148,7 +150,9 @@ class Querier : public Owned<::z_owned_querier_t> { EntityGlobalId get_id() const { return interop::into_copyable_cpp_obj(::z_querier_id(interop::as_loaned_c_ptr(*this))); } +#endif +#if defined(Z_FEATURE_UNSTABLE_API) && (defined(ZENOHCXX_ZENOHC) || Z_FEATURE_MATCHING == 1) /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future /// release. /// @brief Construct matching listener, registering a callback for notifying queryables matching with a given @@ -169,7 +173,7 @@ class Querier : public Owned<::z_owned_querier_t> { "zenoh::MatchingStatus& status)"); static_assert(std::is_invocable_r::value, "on_drop should be callable with the following signature: void on_drop()"); - ::zc_owned_closure_matching_status_t c_closure; + ::z_owned_closure_matching_status_t c_closure; using Cval = std::remove_reference_t; using Dval = std::remove_reference_t; using ClosureType = typename detail::closures::Closure; @@ -177,8 +181,8 @@ class Querier : public Owned<::z_owned_querier_t> { ::z_closure(&c_closure, detail::closures::_zenoh_on_status_change_call, detail::closures::_zenoh_on_drop, closure); MatchingListener m(zenoh::detail::null_object); - ZResult res = ::zc_querier_declare_matching_listener(interop::as_loaned_c_ptr(*this), - interop::as_owned_c_ptr(m), ::z_move(c_closure)); + ZResult res = ::z_querier_declare_matching_listener(interop::as_loaned_c_ptr(*this), interop::as_owned_c_ptr(m), + ::z_move(c_closure)); __ZENOH_RESULT_CHECK(res, err, "Failed to declare Matching Listener"); return m; } @@ -199,8 +203,8 @@ class Querier : public Owned<::z_owned_querier_t> { Channel channel, ZResult* err = nullptr) const { auto cb_handler_pair = channel.template into_cb_handler_pair(); MatchingListener m(zenoh::detail::null_object); - ZResult res = ::zc_querier_declare_matching_listener( - interop::as_loaned_c_ptr(*this), interop::as_owned_c_ptr(m), ::z_move(cb_handler_pair.first)); + ZResult res = ::z_querier_declare_matching_listener(interop::as_loaned_c_ptr(*this), interop::as_owned_c_ptr(m), + ::z_move(cb_handler_pair.first)); __ZENOH_RESULT_CHECK(res, err, "Failed to declare Matching Listener"); if (res != Z_OK) ::z_drop(interop::as_moved_c_ptr(cb_handler_pair.second)); return MatchingListener>( @@ -225,7 +229,7 @@ class Querier : public Owned<::z_owned_querier_t> { "zenoh::MatchingStatus& status)"); static_assert(std::is_invocable_r::value, "on_drop should be callable with the following signature: void on_drop()"); - ::zc_owned_closure_matching_status_t c_closure; + ::z_owned_closure_matching_status_t c_closure; using Cval = std::remove_reference_t; using Dval = std::remove_reference_t; using ClosureType = typename detail::closures::Closure; @@ -233,7 +237,7 @@ class Querier : public Owned<::z_owned_querier_t> { ::z_closure(&c_closure, detail::closures::_zenoh_on_status_change_call, detail::closures::_zenoh_on_drop, closure); ZResult res = - ::zc_querier_declare_background_matching_listener(interop::as_loaned_c_ptr(*this), ::z_move(c_closure)); + ::z_querier_declare_background_matching_listener(interop::as_loaned_c_ptr(*this), ::z_move(c_closure)); __ZENOH_RESULT_CHECK(res, err, "Failed to declare background Matching Listener"); } @@ -244,8 +248,8 @@ class Querier : public Owned<::z_owned_querier_t> { /// thrown in case of error. /// @note Zenoh-c only. MatchingStatus get_matching_status(ZResult* err = nullptr) const { - ::zc_matching_status_t m; - ZResult res = ::zc_querier_get_matching_status(interop::as_loaned_c_ptr(*this), &m); + ::z_matching_status_t m; + ZResult res = ::z_querier_get_matching_status(interop::as_loaned_c_ptr(*this), &m); __ZENOH_RESULT_CHECK(res, err, "Failed to get matching status"); return {m.matching}; } diff --git a/zenoh-c b/zenoh-c index 220ef86..7a21b9d 160000 --- a/zenoh-c +++ b/zenoh-c @@ -1 +1 @@ -Subproject commit 220ef8618105c799801fa0d564ea76e0b2d999c6 +Subproject commit 7a21b9dff6a773d13d8584419506eb42eee2fe4d diff --git a/zenoh-pico b/zenoh-pico index d076875..48feb01 160000 --- a/zenoh-pico +++ b/zenoh-pico @@ -1 +1 @@ -Subproject commit d076875d6d3f417c36999fb739f9396dbc705cf7 +Subproject commit 48feb0124f011d041e6be21bb80eb0548daf1361