From d46756b92a2e05f704da6a4c48db6f3e0b9f48c7 Mon Sep 17 00:00:00 2001 From: Denis Biryukov Date: Thu, 19 Dec 2024 11:39:49 +0100 Subject: [PATCH] deprecate publication cache and advanced subscriber --- include/zenoh/api/ext/publication_cache.hxx | 3 ++- include/zenoh/api/ext/querying_subscriber.hxx | 2 +- include/zenoh/api/ext/session_ext.hxx | 21 +++++++++++-------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/include/zenoh/api/ext/publication_cache.hxx b/include/zenoh/api/ext/publication_cache.hxx index 372e9af..82530eb 100644 --- a/include/zenoh/api/ext/publication_cache.hxx +++ b/include/zenoh/api/ext/publication_cache.hxx @@ -28,7 +28,8 @@ namespace zenoh::ext { /// Used to store publications on intersecting key expressions. Can be queried later via `zenoh::Session::get` to /// retrieve this data. /// @note Zenoh-c only -class PublicationCache : public Owned<::ze_owned_publication_cache_t> { +class [[deprecated("Use zenoh::ext::AdvancedPublisher instead.")]] PublicationCache + : public Owned<::ze_owned_publication_cache_t> { PublicationCache(zenoh::detail::null_object_t) : Owned(nullptr){}; friend struct interop::detail::Converter; diff --git a/include/zenoh/api/ext/querying_subscriber.hxx b/include/zenoh/api/ext/querying_subscriber.hxx index 643e874..86ed83c 100644 --- a/include/zenoh/api/ext/querying_subscriber.hxx +++ b/include/zenoh/api/ext/querying_subscriber.hxx @@ -65,7 +65,7 @@ class QueryingSubscriberBase : public Owned<::ze_owned_querying_subscriber_t> { } // namespace detail template -class QueryingSubscriber; +class [[deprecated("Use zenoh::ext::AdvancedSubscriber instead.")]] QueryingSubscriber; /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. /// @brief A Zenoh querying subscriber. diff --git a/include/zenoh/api/ext/session_ext.hxx b/include/zenoh/api/ext/session_ext.hxx index ff5a14d..67a2785 100644 --- a/include/zenoh/api/ext/session_ext.hxx +++ b/include/zenoh/api/ext/session_ext.hxx @@ -91,7 +91,7 @@ class SessionExt { /// @param err if not null, the result code will be written to this location, otherwise ZException exception will be /// thrown in case of error. /// @return declared ``PublicationCache`` instance. - [[nodiscard]] PublicationCache declare_publication_cache( + [[deprecated("Use declare_advanced_publisher instead.")]] [[nodiscard]] PublicationCache declare_publication_cache( const KeyExpr& key_expr, PublicationCacheOptions&& options = PublicationCacheOptions::create_default(), zenoh::ZResult* err = nullptr) const { ::ze_publication_cache_options_t opts = zenoh::interop::detail::Converter::to_c_opts(options); @@ -112,6 +112,7 @@ class SessionExt { /// @param options additional options for the publication cache. /// @param err if not null, the result code will be written to this location, otherwise ZException exception will be /// thrown in case of error. + [[deprecated]] void declare_background_publication_cache( const KeyExpr& key_expr, PublicationCacheOptions&& options = PublicationCacheOptions::create_default(), zenoh::ZResult* err = nullptr) const { @@ -176,10 +177,10 @@ class SessionExt { /// thrown in case of error. /// @return declared ``QueryingSubscriber`` instance. template - [[nodiscard]] QueryingSubscriber declare_querying_subscriber( - const KeyExpr& key_expr, C&& on_sample, D&& on_drop, - QueryingSubscriberOptions&& options = QueryingSubscriberOptions::create_default(), - zenoh::ZResult* err = nullptr) const { + [[nodiscard]] [[deprecated("Use declare_advanced_subscriber instead.")]] QueryingSubscriber + declare_querying_subscriber(const KeyExpr& key_expr, C&& on_sample, D&& on_drop, + QueryingSubscriberOptions&& options = QueryingSubscriberOptions::create_default(), + zenoh::ZResult* err = nullptr) const { static_assert( std::is_invocable_r::value, "on_sample should be callable with the following signature: void on_sample(zenoh::Sample& sample)"); @@ -212,6 +213,7 @@ class SessionExt { /// @param err if not null, the result code will be written to this location, otherwise ZException exception will be /// thrown in case of error. template + [[deprecated("Use declare_background_advanced_subscriber instead.")]] void declare_background_querying_subscriber( const KeyExpr& key_expr, C&& on_sample, D&& on_drop, QueryingSubscriberOptions&& options = QueryingSubscriberOptions::create_default(), @@ -247,10 +249,11 @@ class SessionExt { /// thrown in case of error. /// @return a ``QueryingSubscriber`` object. template - [[nodiscard]] QueryingSubscriber> declare_querying_subscriber( - const KeyExpr& key_expr, Channel channel, - QueryingSubscriberOptions&& options = QueryingSubscriberOptions::create_default(), - zenoh::ZResult* err = nullptr) const { + [[deprecated("Use declare_advanced_subscriber instead.")]] [[nodiscard]] QueryingSubscriber< + typename Channel::template HandlerType> + declare_querying_subscriber(const KeyExpr& key_expr, Channel channel, + QueryingSubscriberOptions&& options = QueryingSubscriberOptions::create_default(), + zenoh::ZResult* err = nullptr) const { auto cb_handler_pair = channel.template into_cb_handler_pair(); ::ze_querying_subscriber_options_t opts = zenoh::interop::detail::Converter::to_c_opts(options); QueryingSubscriber qs = zenoh::interop::detail::null>();