6 #ifndef CPPIPC_SERVER_DISPATCH_IMPL_HPP 7 #define CPPIPC_SERVER_DISPATCH_IMPL_HPP 10 #include <type_traits> 11 #include <boost/function.hpp> 12 #include <boost/type_traits.hpp> 13 #include <boost/function_types/function_type.hpp> 14 #include <boost/function_types/parameter_types.hpp> 15 #include <core/storage/serialization/iarchive.hpp> 16 #include <core/storage/serialization/oarchive.hpp> 17 #include <core/generics/remove_member_pointer.hpp> 18 #include <core/system/cppipc/ipc_object_base.hpp> 19 #include <core/system/cppipc/util/generics/member_function_return_type.hpp> 20 #include <core/system/cppipc/util/generics/tuple.hpp> 21 #include <core/system/cppipc/server/dispatch.hpp> 22 #include <core/system/cppipc/server/comm_server.hpp> 23 #include <core/system/cppipc/common/ipc_deserializer.hpp> 35 template <
typename RetType,
typename T,
typename MemFn,
typename... Args>
36 struct exec_and_serialize_response {
37 static void exec(T* objectptr,
42 auto ret = (objectptr->*fn)(std::forward<Args>(args)...);
43 detail::set_deserializer_to_server(server);
54 template <
typename T,
typename MemFn,
typename... Args>
56 static void exec(T* objectptr,
61 (objectptr->*fn)(std::forward<Args>(args)...);
73 template <
typename T,
typename Memfn,
typename ArgumentTuple,
typename... Args>
75 static void exec(T* objectptr,
81 typedef typename std::tuple_element<0, ArgumentTuple>::type arg_type;
82 typedef typename std::decay<arg_type>::type decayed_type;
83 decayed_type arg = decayed_type();
85 typedef typename left_shift_tuple<ArgumentTuple>::type shifted_tuple;
103 template <
typename T,
typename Memfn,
typename... Args>
105 static void exec(T* objectptr,
111 typedef typename member_function_return_type<Memfn>::type return_type;
115 Args...>::exec(objectptr, server, fn, response, args...);
130 template <
typename T,
typename Memfn>
132 static void exec(T* objectptr,
137 typedef typename boost::remove_member_pointer<Memfn>::type fntype;
154 template <
typename T,
typename MemFn>
159 void execute(
void* objectptr,
163 detail::set_deserializer_to_server(server);
173 template <
typename MemFn>
175 typedef typename boost::mpl::at_c<boost::function_types::parameter_types<MemFn>,0>::type Tref;
176 typedef typename std::decay<Tref>::type T;
The serialization input archive object which, provided with a reference to an istream, will read from the istream, providing deserialization capabilities.
dispatch * create_dispatch(MemFn memfn)
The serialization output archive object which, provided with a reference to an ostream, will write to the ostream, providing serialization capabilities.