From 86b06a3fee2cd7635a9ab486e2a35bdf1e81ce38 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Fri, 21 Jun 2024 19:44:34 +0200 Subject: Moving forward with basic test for sycl --- modules/codec/c++/interface.hpp | 22 +++++++++++++++++----- modules/codec/c++/schema.hpp | 6 ++++++ 2 files changed, 23 insertions(+), 5 deletions(-) (limited to 'modules/codec/c++') diff --git a/modules/codec/c++/interface.hpp b/modules/codec/c++/interface.hpp index 0f41f55..e1c9a12 100644 --- a/modules/codec/c++/interface.hpp +++ b/modules/codec/c++/interface.hpp @@ -12,28 +12,40 @@ template +struct FuncReturnTypeHelper { + using Type = data; +}; + +template +struct FuncReturnTypeHelper { + using Type = void; +}; + template struct FuncTypeHelper { - using Type = std::function(data&, Ctx)>; + using Type = std::function::Type>(data&, Ctx)>; }; template struct FuncTypeHelper { - using Type = std::function(data&)>; + using Type = std::function::Type>(data&)>; }; + } template class function, Encode, Storage, Context> { private: typename impl::FuncTypeHelper::Type func_; + using ResponseDataType = typename impl::FuncReturnTypeHelper::Type; public: template function(Func func): func_{std::move(func)} {} - error_or> call(data& req, Context ctx = {}){ + error_or call(data& req, Context ctx = {}){ if constexpr (std::is_same_v){ (void) ctx; return func_(req); @@ -84,13 +96,13 @@ public: template error_or< - data< + typename impl::FuncReturnTypeHelper< typename parameter_pack_type< parameter_key_pack_index< Lit, Names... >::value , Responses...>::type - , Encode, Storage>> call( + , Encode, Storage>::Type > call( data< typename parameter_pack_type< parameter_key_pack_index< diff --git a/modules/codec/c++/schema.hpp b/modules/codec/c++/schema.hpp index 2ef7c77..6a69425 100644 --- a/modules/codec/c++/schema.hpp +++ b/modules/codec/c++/schema.hpp @@ -11,6 +11,12 @@ template struct is_primitive { namespace schema { // NOLINTBEGIN + +/** + * Void Type used for function schemas + */ +struct Void {}; + template struct Member { static constexpr string_literal name = "Member"; -- cgit v1.2.3