CARLA
Public Member Functions | Private Attributes | List of all members
carla::rpc::Server Class Reference

An RPC server in which functions can be bind to run synchronously or asynchronously. More...

#include <Server.h>

+ Collaboration diagram for carla::rpc::Server:

Public Member Functions

void AsyncRun (size_t worker_threads)
 
template<typename FunctorT >
void BindAsync (const std::string &name, FunctorT &&functor)
 
template<typename FunctorT >
void BindSync (const std::string &name, FunctorT &&functor)
 
template<typename... Args>
 Server (Args &&... args)
 
void Stop ()
 
void SyncRunFor (time_duration duration)
 

Private Attributes

::rpc::server _server
 
boost::asio::io_context _sync_io_context
 

Detailed Description

An RPC server in which functions can be bind to run synchronously or asynchronously.

Use AsyncRun to start the worker threads, and use SyncRunFor to run a slice of work in the caller's thread.

Functions that are bind using BindAsync will run asynchronously in the worker threads. Functions that are bind using BindSync will run within SyncRunFor function.

Definition at line 37 of file rpc/Server.h.

Constructor & Destructor Documentation

◆ Server()

template<typename ... Args>
carla::rpc::Server::Server ( Args &&...  args)
inlineexplicit

Definition at line 146 of file rpc/Server.h.

References _server.

Member Function Documentation

◆ AsyncRun()

void carla::rpc::Server::AsyncRun ( size_t  worker_threads)
inline

Definition at line 49 of file rpc/Server.h.

References _server.

Referenced by TEST().

+ Here is the caller graph for this function:

◆ BindAsync()

template<typename FunctorT >
void carla::rpc::Server::BindAsync ( const std::string &  name,
FunctorT &&  functor 
)
inline

Definition at line 160 of file rpc/Server.h.

References _server.

◆ BindSync()

template<typename FunctorT >
void carla::rpc::Server::BindSync ( const std::string &  name,
FunctorT &&  functor 
)
inline

Definition at line 152 of file rpc/Server.h.

References _server, and _sync_io_context.

Referenced by TEST().

+ Here is the caller graph for this function:

◆ Stop()

void carla::rpc::Server::Stop ( void  )
inline
Warning
does not stop the game thread.

Definition at line 64 of file rpc/Server.h.

References _server.

◆ SyncRunFor()

void carla::rpc::Server::SyncRunFor ( time_duration  duration)
inline

Definition at line 53 of file rpc/Server.h.

References _sync_io_context, and carla::time_duration::to_chrono().

Referenced by TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ _server

::rpc::server carla::rpc::Server::_server
private

Definition at line 72 of file rpc/Server.h.

Referenced by AsyncRun(), BindAsync(), BindSync(), Server(), and Stop().

◆ _sync_io_context

boost::asio::io_context carla::rpc::Server::_sync_io_context
private

Definition at line 70 of file rpc/Server.h.

Referenced by BindSync(), and SyncRunFor().


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