MIRA
Public Member Functions | List of all members
JSONRPCBackend::ServerResponse Class Reference

JSON server-side response. More...

#include <rpc/JSONRPCBackend.h>

Public Member Functions

 ServerResponse (json::Value *value)
 
void setHeader (const std::string &callId)
 Write the response header consisting of the ID of the call. More...
 
void returnException (RPCError reason, const std::string &message)
 Write exception as result an RPC call. More...
 
void returnException (RPCError reason, const std::string &message, const CallStack &callstack)
 Write exception as result an RPC call. More...
 
void returnException (RPCError reason, SerializableException &ex)
 Write exception as result an RPC call. More...
 
template<typename R >
void returnResult (const R &res)
 Write result of an RPC call. More...
 
void returnVoid ()
 Write successful end of an RPC call. More...
 

Detailed Description

JSON server-side response.

The response is written to the value that is passed in the constructor.

See also
Backends

Constructor & Destructor Documentation

◆ ServerResponse()

ServerResponse ( json::Value value)
inline

Member Function Documentation

◆ setHeader()

void setHeader ( const std::string &  callId)
inline

Write the response header consisting of the ID of the call.

This method is called first by the RPCServer to create a response for a finished RPC call. It will be followed by a call of either returnException(), returnResult() or returnVoid().

◆ returnException() [1/3]

void returnException ( RPCError  reason,
const std::string &  message 
)
inline

Write exception as result an RPC call.

This method is called after setHeader() in case of an error or exception while processing the call. The reason is passed as parameter.

◆ returnException() [2/3]

void returnException ( RPCError  reason,
const std::string &  message,
const CallStack callstack 
)
inline

Write exception as result an RPC call.

This method is called after setHeader() in case of an error or exception while processing the call. The reason is passed as parameter.

◆ returnException() [3/3]

void returnException ( RPCError  reason,
SerializableException ex 
)
inline

Write exception as result an RPC call.

This method is called after setHeader() in case of an error or exception while processing the call. The reason is passed as parameter.

◆ returnResult()

void returnResult ( const R &  res)
inline

Write result of an RPC call.

This method is called after setHeader() in case of a successful RPC call that returns a value.

◆ returnVoid()

void returnVoid ( )
inline

Write successful end of an RPC call.

This method is called after setHeader() in case of a successful RPC call that does NOT return a value.


The documentation for this class was generated from the following file: