DynExp
Highly flexible laboratory automation for dynamically changing experiments.
DynExpModule::gRPCModule< gRPCServices >::CallDataBase Class Referenceabstract

Base class for all TypedCallDataBase classes. Instances of this class manage the state of a single remote procedure call. More...

+ Inheritance diagram for DynExpModule::gRPCModule< gRPCServices >::CallDataBase:

Public Member Functions

virtual ~CallDataBase ()
 
auto GetOwningModule () const noexcept
 Getter for the gRPC server this remote procedure call belongs to. More...
 
void Proceed (DynExp::ModuleInstance &Instance)
 Calls the state function of the current state of CallDataBase::StateMachine by a call to Util::StateMachine::Invoke(). This function is called by gRPCModule::ModuleMainLoop() after the state of the remote procedure call as contained in gRPCModule::ServerQueue has changed. More...
 

Protected Member Functions

 CallDataBase (const gRPCModule *const OwningModule) noexcept
 Constructs a CallDataBase instance. More...
 
auto * GetServerContext () noexcept
 Getter for the gRPC server context. More...
 

Private Types

enum class  StateType { Init , Process , Exit }
 Type defining the possible states of remote procedure calls as used by CallDataBase::StateMachine. More...
 
using StateMachineStateType = Util::StateMachineState< StateType(CallDataBase::*)(DynExp::ModuleInstance &)>
 Alias for the state machine state type managed by CallDataBase::StateMachine. More...
 

Private Member Functions

StateType InitStateFunc (DynExp::ModuleInstance &Instance)
 State function for the CallDataBase::InitState state. Calls InitChild(). More...
 
StateType ProcessStateFunc (DynExp::ModuleInstance &Instance)
 State function for the CallDataBase::ProcessState state. Calls ProcessChild(). More...
 
StateType ExitStateFunc (DynExp::ModuleInstance &Instance)
 State function for the CallDataBase::ExitState state. Deletes this instance. More...
 
Override

Overridden by TypedCallDataBase.

virtual void InitChild (DynExp::ModuleInstance &Instance)=0
 Tells gRPC that this CallDataBase instance is ready to handle a respective (as determined by TypedCallDataBase) remote procedure call. More...
 
virtual void ProcessChild (DynExp::ModuleInstance &Instance)=0
 Creates a new TypedCallDataBase instance of the same type to handle a further remote procedure call, handles this call by invoking TypedCallDataBase::ProcessChildImpl(), and sends the server's response back to the client. More...
 

Private Attributes

const gRPCModule *const OwningModule
 gRPC server this remote procedure call belongs to More...
 
Util::StateMachine< StateMachineStateTypeStateMachine
 State machine based on the states listed in StateType to manage this remote procedure call's state. More...
 
grpc::ServerContext ServerContext
 Information about the remote procedure call. Refer to gRPC documentation. More...
 

Static Private Attributes

static constexpr auto InitState = Util::StateMachineState(StateType::Init, &CallDataBase::InitStateFunc)
 State machine state for the StateType::Init state. More...
 
static constexpr auto ProcessState = Util::StateMachineState(StateType::Process, &CallDataBase::ProcessStateFunc)
 State machine state for the StateType::Process state. More...
 
static constexpr auto ExitState = Util::StateMachineState(StateType::Exit, &CallDataBase::ExitStateFunc, "", true)
 State machine state for the StateType::Exit state. More...
 

Detailed Description

template<typename... gRPCServices>
class DynExpModule::gRPCModule< gRPCServices >::CallDataBase

Base class for all TypedCallDataBase classes. Instances of this class manage the state of a single remote procedure call.

Definition at line 187 of file gRPCModule.h.

Member Typedef Documentation

◆ StateMachineStateType

template<typename... gRPCServices>
using DynExpModule::gRPCModule< gRPCServices >::CallDataBase::StateMachineStateType = Util::StateMachineState<StateType(CallDataBase::*)(DynExp::ModuleInstance&)>
private

Alias for the state machine state type managed by CallDataBase::StateMachine.

Definition at line 202 of file gRPCModule.h.

Member Enumeration Documentation

◆ StateType

template<typename... gRPCServices>
enum DynExpModule::gRPCModule::CallDataBase::StateType
strongprivate

Type defining the possible states of remote procedure calls as used by CallDataBase::StateMachine.

Enumerator
Init 

The remote procedure call's waiting state directly after construction.

Process 

The remote procedure call's state when it was invoked by a client.

Exit 

The remote procedure call's state after it has been handled by the server.

Definition at line 193 of file gRPCModule.h.

Constructor & Destructor Documentation

◆ CallDataBase()

template<typename... gRPCServices>
DynExpModule::gRPCModule< gRPCServices >::CallDataBase::CallDataBase ( const gRPCModule *const  OwningModule)
inlineprotectednoexcept

Constructs a CallDataBase instance.

Parameters
OwningModulegRPC server this remote procedure call belongs to

Definition at line 209 of file gRPCModule.h.

◆ ~CallDataBase()

template<typename... gRPCServices>
virtual DynExpModule::gRPCModule< gRPCServices >::CallDataBase::~CallDataBase ( )
inlinevirtual

Definition at line 213 of file gRPCModule.h.

Member Function Documentation

◆ ExitStateFunc()

template<typename... gRPCServices>
StateType DynExpModule::gRPCModule< gRPCServices >::CallDataBase::ExitStateFunc ( DynExp::ModuleInstance Instance)
inlineprivate

State function for the CallDataBase::ExitState state. Deletes this instance.

