From ad4c4a9567cf5153e2c66b2120ed0b9ad6d8eedd Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 25 Feb 2025 11:47:16 +0100 Subject: [PATCH 01/16] latest zenoh-c/zenoh-cpp --- zenoh-c | 2 +- zenoh-pico | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zenoh-c b/zenoh-c index 2614936..fd8567b 160000 --- a/zenoh-c +++ b/zenoh-c @@ -1 +1 @@ -Subproject commit 261493682c7dc54db3a07079315e009a2e7c1573 +Subproject commit fd8567b631c8836f1239714029c1f395213bb095 diff --git a/zenoh-pico b/zenoh-pico index 5d7a490..0d10b49 160000 --- a/zenoh-pico +++ b/zenoh-pico @@ -1 +1 @@ -Subproject commit 5d7a4902d23a69e28cfe0499140dc5d4fb1c3a3e +Subproject commit 0d10b492d49c6e68525e03a3f7739e8932caa84d From 1b8409a0c40c195179e11eddf6c3799e45ace599 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 25 Feb 2025 12:11:58 +0100 Subject: [PATCH 02/16] script fix: allow TRUE and 1 as true valuie --- scripts/install_from_git.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_from_git.sh b/scripts/install_from_git.sh index e235c3f..439f3c8 100755 --- a/scripts/install_from_git.sh +++ b/scripts/install_from_git.sh @@ -36,7 +36,7 @@ mkdir -p $1 absolute_install_location=$(cd $1; pwd) #build zenoh-c bash $SCRIPT_DIR/install_local.sh $SCRIPT_DIR/../zenoh-c $absolute_install_location -DZENOHC_BUILD_WITH_UNSTABLE_API=$USE_UNSTABLE -DZENOHC_BUILD_WITH_SHARED_MEMORY=$USE_SHARED_MEMORY -if [ "$BUILD_PICO" == "ON" ]; then +if [ "$BUILD_PICO" == "ON" ] || [ "$BUILD_PICO" == "TRUE" ] || [ "$BUILD_PICO" == "1" ]; then #build zenoh-pico bash $SCRIPT_DIR/install_local.sh $SCRIPT_DIR/../zenoh-pico $absolute_install_location -DZ_FEATURE_UNSTABLE_API=$USE_UNSTABLE_PICO fi From 870a3dd747b7fedc0d214a1faa571f3aeba60e72 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 25 Feb 2025 12:15:53 +0100 Subject: [PATCH 03/16] script fix --- scripts/build_standalone_examples.sh | 2 +- scripts/install_from_git.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/build_standalone_examples.sh b/scripts/build_standalone_examples.sh index 2b84e5d..4826c91 100755 --- a/scripts/build_standalone_examples.sh +++ b/scripts/build_standalone_examples.sh @@ -15,7 +15,7 @@ absolute_install_location=$(cd $1; pwd) bash $SCRIPT_DIR/build_local.sh $SCRIPT_DIR/../examples/simple/zenohc $absolute_install_location -if [ "$BUILD_PICO" == "ON" ]; then +if [ "$BUILD_PICO" == "ON" ] || [ "$BUILD_PICO" == "TRUE" ] || [ "$BUILD_PICO" == "1" ]; then #build examples requiring zenoh-pico bash $SCRIPT_DIR/build_local.sh $SCRIPT_DIR/../examples/simple/universal $absolute_install_location bash $SCRIPT_DIR/build_local.sh $SCRIPT_DIR/../examples/simple/zenohpico $absolute_install_location diff --git a/scripts/install_from_git.sh b/scripts/install_from_git.sh index 439f3c8..fa14041 100755 --- a/scripts/install_from_git.sh +++ b/scripts/install_from_git.sh @@ -20,7 +20,7 @@ if [ "$#" -ge 3 ]; then USE_SHARED_MEMORY=$3 fi -if [ "$USE_UNSTABLE" == "TRUE" ]; then +if [ "$USE_UNSTABLE" == "TRUE" ] || [ "$USE_UNSTABLE" == "ON" ] || [ "$USE_UNSTABLE" == "1" ]; then USE_UNSTABLE_PICO="1" fi From 393f14c8e2d25668ff279f8bfcdec29f0b027119 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 25 Feb 2025 13:13:23 +0100 Subject: [PATCH 04/16] use_take_from_loaned template parameter --- include/zenoh/api/base.hxx | 33 ++++++++++++++++++++++++++++++++- include/zenoh/api/hello.hxx | 2 +- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/include/zenoh/api/base.hxx b/include/zenoh/api/base.hxx index aa6eb89..d1fb6ac 100644 --- a/include/zenoh/api/base.hxx +++ b/include/zenoh/api/base.hxx @@ -60,7 +60,8 @@ class Copyable { /// Base type for C++ wrappers of Zenoh owned structures /// @tparam ZC_OWNED_TYPE - zenoh-c owned type ::z_owned_XXX_t -template +/// @tparam USE_TAKE_FROM_LOANED - boolean template parameter to switch between variants +template class Owned { protected: typedef ZC_OWNED_TYPE OwnedType; @@ -91,6 +92,36 @@ class Owned { } }; +// Specialization for USE_TAKE_FROM_LOANED = true +template +class Owned { + protected: + typedef ZC_OWNED_TYPE OwnedType; + + protected: + /// Move constructor. + Owned(Owned&& v) : Owned(&v._0) {} + /// Move assignment. + Owned& operator=(Owned&& v) { + if (this != &v) { + ::z_drop(::z_move(this->_0)); + ::z_take_from_loaned(&this->_0, ::z_loan_mut(v._0)); + } + return *this; + } + /// Destructor drops owned value using z_drop from zenoh API + ~Owned() { ::z_drop(::z_move(_0)); } + + OwnedType _0; + + explicit Owned(OwnedType* pv) { + if (pv != nullptr) { + ::z_take_from_loaned(&this->_0, ::z_loan_mut(*pv)); + } else + ::z_internal_null(&this->_0); + } +}; + namespace detail { struct null_object_t {}; inline constexpr null_object_t null_object{}; diff --git a/include/zenoh/api/hello.hxx b/include/zenoh/api/hello.hxx index 78b4dc2..ecceecb 100644 --- a/include/zenoh/api/hello.hxx +++ b/include/zenoh/api/hello.hxx @@ -24,7 +24,7 @@ namespace zenoh { /// ``Hello`` message returned by a zenoh entity as a reply to a "scout" /// message. -class Hello : public Owned<::z_owned_hello_t> { +class Hello : public Owned<::z_owned_hello_t, true> { public: /// @name Methods From 38d9cfebc843652750537f82ed32c3f61377320b Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 25 Feb 2025 13:36:33 +0100 Subject: [PATCH 05/16] auto selection --- include/zenoh/api/base.hxx | 55 ++++++++++++++++--------------------- include/zenoh/api/hello.hxx | 2 +- 2 files changed, 25 insertions(+), 32 deletions(-) diff --git a/include/zenoh/api/base.hxx b/include/zenoh/api/base.hxx index d1fb6ac..a5b37a0 100644 --- a/include/zenoh/api/base.hxx +++ b/include/zenoh/api/base.hxx @@ -60,12 +60,17 @@ class Copyable { /// Base type for C++ wrappers of Zenoh owned structures /// @tparam ZC_OWNED_TYPE - zenoh-c owned type ::z_owned_XXX_t -/// @tparam USE_TAKE_FROM_LOANED - boolean template parameter to switch between variants -template +template class Owned { protected: typedef ZC_OWNED_TYPE OwnedType; + template + struct has_take_from_loaned : std::false_type {}; + + template + struct has_take_from_loaned(), ::z_owned_to_loaned_type_t{}))>> : std::true_type {}; + protected: /// Move constructor. Owned(Owned&& v) : Owned(&v._0) {} @@ -73,8 +78,7 @@ class Owned { Owned& operator=(Owned&& v) { if (this != &v) { ::z_drop(::z_move(this->_0)); - _0 = v._0; - ::z_internal_null(&v._0); + assign_impl(v, has_take_from_loaned{}); } return *this; } @@ -85,40 +89,29 @@ class Owned { explicit Owned(OwnedType* pv) { if (pv != nullptr) { - _0 = *pv; - ::z_internal_null(pv); - } else + construct_impl(pv, has_take_from_loaned{}); + } else { ::z_internal_null(&this->_0); + } } -}; -// Specialization for USE_TAKE_FROM_LOANED = true -template -class Owned { - protected: - typedef ZC_OWNED_TYPE OwnedType; + private: + void construct_impl(OwnedType* pv, std::true_type) { + ::z_take_from_loaned(&this->_0, ::z_loan_mut(*pv)); + } - protected: - /// Move constructor. - Owned(Owned&& v) : Owned(&v._0) {} - /// Move assignment. - Owned& operator=(Owned&& v) { - if (this != &v) { - ::z_drop(::z_move(this->_0)); - ::z_take_from_loaned(&this->_0, ::z_loan_mut(v._0)); - } - return *this; + void construct_impl(OwnedType* pv, std::false_type) { + _0 = *pv; + ::z_internal_null(pv); } - /// Destructor drops owned value using z_drop from zenoh API - ~Owned() { ::z_drop(::z_move(_0)); } - OwnedType _0; + void assign_impl(Owned& v, std::true_type) { + ::z_take_from_loaned(&this->_0, ::z_loan_mut(v._0)); + } - explicit Owned(OwnedType* pv) { - if (pv != nullptr) { - ::z_take_from_loaned(&this->_0, ::z_loan_mut(*pv)); - } else - ::z_internal_null(&this->_0); + void assign_impl(Owned& v, std::false_type) { + _0 = v._0; + ::z_internal_null(&v._0); } }; diff --git a/include/zenoh/api/hello.hxx b/include/zenoh/api/hello.hxx index ecceecb..78b4dc2 100644 --- a/include/zenoh/api/hello.hxx +++ b/include/zenoh/api/hello.hxx @@ -24,7 +24,7 @@ namespace zenoh { /// ``Hello`` message returned by a zenoh entity as a reply to a "scout" /// message. -class Hello : public Owned<::z_owned_hello_t, true> { +class Hello : public Owned<::z_owned_hello_t> { public: /// @name Methods From 3112791be564fa4c13298829817b869a528cd645 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 25 Feb 2025 16:40:34 +0100 Subject: [PATCH 06/16] moved take_from_loaned check to interop.h --- include/zenoh/api/base.hxx | 10 ++-------- include/zenoh/api/interop.hxx | 11 +++++++++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/include/zenoh/api/base.hxx b/include/zenoh/api/base.hxx index a5b37a0..8470e06 100644 --- a/include/zenoh/api/base.hxx +++ b/include/zenoh/api/base.hxx @@ -65,12 +65,6 @@ class Owned { protected: typedef ZC_OWNED_TYPE OwnedType; - template - struct has_take_from_loaned : std::false_type {}; - - template - struct has_take_from_loaned(), ::z_owned_to_loaned_type_t{}))>> : std::true_type {}; - protected: /// Move constructor. Owned(Owned&& v) : Owned(&v._0) {} @@ -78,7 +72,7 @@ class Owned { Owned& operator=(Owned&& v) { if (this != &v) { ::z_drop(::z_move(this->_0)); - assign_impl(v, has_take_from_loaned{}); + assign_impl(v, is_take_from_loaned_available{}); } return *this; } @@ -89,7 +83,7 @@ class Owned { explicit Owned(OwnedType* pv) { if (pv != nullptr) { - construct_impl(pv, has_take_from_loaned{}); + construct_impl(pv, is_take_from_loaned_available{}); } else { ::z_internal_null(&this->_0); } diff --git a/include/zenoh/api/interop.hxx b/include/zenoh/api/interop.hxx index 811fb43..af2b63a 100644 --- a/include/zenoh/api/interop.hxx +++ b/include/zenoh/api/interop.hxx @@ -24,7 +24,7 @@ struct is_loan_available : std::false_type {}; template struct is_loan_available()))>> : std::true_type {}; -template +template inline constexpr bool is_loan_available_v = is_loan_available::value; template @@ -33,9 +33,16 @@ struct is_loan_mut_available : std::false_type {}; template struct is_loan_mut_available()))>> : std::true_type {}; -template +template inline constexpr bool is_loan_mut_available_v = is_loan_mut_available::value; +template +struct is_take_from_loaned_available : std::false_type {}; + +template +struct is_take_from_loaned_available(), ::z_owned_to_loaned_type_t{}))>> + : std::true_type {}; + } // namespace zenoh::detail namespace zenoh::interop { From adf700bc164a54aca4d4049e1a97194192b68000 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 25 Feb 2025 17:00:10 +0100 Subject: [PATCH 07/16] build fix: detail namespace in separate file --- include/zenoh/api/base.hxx | 5 ++-- include/zenoh/api/detail.hxx | 48 +++++++++++++++++++++++++++++++++++ include/zenoh/api/interop.hxx | 29 +-------------------- 3 files changed, 52 insertions(+), 30 deletions(-) create mode 100644 include/zenoh/api/detail.hxx diff --git a/include/zenoh/api/base.hxx b/include/zenoh/api/base.hxx index 8470e06..1af3f00 100644 --- a/include/zenoh/api/base.hxx +++ b/include/zenoh/api/base.hxx @@ -18,6 +18,7 @@ #include #include +#include "detail.hxx" #include "../zenohc.hxx" namespace zenoh { @@ -72,7 +73,7 @@ class Owned { Owned& operator=(Owned&& v) { if (this != &v) { ::z_drop(::z_move(this->_0)); - assign_impl(v, is_take_from_loaned_available{}); + assign_impl(v, detail::is_take_from_loaned_available{}); } return *this; } @@ -83,7 +84,7 @@ class Owned { explicit Owned(OwnedType* pv) { if (pv != nullptr) { - construct_impl(pv, is_take_from_loaned_available{}); + construct_impl(pv, detail::is_take_from_loaned_available{}); } else { ::z_internal_null(&this->_0); } diff --git a/include/zenoh/api/detail.hxx b/include/zenoh/api/detail.hxx new file mode 100644 index 0000000..b502bf1 --- /dev/null +++ b/include/zenoh/api/detail.hxx @@ -0,0 +1,48 @@ +// +// Copyright (c) 2024 ZettaScale Technology +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 +// which is available at https://www.apache.org/licenses/LICENSE-2.0. +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// +// Contributors: +// ZettaScale Zenoh Team, +#pragma once + +#include +#include + +#include "../zenohc.hxx" + +// namespace zenoh::detail +namespace zenoh::detail { +template +struct is_loan_available : std::false_type {}; + +template +struct is_loan_available()))>> : std::true_type {}; + +template +inline constexpr bool is_loan_available_v = is_loan_available::value; + +template +struct is_loan_mut_available : std::false_type {}; + +template +struct is_loan_mut_available()))>> : std::true_type {}; + +template +inline constexpr bool is_loan_mut_available_v = is_loan_mut_available::value; + +template +struct is_take_from_loaned_available : std::false_type {}; + +template +struct is_take_from_loaned_available(), ::z_owned_to_loaned_type_t{}))>> + : std::true_type {}; + +} // namespace zenoh::detail + diff --git a/include/zenoh/api/interop.hxx b/include/zenoh/api/interop.hxx index af2b63a..7707c49 100644 --- a/include/zenoh/api/interop.hxx +++ b/include/zenoh/api/interop.hxx @@ -15,36 +15,9 @@ #include #include +#include "detail.hxx" #include "base.hxx" -namespace zenoh::detail { -template -struct is_loan_available : std::false_type {}; - -template -struct is_loan_available()))>> : std::true_type {}; - -template -inline constexpr bool is_loan_available_v = is_loan_available::value; - -template -struct is_loan_mut_available : std::false_type {}; - -template -struct is_loan_mut_available()))>> : std::true_type {}; - -template -inline constexpr bool is_loan_mut_available_v = is_loan_mut_available::value; - -template -struct is_take_from_loaned_available : std::false_type {}; - -template -struct is_take_from_loaned_available(), ::z_owned_to_loaned_type_t{}))>> - : std::true_type {}; - -} // namespace zenoh::detail - namespace zenoh::interop { /// @brief Get zenoh-c representation of trivially copyable zenoh-cpp object. From a31b35d4df632bba478262c5ee3907f7f587373e Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 25 Feb 2025 17:05:45 +0100 Subject: [PATCH 08/16] detail namespace joined --- include/zenoh/api/base.hxx | 5 ----- include/zenoh/api/detail.hxx | 3 +++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/include/zenoh/api/base.hxx b/include/zenoh/api/base.hxx index 1af3f00..7a06db8 100644 --- a/include/zenoh/api/base.hxx +++ b/include/zenoh/api/base.hxx @@ -110,9 +110,4 @@ class Owned { } }; -namespace detail { -struct null_object_t {}; -inline constexpr null_object_t null_object{}; -} // namespace detail - } // namespace zenoh diff --git a/include/zenoh/api/detail.hxx b/include/zenoh/api/detail.hxx index b502bf1..1801d87 100644 --- a/include/zenoh/api/detail.hxx +++ b/include/zenoh/api/detail.hxx @@ -44,5 +44,8 @@ template struct is_take_from_loaned_available(), ::z_owned_to_loaned_type_t{}))>> : std::true_type {}; +struct null_object_t {}; +inline constexpr null_object_t null_object{}; + } // namespace zenoh::detail From 938e26d5097a2b55b520ff791dd0ff24de260401 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 25 Feb 2025 17:13:39 +0100 Subject: [PATCH 09/16] removed proxy methods --- include/zenoh/api/base.hxx | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/include/zenoh/api/base.hxx b/include/zenoh/api/base.hxx index 7a06db8..b635e41 100644 --- a/include/zenoh/api/base.hxx +++ b/include/zenoh/api/base.hxx @@ -73,7 +73,12 @@ class Owned { Owned& operator=(Owned&& v) { if (this != &v) { ::z_drop(::z_move(this->_0)); - assign_impl(v, detail::is_take_from_loaned_available{}); + if constexpr (detail::is_take_from_loaned_available::value) { + ::z_take_from_loaned(&this->_0, ::z_loan_mut(v._0)); + } else { + _0 = v._0; + ::z_internal_null(&v._0); + } } return *this; } @@ -84,30 +89,16 @@ class Owned { explicit Owned(OwnedType* pv) { if (pv != nullptr) { - construct_impl(pv, detail::is_take_from_loaned_available{}); + if constexpr (detail::is_take_from_loaned_available::value) { + ::z_take_from_loaned(&this->_0, ::z_loan_mut(*pv)); + } else { + _0 = *pv; + ::z_internal_null(pv); + } } else { ::z_internal_null(&this->_0); } } - - private: - void construct_impl(OwnedType* pv, std::true_type) { - ::z_take_from_loaned(&this->_0, ::z_loan_mut(*pv)); - } - - void construct_impl(OwnedType* pv, std::false_type) { - _0 = *pv; - ::z_internal_null(pv); - } - - void assign_impl(Owned& v, std::true_type) { - ::z_take_from_loaned(&this->_0, ::z_loan_mut(v._0)); - } - - void assign_impl(Owned& v, std::false_type) { - _0 = v._0; - ::z_internal_null(&v._0); - } }; } // namespace zenoh From d9ff9f99fcdcbdc6731b991eefd80bca95a8eb83 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 25 Feb 2025 17:21:32 +0100 Subject: [PATCH 10/16] clang format --- include/zenoh/api/base.hxx | 2 +- include/zenoh/api/detail.hxx | 4 ++-- include/zenoh/api/interop.hxx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/zenoh/api/base.hxx b/include/zenoh/api/base.hxx index b635e41..1ee354c 100644 --- a/include/zenoh/api/base.hxx +++ b/include/zenoh/api/base.hxx @@ -18,8 +18,8 @@ #include #include -#include "detail.hxx" #include "../zenohc.hxx" +#include "detail.hxx" namespace zenoh { diff --git a/include/zenoh/api/detail.hxx b/include/zenoh/api/detail.hxx index 1801d87..36cd4f6 100644 --- a/include/zenoh/api/detail.hxx +++ b/include/zenoh/api/detail.hxx @@ -41,11 +41,11 @@ template struct is_take_from_loaned_available : std::false_type {}; template -struct is_take_from_loaned_available(), ::z_owned_to_loaned_type_t{}))>> +struct is_take_from_loaned_available< + T, std::void_t(), ::z_owned_to_loaned_type_t{}))>> : std::true_type {}; struct null_object_t {}; inline constexpr null_object_t null_object{}; } // namespace zenoh::detail - diff --git a/include/zenoh/api/interop.hxx b/include/zenoh/api/interop.hxx index 7707c49..1f233d8 100644 --- a/include/zenoh/api/interop.hxx +++ b/include/zenoh/api/interop.hxx @@ -15,8 +15,8 @@ #include #include -#include "detail.hxx" #include "base.hxx" +#include "detail.hxx" namespace zenoh::interop { From 24ce0ac66380e5b624419bb19fb662f2a61358fd Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 25 Feb 2025 18:24:56 +0100 Subject: [PATCH 11/16] template fixed, test for template added --- include/zenoh/api/base.hxx | 4 ++-- include/zenoh/api/detail.hxx | 5 ++++- tests/universal/details.cxx | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 tests/universal/details.cxx diff --git a/include/zenoh/api/base.hxx b/include/zenoh/api/base.hxx index 1ee354c..aaf1ce0 100644 --- a/include/zenoh/api/base.hxx +++ b/include/zenoh/api/base.hxx @@ -73,7 +73,7 @@ class Owned { Owned& operator=(Owned&& v) { if (this != &v) { ::z_drop(::z_move(this->_0)); - if constexpr (detail::is_take_from_loaned_available::value) { + if constexpr (detail::is_take_from_loaned_available_v) { ::z_take_from_loaned(&this->_0, ::z_loan_mut(v._0)); } else { _0 = v._0; @@ -89,7 +89,7 @@ class Owned { explicit Owned(OwnedType* pv) { if (pv != nullptr) { - if constexpr (detail::is_take_from_loaned_available::value) { + if constexpr (detail::is_take_from_loaned_available_v) { ::z_take_from_loaned(&this->_0, ::z_loan_mut(*pv)); } else { _0 = *pv; diff --git a/include/zenoh/api/detail.hxx b/include/zenoh/api/detail.hxx index 36cd4f6..5889bbe 100644 --- a/include/zenoh/api/detail.hxx +++ b/include/zenoh/api/detail.hxx @@ -42,9 +42,12 @@ struct is_take_from_loaned_available : std::false_type {}; template struct is_take_from_loaned_available< - T, std::void_t(), ::z_owned_to_loaned_type_t{}))>> + T, std::void_t(), std::declval::type*>()))>> : std::true_type {}; +template +inline constexpr bool is_take_from_loaned_available_v = is_take_from_loaned_available::value; + struct null_object_t {}; inline constexpr null_object_t null_object{}; diff --git a/tests/universal/details.cxx b/tests/universal/details.cxx new file mode 100644 index 0000000..34a65f1 --- /dev/null +++ b/tests/universal/details.cxx @@ -0,0 +1,25 @@ +// +// Copyright (c) 2025 ZettaScale Technology +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 +// which is available at https://www.apache.org/licenses/LICENSE-2.0. +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// +// Contributors: +// ZettaScale Zenoh Team, +// + +#include "zenoh.hxx" + +using namespace zenoh; + +static_assert(detail::is_take_from_loaned_available_v<::z_owned_session_t> == false); +static_assert(detail::is_take_from_loaned_available_v<::z_owned_hello_t>); +static_assert(detail::is_take_from_loaned_available_v<::z_owned_sample_t>); +static_assert(detail::is_take_from_loaned_available_v<::z_owned_reply_t>); +static_assert(detail::is_take_from_loaned_available_v<::z_owned_query_t>); + +int main() { return 0; } \ No newline at end of file From 123e5230c493dc60f07fb3251c63242674775765 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 25 Feb 2025 18:30:04 +0100 Subject: [PATCH 12/16] clang format fix --- include/zenoh/api/detail.hxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/zenoh/api/detail.hxx b/include/zenoh/api/detail.hxx index 5889bbe..f86f74b 100644 --- a/include/zenoh/api/detail.hxx +++ b/include/zenoh/api/detail.hxx @@ -42,8 +42,8 @@ struct is_take_from_loaned_available : std::false_type {}; template struct is_take_from_loaned_available< - T, std::void_t(), std::declval::type*>()))>> - : std::true_type {}; + T, std::void_t(), std::declval::type*>()))>> : std::true_type {}; template inline constexpr bool is_take_from_loaned_available_v = is_take_from_loaned_available::value; From 8ad62fedc2e0ff0c586bfe969ff3da66d9fa8c7d Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Wed, 26 Feb 2025 16:38:15 +0100 Subject: [PATCH 13/16] submodule updated --- zenoh-pico | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zenoh-pico b/zenoh-pico index 0d10b49..128f980 160000 --- a/zenoh-pico +++ b/zenoh-pico @@ -1 +1 @@ -Subproject commit 0d10b492d49c6e68525e03a3f7739e8932caa84d +Subproject commit 128f980a30e3155bdc9477c2b4de07ca7c2dc241 From b98537db657269c9ec9c871a5155dcccdb7a5797 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Wed, 26 Feb 2025 17:05:41 +0100 Subject: [PATCH 14/16] moved utlity header to detail folder --- include/zenoh/api/base.hxx | 2 +- include/zenoh/api/interop.hxx | 1 - .../zenoh/{api/detail.hxx => detail/availability_checks.hxx} | 0 3 files changed, 1 insertion(+), 2 deletions(-) rename include/zenoh/{api/detail.hxx => detail/availability_checks.hxx} (100%) diff --git a/include/zenoh/api/base.hxx b/include/zenoh/api/base.hxx index aaf1ce0..c39e474 100644 --- a/include/zenoh/api/base.hxx +++ b/include/zenoh/api/base.hxx @@ -19,7 +19,7 @@ #include #include "../zenohc.hxx" -#include "detail.hxx" +#include "../detail/availability_checks.hxx" namespace zenoh { diff --git a/include/zenoh/api/interop.hxx b/include/zenoh/api/interop.hxx index 1f233d8..24d18d6 100644 --- a/include/zenoh/api/interop.hxx +++ b/include/zenoh/api/interop.hxx @@ -16,7 +16,6 @@ #include #include "base.hxx" -#include "detail.hxx" namespace zenoh::interop { diff --git a/include/zenoh/api/detail.hxx b/include/zenoh/detail/availability_checks.hxx similarity index 100% rename from include/zenoh/api/detail.hxx rename to include/zenoh/detail/availability_checks.hxx From 5a3675a14192d098be5ade2a85b048ea38d5a850 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Wed, 26 Feb 2025 17:07:38 +0100 Subject: [PATCH 15/16] clang format --- include/zenoh/api/base.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zenoh/api/base.hxx b/include/zenoh/api/base.hxx index c39e474..d96b154 100644 --- a/include/zenoh/api/base.hxx +++ b/include/zenoh/api/base.hxx @@ -18,8 +18,8 @@ #include #include -#include "../zenohc.hxx" #include "../detail/availability_checks.hxx" +#include "../zenohc.hxx" namespace zenoh { From 2bd3b5ec3a81a9da3691f9a25d7312484cbc9274 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Fri, 28 Feb 2025 15:20:01 +0100 Subject: [PATCH 16/16] submodules updated --- zenoh-c | 2 +- zenoh-pico | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zenoh-c b/zenoh-c index fd8567b..af53af3 160000 --- a/zenoh-c +++ b/zenoh-c @@ -1 +1 @@ -Subproject commit fd8567b631c8836f1239714029c1f395213bb095 +Subproject commit af53af345cf7263b13954b4553b654c1d9c5cfb5 diff --git a/zenoh-pico b/zenoh-pico index 128f980..1238f04 160000 --- a/zenoh-pico +++ b/zenoh-pico @@ -1 +1 @@ -Subproject commit 128f980a30e3155bdc9477c2b4de07ca7c2dc241 +Subproject commit 1238f04f5fd14161b6d0009b067a1f4a8a3a2acf