DynExp
Highly flexible laboratory automation for dynamically changing experiments.
DynExpModule::gRPCModule< gRPCServices >::TypedCallDataBase< DerivedType, gRPCService, RequestMessageType, ResponseMessageType,... > Class Template Referenceabstract

Derive from this class to implement a single remote procedure call handled by this gRPC server gRPCModule. More...

+ Inheritance diagram for DynExpModule::gRPCModule< gRPCServices >::TypedCallDataBase< DerivedType, gRPCService, RequestMessageType, ResponseMessageType,... >:

Static Public Member Functions

static void MakeCall (const gRPCModule *const OwningModule, DynExp::ModuleInstance &Instance)
 Creates a new remote procedure call of this type which awaits requests from the client. More...
 

Private Types

using ResponseWriterType = grpc::ServerAsyncResponseWriter< ResponseMessageType >
 Alias for the gRPC response writer which sends a message of type ResponseMessageType back to the client after the remote procedure call is handled. More...
 
using RequestFuncType = std::function< void(typename gRPCService::AsyncService *, grpc::ServerContext *, RequestMessageType *, ResponseWriterType *, grpc::CompletionQueue *, grpc::ServerCompletionQueue *, void *)>
 Alias for the remote procedure call function implemented by this class as part of an asynchronous gRPC service. Refer to gRPC documentation. More...
 

Private Member Functions

 TypedCallDataBase (const gRPCModule *const OwningModule, const RequestFuncType RequestFunc) noexcept
 Constructs a TypedCallDataBase instance. More...
 
virtual ~TypedCallDataBase ()=default
 
void InitChild (DynExp::ModuleInstance &Instance) override final
 Tells gRPC that this CallDataBase instance is ready to handle a respective (as determined by TypedCallDataBase) remote procedure call. More...
 
void ProcessChild (DynExp::ModuleInstance &Instance) override final
 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...
 
Override

Override by derived classes.

virtual void ProcessChildImpl (DynExp::ModuleInstance &Instance)=0
 Override to implement the server's action to handle this remote procedure call. Particularly, populate gRPCModule::ResponseMessage with the server's responses. More...
 

Private Attributes

friend DerivedType
 
const RequestFuncType RequestFunc
 Request function to register the remote procedure call derived from TypedCallDataBase with gRPC. More...
 
RequestMessageType RequestMessage
 Client's message sent along with its invocation of this remote procedure call. More...
 
ResponseMessageType ResponseMessage
 Response the server sends back to the client by finishing the remote procedure call. More...
 
ResponseWriterType ResponseWriter
 gRPC response writer to send gRPCModule::ResponseMessage back to the client. Refer to gRPC documentation. More...
 

Additional Inherited Members

- Public Member Functions inherited from DynExpModule::gRPCModule< gRPCServices >::CallDataBase
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 inherited from DynExpModule::gRPCModule< gRPCServices >::CallDataBase
 CallDataBase (const gRPCModule *const OwningModule) noexcept
 Constructs a CallDataBase instance. More...
 
auto * GetServerContext () noexcept
 Getter for the gRPC server context. More...
 

Detailed Description

template<typename... gRPCServices>
template<typename DerivedType, typename gRPCService, typename RequestMessageType, typename ResponseMessageType, typename std::enable_if_t< Util::is_contained_in_v< gRPCService, gRPCServices... >, int > = 0>
class DynExpModule::gRPCModule< gRPCServices >::TypedCallDataBase< DerivedType, gRPCService, RequestMessageType, ResponseMessageType,... >

Derive from this class to implement a single remote procedure call handled by this gRPC server gRPCModule.

Template Parameters
DerivedTypeType of the derived class (Curiously Recurring Template Pattern)
gRPCServiceType of a service implemented by this gRPC server gRPCModule for which this class implements a remote procedure call
RequestMessageTypeType of the gRPC message the client sends to this server
ResponseMessageTypeType of the gRPC message this server sends back to the client
enable_if_tEnsures that gRPCService is contained in the gRPCServices template parameter of the class gRPCModule this TypedCallDataBase class belongs to.

Definition at line 328 of file gRPCModule.h.

Member Typedef Documentation

◆ RequestFuncType

template<typename... gRPCServices>
template<typename DerivedType , typename gRPCService , typename RequestMessageType , typename ResponseMessageType , typename std::enable_if_t< Util::is_contained_in_v< gRPCService, gRPCServices... >, int > = 0>
using DynExpModule::gRPCModule< gRPCServices >::TypedCallDataBase< DerivedType, gRPCService, RequestMessageType, ResponseMessageType,... >::RequestFuncType = std::function<void(typename gRPCService::AsyncService*, grpc::ServerContext*, RequestMessageType*, ResponseWriterType*, grpc::CompletionQueue*, grpc::ServerCompletionQueue*, void*)>
private

Alias for the remote procedure call function implemented by this class as part of an asynchronous gRPC service. Refer to gRPC documentation.

Definition at line 353 of file gRPCModule.h.

◆ ResponseWriterType

template<typename... gRPCServices>
template<typename DerivedType , typename gRPCService , typename RequestMessageType , typename ResponseMessageType , typename std::enable_if_t< Util::is_contained_in_v< gRPCService, gRPCServices... >, int > = 0>
using DynExpModule::gRPCModule< gRPCServices >::TypedCallDataBase< DerivedType, gRPCService, RequestMessageType, ResponseMessageType,... >::ResponseWriterType = grpc::ServerAsyncResponseWriter<ResponseMessageType>
private

Alias for the gRPC response writer which sends a message of type ResponseMessageType back to the client after the remote procedure call is handled.

Definition at line 347 of file gRPCModule.h.

Constructor & Destructor Documentation

◆ TypedCallDataBase()

template<typename... gRPCServices>
template<typename DerivedType , typename gRPCService , typename RequestMessageType , typename ResponseMessageType , typename std::enable_if_t< Util::is_contained_in_v< gRPCService, gRPCServices... >, int > = 0>
DynExpModule::gRPCModule< gRPCServices >::TypedCallDataBase< DerivedType, gRPCService, RequestMessageType, ResponseMessageType,... >::TypedCallDataBase ( const gRPCModule *const  OwningModule,
const RequestFuncType  RequestFunc 
)
inlineprivatenoexcept

Constructs a TypedCallDataBase instance.

Parameters
OwningModulegRPC server this remote procedure call belongs to
RequestFuncRemote procedure call function implemented by this class. This function is usually part of the < ServiceType > :: AsyncService gRPC namespace.

Definition at line 362 of file gRPCModule.h.

Member Function Documentation

◆ ~TypedCallDataBase()

template<typename... gRPCServices>
template<typename DerivedType , typename gRPCService , typename RequestMessageType , typename ResponseMessageType , typename std::enable_if_t< Util::is_contained_in_v< gRPCService, gRPCServices... >, int > = 0>
virtual DynExpModule::gRPCModule< gRPCServices >::TypedCallDataBase< DerivedType, gRPCService, RequestMessageType, ResponseMessageType,... >::~TypedCallDataBase ( )
privatevirtualdefault

◆ InitChild()

template<typename... gRPCServices>
template<typename DerivedType , typename gRPCService , typename RequestMessageType , typename ResponseMessageType , typename std::enable_if_t< Util::is_contained_in_v< gRPCService, gRPCServices... >, int > = 0>
void DynExpModule::gRPCModule< gRPCServices >::TypedCallDataBase< DerivedType, gRPCService, RequestMessageType, ResponseMessageType,... >::InitChild ( DynExp::ModuleInstance Instance)
inlinefinaloverrideprivatevirtual

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

Implements DynExpModule::gRPCModule< gRPCServices >::CallDataBase.

Definition at line 370 of file gRPCModule.h.

◆ MakeCall()

template<typename... gRPCServices>
template<typename DerivedType , typename gRPCService , typename RequestMessageType , typename ResponseMessageType , typename std::enable_if_t< Util::is_contained_in_v< gRPCService, gRPCServices... >, int > = 0>
static void DynExpModule::gRPCModule< gRPCServices >::TypedCallDataBase< DerivedType, gRPCService, RequestMessageType, ResponseMessageType,... >::MakeCall ( const gRPCModule *const  OwningModule,
DynExp::ModuleInstance Instance 
)
inlinestatic

Creates a new remote procedure call of this type which awaits requests from the client.

Parameters
OwningModulegRPC server this remote procedure call belongs to
InstanceHandle to the server module thread's data

Definition at line 337 of file gRPCModule.h.

◆ ProcessChild()

