From 60d0f8da2b754d1deb0dbb59f6e6783ba4c692c4 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Wed, 29 May 2024 21:16:06 +0200 Subject: Reworked id_map and trying to fix sycl launch --- modules/io_codec/c++/rpc.hpp | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'modules/io_codec') diff --git a/modules/io_codec/c++/rpc.hpp b/modules/io_codec/c++/rpc.hpp index 66b7c41..04293cd 100644 --- a/modules/io_codec/c++/rpc.hpp +++ b/modules/io_codec/c++/rpc.hpp @@ -11,27 +11,63 @@ namespace saw { /** - * + * This class acts as a helper for rpc calls and representing data on the remote. */ template class data_or_id { private: + /** + * Variant representing the either id or data class. + */ std::variant, data> doi_; public: + /** + * Constructor for instantiating. + */ data_or_id(const id& val): doi_{val} {} + /** + * Constructor for instantiating. + */ data_or_id(data val): doi_{std::move(val)} {} + /** + * Check if this class holds an id. + */ bool is_id() const { - return false; + return std::holds_alternative>(doi_); } + /** + * Check if this class holds data. + */ bool is_data() const { - return false; + return std::holds_alternative>(doi_); + } + + /** + * Returns the id. + */ + id get_id() const { + return std::get>(doi_); + } + + /** + * Return a data reference. + */ + data& get_data(){ + return std::get>(doi_); + } + + /** + * Return a data reference. + */ + const data& get_data() const { + return std::get>(doi_); } }; -- cgit v1.2.3