ADTF
3.14.3
|
The RPC Package defines a generic interprocess communication (remote procedure call) programming model. The main header to include is:
One of the basic prerequisites for creating a set of independent tools is the possibility to let the tools communicate with each other. A common way of handling communication between different processes may be provided by an extensible RPC mechanism.
Starting from ADTF 3.1 the RPC package uses libjsoncpp and libjson-rpc-cpp to perform the heavy lifting of handling remote calls. These libraries are integrated into this library, so there is no need for them to be installed on your system seperately. For additional documentation on stubs and json take a look at https://github.com/cinemast/libjson-rpc-cpp.
First start with defining you interface via a *.json* file, in this case a simple calculator
To generate the neccessary stub headers you can use the supplied CMake macros
and
In our case somethin like the following will do the job:
You can then create a simple client with the help of the rpc::jsonrpc_remote_object template:
To implement the remote objects functionality you need to subclass rpc::jsonrpc_object_server and implement the pure virtual methods of the generated stub.
In order for the remote object to be accessible we need to create an RPC server
The RPC Package depends on the a_util library.
The package RPC is delivered under the MPL - Mozilla Public License - Version 2.0
The package RPC is delivered with the following 3rdparty dependencies:
Their license disclaimers can be found here.