From 062cdfa69606374bc635874555a64a1be15ae5f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Micha=C3=ABl=20Celerier?= Date: Wed, 7 Aug 2024 12:42:44 -0400 Subject: [PATCH] [3rdparty] Update pybind11, set a proper commit for libcoap, add a type_if helper --- 3rdparty/pybind11 | 2 +- cmake/deps/coap.cmake | 2 +- src/ossia/dataflow/execution_state.hpp | 1 + src/ossia/detail/type_if.hpp | 56 ++++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 src/ossia/detail/type_if.hpp diff --git a/3rdparty/pybind11 b/3rdparty/pybind11 index 42d8593ad42..941f45bcb51 160000 --- a/3rdparty/pybind11 +++ b/3rdparty/pybind11 @@ -1 +1 @@ -Subproject commit 42d8593ad4225a634b481cd573f7aeb94de72418 +Subproject commit 941f45bcb51457884fa1afd6e24a67377d70f75c diff --git a/cmake/deps/coap.cmake b/cmake/deps/coap.cmake index bc3a9c64ea7..4ddb8752b61 100644 --- a/cmake/deps/coap.cmake +++ b/cmake/deps/coap.cmake @@ -21,7 +21,7 @@ if(NOT TARGET libcoap::coap-3) FetchContent_Declare( libcoap GIT_REPOSITORY "https://github.com/obgm/libcoap" - GIT_TAG develop + GIT_TAG main GIT_PROGRESS true ) diff --git a/src/ossia/dataflow/execution_state.hpp b/src/ossia/dataflow/execution_state.hpp index c3c1afc7ab9..f64b30146fe 100644 --- a/src/ossia/dataflow/execution_state.hpp +++ b/src/ossia/dataflow/execution_state.hpp @@ -59,6 +59,7 @@ struct OSSIA_EXPORT execution_state : public Nano::Observer { return m_devices_exec; } + ossia::net::node_base* find_node(std::string_view name) const noexcept { for(auto dev : m_devices_exec) diff --git a/src/ossia/detail/type_if.hpp b/src/ossia/detail/type_if.hpp new file mode 100644 index 00000000000..d1047e954be --- /dev/null +++ b/src/ossia/detail/type_if.hpp @@ -0,0 +1,56 @@ +#pragma once +#include + +namespace ossia +{ + +template +struct type_if; +template +struct type_if +{ + type_if() = default; + type_if(const type_if&) = default; + type_if(type_if&&) = default; + type_if& operator=(const type_if&) = default; + type_if& operator=(type_if&&) = default; + + template + type_if(U&&) + { + } + template + T& operator=(U&& u) noexcept + { + return *this; + } +}; + +template +struct type_if +{ + [[no_unique_address]] T value; + + type_if() = default; + type_if(const type_if&) = default; + type_if(type_if&&) = default; + type_if& operator=(const type_if&) = default; + type_if& operator=(type_if&&) = default; + + template + type_if(U&& other) + : value{std::forward(other)} + { + } + + operator const T&() const noexcept { return value; } + operator T&() noexcept { return value; } + operator T&&() && noexcept { return std::move(value); } + + template + T& operator=(U&& u) noexcept + { + return value = std::forward(u); + } +}; +}