47 #ifndef _MIRA_RPCINVOKER_H__ 48 #define _MIRA_RPCINVOKER_H__ 51 #include <type_traits> 90 template<
typename Backend>
97 virtual void invoke(
typename Backend::ServerRequest& request,
98 typename Backend::ServerResponse& response) = 0;
108 template<
typename Backend,
typename T>
112 request.getParameter(p);
117 template<
typename Response>
131 catch (std::exception& ex) {
147 template<
typename Backend,
typename Fn,
typename... ARGS>
148 static void invoke(
typename Backend::ServerResponse& response,
const Fn& fn, ARGS&&... parameters)
151 response.template returnResult<R>(fn(std::forward<ARGS>(parameters)...));
163 template<
typename Backend,
typename Fn,
typename... ARGS>
164 static void invoke(
typename Backend::ServerResponse& response,
const Fn& fn, ARGS&&... parameters)
167 fn(std::forward<ARGS>(parameters)...);
173 response.returnVoid();
177 template<
typename MemFn,
typename Class>
184 typedef typename MemFn::result_type
ResultType;
186 template<
typename... ARGS>
189 return fn(This, std::forward<ARGS>(args)...);
197 template<
typename Backend,
typename Function,
typename R,
typename... ARGS>
203 return Private::getFromRequest<Backend, P>(request);
208 void invoke(
typename Backend::ServerRequest& request,
typename Backend::ServerResponse& response)
final 215 template<
typename Head,
typename... Tail,
typename... Args>
216 void parseArguments(
typename Backend::ServerRequest& request,
typename Backend::ServerResponse& response,
219 parseArguments<Tail...>(request, response, std::forward<Args>(args)..., getParameter<Head>(request));
223 template<
typename... Ignore>
224 void parseArguments(
typename Backend::ServerRequest& request,
typename Backend::ServerResponse& response,
237 template<
typename Backend,
typename R,
typename... ARGS,
typename Fn>
241 std::forward<Fn>(f));
Function fn
Definition: RPCInvoker.h:230
Definition: RPCInvoker.h:145
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:182
ConcreteRPCInvoker(const Function &f)
Definition: RPCInvoker.h:206
Invoker that is used to invoke an RPC method call for a special backend.
Definition: RPCInvoker.h:91
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:208
typename std::remove_const< typename std::remove_reference< P >::type >::type StrippedType
Definition: RPCInvoker.h:106
Definition: RPCInvoker.h:178
Private::ConcreteRPCInvoker< Backend, typename std::decay< Fn >::type, R, ARGS... > * make_RPCInvoker(Fn &&f)
Definition: RPCInvoker.h:238
MemberInvoker(const MemFn &func, Class *ptr)
Definition: RPCInvoker.h:181
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:164
const CallStack & callStack() const
Returns the state of the callstack at the moment when the exception was thrown.
Definition: Exception.h:253
static void invoke(typename Backend::ServerResponse &response, const Fn &fn, ARGS &&... parameters)
Definition: RPCInvoker.h:148
virtual ~RPCInvoker()
Definition: RPCInvoker.h:70
Base of all TRPCInvoker classes which are templates to support different RPC backends.
Definition: RPCInvoker.h:67
Base class for exceptions.
Definition: Exception.h:195
ConcreteRPCInvoker(Function &&f)
Definition: RPCInvoker.h:207
ResultType operator()(ARGS &&... args) const
Definition: RPCInvoker.h:187
static Private::StrippedType< P > getParameter(typename Backend::ServerRequest &request)
Definition: RPCInvoker.h:201
Definition: RPCInvoker.h:198
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:216
void parseArguments(typename Backend::ServerRequest &request, typename Backend::ServerResponse &response, Private::StrippedType< ARGS > &&... args)
Definition: RPCInvoker.h:224
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:118
StrippedType< T > getFromRequest(typename Backend::ServerRequest &request)
Definition: RPCInvoker.h:109
Definition: Exceptions.h:85