template<typename... gRPCServices>
template<typename DerivedType , typename gRPCService , typename RequestMessageType , typename ResponseMessageType , typename std::enable_if_t< Util::is_contained_in_v< gRPCService, gRPCServices... >, int > = 0>
void DynExpModule::gRPCModule< gRPCServices >::TypedCallDataBase< DerivedType, gRPCService, RequestMessageType, ResponseMessageType,... >::ProcessChild ( DynExp::ModuleInstance Instance)
inlinefinaloverrideprivatevirtual

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

Implements DynExpModule::gRPCModule< gRPCServices >::CallDataBase.

Definition at line 380 of file gRPCModule.h.

◆ ProcessChildImpl()

template<typename... gRPCServices>
template<typename DerivedType , typename gRPCService , typename RequestMessageType , typename ResponseMessageType , typename std::enable_if_t< Util::is_contained_in_v< gRPCService, gRPCServices... >, int > = 0>
virtual void DynExpModule::gRPCModule< gRPCServices >::TypedCallDataBase< DerivedType, gRPCService, RequestMessageType, ResponseMessageType,... >::ProcessChildImpl ( DynExp::ModuleInstance Instance)
privatepure virtual

Override to implement the server's action to handle this remote procedure call. Particularly, populate gRPCModule::ResponseMessage with the server's responses.

Parameters
InstanceHandle to the server module thread's data

Member Data Documentation

◆ DerivedType

template<typename... gRPCServices>
template<typename DerivedType , typename gRPCService , typename RequestMessageType , typename ResponseMessageType , typename std::enable_if_t< Util::is_contained_in_v< gRPCService, gRPCServices... >, int > = 0>
friend DynExpModule::gRPCModule< gRPCServices >::TypedCallDataBase< DerivedType, gRPCService, RequestMessageType, ResponseMessageType,... >::DerivedType
private

Definition at line 340 of file gRPCModule.h.

◆ RequestFunc

template<typename... gRPCServices>
template<typename DerivedType , typename gRPCService , typename RequestMessageType , typename ResponseMessageType , typename std::enable_if_t< Util::is_contained_in_v< gRPCService, gRPCServices... >, int > = 0>
const RequestFuncType DynExpModule::gRPCModule< gRPCServices >::TypedCallDataBase< DerivedType, gRPCService, RequestMessageType, ResponseMessageType,... >::RequestFunc
private

Request function to register the remote procedure call derived from TypedCallDataBase with gRPC.

Definition at line 401 of file gRPCModule.h.

◆ RequestMessage

template<typename... gRPCServices>
template<typename DerivedType , typename gRPCService , typename RequestMessageType , typename ResponseMessageType , typename std::enable_if_t< Util::is_contained_in_v< gRPCService, gRPCServices... >, int > = 0>
RequestMessageType DynExpModule::gRPCModule< gRPCServices >::TypedCallDataBase< DerivedType, gRPCService, RequestMessageType, ResponseMessageType,... >::RequestMessage
private

Client's message sent along with its invocation of this remote procedure call.

Definition at line 402 of file gRPCModule.h.

◆ ResponseMessage

template<typename... gRPCServices>
template<typename DerivedType , typename gRPCService , typename RequestMessageType , typename ResponseMessageType , typename std::enable_if_t< Util::is_contained_in_v< gRPCService, gRPCServices... >, int > = 0>
ResponseMessageType DynExpModule::gRPCModule< gRPCServices >::TypedCallDataBase< DerivedType, gRPCService, RequestMessageType, ResponseMessageType,... >::ResponseMessage
private

Response the server sends back to the client by finishing the remote procedure call.

Definition at line 403 of file gRPCModule.h.

◆ ResponseWriter

template<typename... gRPCServices>
template<typename DerivedType , typename gRPCService , typename RequestMessageType , typename ResponseMessageType , typename std::enable_if_t< Util::is_contained_in_v< gRPCService, gRPCServices... >, int > = 0>
ResponseWriterType DynExpModule::gRPCModule< gRPCServices >::TypedCallDataBase< DerivedType, gRPCService, RequestMessageType, ResponseMessageType,... >::ResponseWriter
private

gRPC response writer to send gRPCModule::ResponseMessage back to the client. Refer to gRPC documentation.

Definition at line 404 of file gRPCModule.h.


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