cpp-msgpack-rpc 0.2.0
An RPC library implementing MessagePack RPC.
Loading...
Searching...
No Matches
msgpack_rpc::transport::BackgroundTaskStateMachine Class Reference

Class of state machines of background tasks in connections and acceptors. More...

#include <msgpack_rpc/transport/background_task_state_machine.h>

Collaboration diagram for msgpack_rpc::transport::BackgroundTaskStateMachine:

Public Types

enum class  State { INIT , STARTING , PROCESSING , STOPPED }
 Enumeration of states. More...

Public Member Functions

 BackgroundTaskStateMachine ()=default
 Constructor.
void handle_processing_started ()
 Handle the condition that processing is started.
void handle_processing_stopped ()
 Handle the condition that processing has been stopped.
void handle_start_request ()
 Handle the condition that starting processing is requested.
bool handle_stop_requested ()
 Handle the condition that stopping processing is requested.
bool is_processing () const noexcept
 Check whether processing.

Private Attributes

std::atomic< Statestate_ {State::INIT}
 Whether the process of this connection is started.

Detailed Description

Class of state machines of background tasks in connections and acceptors.

Definition at line 33 of file background_task_state_machine.h.

Member Enumeration Documentation

◆ State

Enumeration of states.

Enumerator
INIT 

Initial state.

STARTING 

Starting.

PROCESSING 

Processing.

STOPPED 

Stopped.

Definition at line 36 of file background_task_state_machine.h.

Member Function Documentation

◆ handle_processing_started()

void msgpack_rpc::transport::BackgroundTaskStateMachine::handle_processing_started ( )
inline

Handle the condition that processing is started.

Definition at line 69 of file background_task_state_machine.h.

◆ handle_processing_stopped()

void msgpack_rpc::transport::BackgroundTaskStateMachine::handle_processing_stopped ( )
inline

Handle the condition that processing has been stopped.

Definition at line 87 of file background_task_state_machine.h.

◆ handle_start_request()

void msgpack_rpc::transport::BackgroundTaskStateMachine::handle_start_request ( )
inline

Handle the condition that starting processing is requested.

Definition at line 56 of file background_task_state_machine.h.

◆ handle_stop_requested()

bool msgpack_rpc::transport::BackgroundTaskStateMachine::handle_stop_requested ( )
inline

Handle the condition that stopping processing is requested.

Return values
trueNot stopped yet, so stop is required.
falseAlready stopped, so stop is not required.

Definition at line 79 of file background_task_state_machine.h.

◆ is_processing()

bool msgpack_rpc::transport::BackgroundTaskStateMachine::is_processing ( ) const
inlinenodiscardnoexcept

Check whether processing.

Return values
trueCurrently processing.
falseCurrently not processing.

Definition at line 97 of file background_task_state_machine.h.

Member Data Documentation

◆ state_

std::atomic<State> msgpack_rpc::transport::BackgroundTaskStateMachine::state_ {State::INIT}
private

Whether the process of this connection is started.

Definition at line 103 of file background_task_state_machine.h.


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