summaryrefslogtreecommitdiff
path: root/modules/remote/c++/remote.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/remote/c++/remote.hpp')
-rw-r--r--modules/remote/c++/remote.hpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/modules/remote/c++/remote.hpp b/modules/remote/c++/remote.hpp
index 0f508f5..7e846d3 100644
--- a/modules/remote/c++/remote.hpp
+++ b/modules/remote/c++/remote.hpp
@@ -84,13 +84,32 @@ class rpc_client;
namespace impl {
template<typename T, typename Encoding, typename Remote>
-struct tmpl_group_to_std_data_server_tuple;
+struct tmpl_group_to_data_server_ptr_std_tuple;
template<typename... T, typename Encoding, typename Remote>
-struct tmpl_group_to_std_data_server_ptr_tuple<tmpl_group<T...>, Encoding, Remote> {
+struct tmpl_group_to_data_server_ptr_std_tuple<tmpl_group<T...>, Encoding, Remote> {
using type = std::tuple<ptr<data_server<T,Encoding,Remote>>...>;
};
}
+template<typename Remote>
+class i_rpc_server {
+protected:
+ virtual ~i_rpc_server() = default;
+public:
+ virtual std::pair<uint32_t,uint32_t> get_class_id() const = 0;
+
+ template<typename To>
+ error_or<ptr<To>> cast_to(){
+ {
+ auto rhs = get_class_id();
+ if(To::class_id.first == rhs.first && To::class_id.second == rhs.second){
+ return {ptr<To>{*static_cast<To*>(this)}};
+ }
+ }
+
+ return make_error<err::invalid_state>("Class IDs are not matching.");
+ }
+};
/**
* Implementation of a remote server on the backend