From e13f6a5e91ffeac86c32ab3a9048b810b1931061 Mon Sep 17 00:00:00 2001 From: Claudius 'keldu' Holeksa Date: Mon, 12 Aug 2024 13:42:48 +0200 Subject: wip --- modules/remote/c++/transfer.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'modules/remote/c++/transfer.hpp') diff --git a/modules/remote/c++/transfer.hpp b/modules/remote/c++/transfer.hpp index 32416de..f68497b 100644 --- a/modules/remote/c++/transfer.hpp +++ b/modules/remote/c++/transfer.hpp @@ -2,6 +2,8 @@ #include +#include + namespace saw { template class i_data_server { @@ -9,6 +11,18 @@ protected: ~i_data_server() = default; public: virtual std::pair get_class_id() const = 0; + + template + error_or> cast_to(){ + { + auto rhs = get_class_id(); + if(To::class_id.first == rhs.first && To::class_id.second == rhs.second){ + return {ptr{*static_cast(this)}}; + } + } + + return make_error("Class IDs are not matching."); + } }; template -- cgit v1.2.3