cpp-msgpack-rpc 0.2.0
An RPC library implementing MessagePack RPC.
Loading...
Searching...
No Matches
msgpack_rpc::executors Namespace Reference

Namespace of executors to process asynchronous tasks. More...

Classes

class  GeneralExecutor
 Class of general-purpose executors. More...
class  IAsyncExecutor
 Interface of executors to process asynchronous tasks and the processing can be started asynchronously. More...
class  IExecutor
 Interface of executors to process asynchronous tasks. More...
class  ISingleThreadExecutor
 Interface of single-threaded executors. More...
class  SingleThreadExecutor
 Class of executors runs in a single thread. More...
class  Timer
 Class of timers to call functions later. More...
class  WrappingExecutor
 Class to wrap existing executors. More...

Typedefs

using AsioContextType = asio::io_context
 Type of context in asio library.

Enumerations

enum class  OperationType : std::uint8_t { TRANSPORT , CALLBACK }
 Enumeration of types of operations. More...

Functions

template<typename Function>
void async_invoke (const std::shared_ptr< IExecutor > &executor, OperationType type, Function &&function)
 Asynchronously invoke a function.
std::shared_ptr< IAsyncExecutorcreate_executor (std::shared_ptr< logging::Logger > logger, const config::ExecutorConfig &config)
 Create an executor.
std::shared_ptr< ISingleThreadExecutorcreate_single_thread_executor (std::shared_ptr< logging::Logger > logger)
 Create an executor runs in a single thread.
std::shared_ptr< IAsyncExecutorwrap_executor (std::shared_ptr< IExecutor > executor)
 Create a wrapper of an existing executor.

Detailed Description

Namespace of executors to process asynchronous tasks.

Typedef Documentation

◆ AsioContextType

using msgpack_rpc::executors::AsioContextType = asio::io_context

Type of context in asio library.

Definition at line 29 of file asio_context_type.h.

Enumeration Type Documentation

◆ OperationType

enum class msgpack_rpc::executors::OperationType : std::uint8_t
strong

Enumeration of types of operations.

Enumerator
TRANSPORT 

Transport.

CALLBACK 

Execution of callbacks.

Definition at line 29 of file operation_type.h.

Function Documentation

◆ async_invoke()

template<typename Function>
void msgpack_rpc::executors::async_invoke ( const std::shared_ptr< IExecutor > & executor,
OperationType type,
Function && function )

Asynchronously invoke a function.

Template Parameters
FunctionType of the function.
Parameters
[in]executorExecutor.
[in]typeType of the operation.
[in]functionFunction to invoke.

Definition at line 42 of file async_invoke.h.

◆ create_executor()

std::shared_ptr< IAsyncExecutor > msgpack_rpc::executors::create_executor ( std::shared_ptr< logging::Logger > logger,
const config::ExecutorConfig & config )
nodiscard

Create an executor.

Parameters
[in]loggerLogger.
[in]configConfiguration.
Returns
Executor.

Definition at line 309 of file general_executor.cpp.

◆ create_single_thread_executor()

std::shared_ptr< ISingleThreadExecutor > msgpack_rpc::executors::create_single_thread_executor ( std::shared_ptr< logging::Logger > logger)
nodiscard

Create an executor runs in a single thread.

Parameters
[in]loggerLogger.
Returns
Executor.
Warning
This function is meant to be used in tests. So some limitation exists.
Note
This executor doesn't support start, stop, last_exception functions.
This executor exits when no task exists.

Definition at line 71 of file single_thread_executor.cpp.

◆ wrap_executor()

std::shared_ptr< IAsyncExecutor > msgpack_rpc::executors::wrap_executor ( std::shared_ptr< IExecutor > executor)
nodiscard

Create a wrapper of an existing executor.

Parameters
[in]executorAn existing executor.
Returns
Wrapper of the given executor.
Note
Resulting wrapper won't call start, stop, run functions of the given executor.

Definition at line 84 of file wrapping_executor.cpp.