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();
180 template<
typename MemFn,
typename Class>
187 typedef typename MemFn::result_type
ResultType;
189 template<
typename... ARGS>
192 return fn(This, std::forward<ARGS>(args)...);
200 template<
typename Backend,
typename Function,
typename R,
typename... ARGS>
206 return Private::getFromRequest<Backend, P>(request);
211 void invoke(
typename Backend::ServerRequest& request,
typename Backend::ServerResponse& response)
final 218 template<
typename Head,
typename... Tail,
typename... Args>
219 void parseArguments(
typename Backend::ServerRequest& request,
typename Backend::ServerResponse& response,
222 parseArguments<Tail...>(request, response, std::forward<Args>(args)..., getParameter<Head>(request));
226 template<
typename... Ignore>
227 void parseArguments(
typename Backend::ServerRequest& request,
typename Backend::ServerResponse& response,
240 template<
typename Backend,
typename R,
typename... ARGS,
typename Fn>
244 std::forward<Fn>(f));
Function fn
Definition: RPCInvoker.h:233
Definition: RPCInvoker.h:148
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.
MemFn::result_type ResultType
Definition: RPCInvoker.h:185
ConcreteRPCInvoker(const Function &f)
Definition: RPCInvoker.h:209
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:211
typename std::remove_const< typename std::remove_reference< P >::type >::type StrippedType
Definition: RPCInvoker.h:109
Definition: RPCInvoker.h:181
Private::ConcreteRPCInvoker< Backend, typename std::decay< Fn >::type, R, ARGS... > * make_RPCInvoker(Fn &&f)
Definition: RPCInvoker.h:241
MemberInvoker(const MemFn &func, Class *ptr)
Definition: RPCInvoker.h:184
An exception has occurred within the method that was called.
Definition: RPCError.h:69
PropertyHint type(const std::string &t)
Sets the attribute "type" to the specified value.
Definition: PropertyHint.h:295
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:257
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:199
ConcreteRPCInvoker(Function &&f)
Definition: RPCInvoker.h:210
ResultType operator()(ARGS &&... args) const
Definition: RPCInvoker.h:190
static Private::StrippedType< P > getParameter(typename Backend::ServerRequest &request)
Definition: RPCInvoker.h:204
Definition: RPCInvoker.h:201
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:219
void parseArguments(typename Backend::ServerRequest &request, typename Backend::ServerResponse &response, Private::StrippedType< ARGS > &&... args)
Definition: RPCInvoker.h:227
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
Definition: Exceptions.h:85