47 #ifndef _MIRA_RPCINVOKER_H__ 48 #define _MIRA_RPCINVOKER_H__ 51 #include <type_traits> 53 #include <boost/preprocessor/repetition.hpp> 93 template<
typename Backend>
100 virtual void invoke(
typename Backend::ServerRequest& request,
101 typename Backend::ServerResponse& response) = 0;
111 template<
typename Backend,
typename T>
115 request.getParameter(p);
120 template<
typename Response>
134 catch (std::exception& ex) {
150 template<
typename Backend,
typename Fn,
typename... ARGS>
151 static void invoke(
typename Backend::ServerResponse& response,
const Fn& fn, ARGS&&... parameters)
154 response.template returnResult<R>(fn(std::forward<ARGS>(parameters)...));
166 template<
typename Backend,
typename Fn,
typename... ARGS>
167 static void invoke(
typename Backend::ServerResponse& response,
const Fn& fn, ARGS&&... parameters)
170 fn(std::forward<ARGS>(parameters)...);
176 response.returnVoid();
186 template<
typename Backend,
typename MemFn,
typename Class,
typename... ARGS>
187 static void invoke(
typename Backend::ServerResponse& response,
const MemFn& fn,
Class* obj,
188 ARGS&&... parameters)
191 response.template returnResult<R>(fn(obj, std::forward<ARGS>(parameters)...));
203 template<
typename Backend,
typename MemFn,
typename Class,
typename... ARGS>
204 static void invoke(
typename Backend::ServerResponse& response,
const MemFn& fn,
Class* obj,
205 ARGS&&... parameters)
208 fn(obj, std::forward<ARGS>(parameters)...);
214 response.returnVoid();
218 template<
typename Backend,
typename R,
typename... ARGS>
224 return Private::getFromRequest<Backend, P>(request);
227 typedef std::function<R(ARGS...)>
Fn;
230 void invoke(
typename Backend::ServerRequest& request,
typename Backend::ServerResponse& response)
final 237 template<
typename Head,
typename... Tail,
typename... Args>
238 void parseArguments(
typename Backend::ServerRequest& request,
typename Backend::ServerResponse& response,
241 parseArguments<Tail...>(request, response, std::forward<Args>(args)..., getParameter<Head>(request));
245 template<
typename... Ignore>
246 void parseArguments(
typename Backend::ServerRequest& request,
typename Backend::ServerResponse& response,
255 template<
typename Backend,
typename MemFn,
typename Class,
typename... ARGS>
261 return Private::getFromRequest<Backend, P>(request);
266 void invoke(
typename Backend::ServerRequest& request,
typename Backend::ServerResponse& response)
final 273 template<
typename Head,
typename... Tail,
typename... Args>
274 void parseArguments(
typename Backend::ServerRequest& request,
typename Backend::ServerResponse& response,
277 parseArguments<Tail...>(request, response, std::forward<Args>(args)..., getParameter<Head>(request));
281 template<
typename... Ignore>
282 void parseArguments(
typename Backend::ServerRequest& request,
typename Backend::ServerResponse& response,
286 response,
fn,
This, std::move(args)...);
297 template<
typename Backend,
typename R,
typename... ARGS,
typename Fn>
303 template<
typename Backend,
typename... ARGS,
typename MemFn,
typename Class>
Definition: RPCInvoker.h:148
static void invoke(typename Backend::ServerResponse &response, const MemFn &fn, Class *obj, ARGS &&... parameters)
Definition: RPCInvoker.h:187
void parseArguments(typename Backend::ServerRequest &request, typename Backend::ServerResponse &response, Private::StrippedType< ARGS > &&... args)
Definition: RPCInvoker.h:282
ConcreteRPCInvoker(const Fn &f)
Definition: RPCInvoker.h:228
Definition: RPCInvoker.h:184
Fn fn
Definition: RPCInvoker.h:252
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
Error codes for reasons of errors/exceptions while processing an rpc call.
Invoker that is used to invoke an RPC method call for a special backend.
Definition: RPCInvoker.h:94
Class object which supports some kind of class reflection.
Definition: Class.h:97
void invoke(typename Backend::ServerRequest &request, typename Backend::ServerResponse &response) final
object is pointer to service object whose method is called
Definition: RPCInvoker.h:230
Class * This
Definition: RPCInvoker.h:290
void parseArguments(typename Backend::ServerRequest &request, typename Backend::ServerResponse &response, Args &&... args)
Definition: RPCInvoker.h:274
typename std::remove_const< typename std::remove_reference< P >::type >::type StrippedType
Definition: RPCInvoker.h:109
ConcreteRPCInvoker(Fn &&f)
Definition: RPCInvoker.h:229
An exception has occurred within the method that was called.
Definition: RPCError.h:69
ConcreteRPCInvoker_memfn(const MemFn &f, Class *obj)
Definition: RPCInvoker.h:264
PropertyHint type(const std::string &t)
Sets the attribute "type" to the specified value.
Definition: PropertyHint.h:295
Definition: RPCInvoker.h:256
std::function< R(ARGS...)> Fn
Definition: RPCInvoker.h:227
static void invoke(typename Backend::ServerResponse &response, const Fn &fn, ARGS &&... parameters)
Definition: RPCInvoker.h:167
const CallStack & callStack() const
Returns the state of the callstack at the moment when the exception was thrown.
Definition: Exception.h:252
static void invoke(typename Backend::ServerResponse &response, const Fn &fn, ARGS &&... parameters)
Definition: RPCInvoker.h:151
virtual ~RPCInvoker()
Definition: RPCInvoker.h:73
Base of all TRPCInvoker classes which are templates to support different RPC backends.
Definition: RPCInvoker.h:70
Base class for exceptions.
Definition: Exception.h:194
MemFn fn
Definition: RPCInvoker.h:289
static Private::StrippedType< P > getParameter(typename Backend::ServerRequest &request)
Definition: RPCInvoker.h:259
static Private::StrippedType< P > getParameter(typename Backend::ServerRequest &request)
Definition: RPCInvoker.h:222
Definition: RPCInvoker.h:219
virtual void invoke(typename Backend::ServerRequest &request, typename Backend::ServerResponse &response)=0
object is pointer to service object whose method is called
void parseArguments(typename Backend::ServerRequest &request, typename Backend::ServerResponse &response, Args &&... args)
Definition: RPCInvoker.h:238
void parseArguments(typename Backend::ServerRequest &request, typename Backend::ServerResponse &response, Private::StrippedType< ARGS > &&... args)
Definition: RPCInvoker.h:246
ConcreteRPCInvoker_memfn(MemFn &&f, Class *obj)
Definition: RPCInvoker.h:265
virtual const char * what() const MIRA_NOEXCEPT_OR_NOTHROW
Returns the text of exception containing the information given in MIRA_THROW and MIRA_RETHROW as well...
void throwRPCException(Response &response)
Definition: RPCInvoker.h:121
StrippedType< T > getFromRequest(typename Backend::ServerRequest &request)
Definition: RPCInvoker.h:112
Private::ConcreteRPCInvoker< Backend, R, ARGS... > * make_RPCInvoker(Fn &&f)
Definition: RPCInvoker.h:298
Definition: Exceptions.h:85
void invoke(typename Backend::ServerRequest &request, typename Backend::ServerResponse &response) final
object is pointer to service object whose method is called
Definition: RPCInvoker.h:266
static void invoke(typename Backend::ServerResponse &response, const MemFn &fn, Class *obj, ARGS &&... parameters)
Definition: RPCInvoker.h:204