Parameters
InstanceHandle to the server module thread's data
Returns
Returns the new state to transition to (StateType::Exit). This has no meaning since the instance is deleted after this function.

Definition at line 288 of file gRPCModule.h.

◆ GetOwningModule()

template<typename... gRPCServices>
auto DynExpModule::gRPCModule< gRPCServices >::CallDataBase::GetOwningModule ( ) const
inlinenoexcept

Getter for the gRPC server this remote procedure call belongs to.

Returns
Returns OwningModule.

Definition at line 219 of file gRPCModule.h.

◆ GetServerContext()

template<typename... gRPCServices>
auto* DynExpModule::gRPCModule< gRPCServices >::CallDataBase::GetServerContext ( )
inlineprotectednoexcept

Getter for the gRPC server context.

Returns
Returns ServerContext.

Definition at line 234 of file gRPCModule.h.

◆ InitChild()

template<typename... gRPCServices>
virtual void DynExpModule::gRPCModule< gRPCServices >::CallDataBase::InitChild ( DynExp::ModuleInstance Instance)
privatepure virtual

Tells gRPC that this CallDataBase instance is ready to handle a respective (as determined by TypedCallDataBase) remote procedure call.

Parameters
InstanceHandle to the server module thread's data

Implemented in DynExpModule::gRPCModule< gRPCServices >::TypedCallDataBase< DerivedType, gRPCService, RequestMessageType, ResponseMessageType,... >.

◆ InitStateFunc()

template<typename... gRPCServices>
StateType DynExpModule::gRPCModule< gRPCServices >::CallDataBase::InitStateFunc ( DynExp::ModuleInstance Instance)
inlineprivate

State function for the CallDataBase::InitState state. Calls InitChild().

Parameters
InstanceHandle to the server module thread's data
Returns
Returns the new state to transition to (StateType::Process).

Definition at line 263 of file gRPCModule.h.

◆ Proceed()

template<typename... gRPCServices>
void DynExpModule::gRPCModule< gRPCServices >::CallDataBase::Proceed ( DynExp::ModuleInstance Instance)
inline

Calls the state function of the current state of CallDataBase::StateMachine by a call to Util::StateMachine::Invoke(). This function is called by gRPCModule::ModuleMainLoop() after the state of the remote procedure call as contained in gRPCModule::ServerQueue has changed.

Parameters
InstanceHandle to the server module thread's data

Definition at line 227 of file gRPCModule.h.

◆ ProcessChild()

template<typename... gRPCServices>
virtual void DynExpModule::gRPCModule< gRPCServices >::CallDataBase::ProcessChild ( DynExp::ModuleInstance Instance)
privatepure virtual

Creates a new TypedCallDataBase instance of the same type to handle a further remote procedure call, handles this call by invoking TypedCallDataBase::ProcessChildImpl(), and sends the server's response back to the client.

Parameters
InstanceHandle to the server module thread's data

Implemented in DynExpModule::gRPCModule< gRPCServices >::TypedCallDataBase< DerivedType, gRPCService, RequestMessageType, ResponseMessageType,... >.

◆ ProcessStateFunc()

template<typename... gRPCServices>
StateType DynExpModule::gRPCModule< gRPCServices >::CallDataBase::ProcessStateFunc ( DynExp::ModuleInstance Instance)
inlineprivate

State function for the CallDataBase::ProcessState state. Calls ProcessChild().

Parameters
InstanceHandle to the server module thread's data
Returns
Returns the new state to transition to (StateType::Exit).

Definition at line 275 of file gRPCModule.h.

Member Data Documentation

◆ ExitState

template<typename... gRPCServices>
constexpr auto DynExpModule::gRPCModule< gRPCServices >::CallDataBase::ExitState = Util::StateMachineState(StateType::Exit, &CallDataBase::ExitStateFunc, "", true)
staticconstexprprivate

State machine state for the StateType::Exit state.

Definition at line 308 of file gRPCModule.h.

◆ InitState

template<typename... gRPCServices>
constexpr auto DynExpModule::gRPCModule< gRPCServices >::CallDataBase::InitState = Util::StateMachineState(StateType::Init, &CallDataBase::InitStateFunc)
staticconstexprprivate

State machine state for the StateType::Init state.

Definition at line 298 of file gRPCModule.h.

◆ OwningModule

template<typename... gRPCServices>
const gRPCModule* const DynExpModule::gRPCModule< gRPCServices >::CallDataBase::OwningModule
private

gRPC server this remote procedure call belongs to

Definition at line 310 of file gRPCModule.h.

◆ ProcessState

template<typename... gRPCServices>
constexpr auto DynExpModule::gRPCModule< gRPCServices >::CallDataBase::ProcessState = Util::StateMachineState(StateType::Process, &CallDataBase::ProcessStateFunc)
staticconstexprprivate

State machine state for the StateType::Process state.

Definition at line 303 of file gRPCModule.h.

◆ ServerContext

template<typename... gRPCServices>
grpc::ServerContext DynExpModule::gRPCModule< gRPCServices >::CallDataBase::ServerContext
private

Information about the remote procedure call. Refer to gRPC documentation.

Definition at line 312 of file gRPCModule.h.

◆ StateMachine

template<typename... gRPCServices>
Util::StateMachine<StateMachineStateType> DynExpModule::gRPCModule< gRPCServices >::CallDataBase::StateMachine
private

State machine based on the states listed in StateType to manage this remote procedure call's state.

Definition at line 311 of file gRPCModule.h.


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