class EngineGrpcServer

Overview

class for Engine server with gRPC support More…

#include <engine_grpc_server.h>

class EngineGrpcServer: public Service {
public:
    // typedefs

    typedef std::timed_mutex mutex_t;
    typedef std::unique_lock<EngineGrpcServer::mutex_t> lock_t;

    // construction

    EngineGrpcServer();

    EngineGrpcServer(
        const std::string serverAddress,
        EngineProtoWrapper* engineWrapper
    );

    // methods

    void startServer();
    void startServerAsync();
    void shutdownServer();
    virtual bool initRunFlag() const;
    virtual bool shutdownFlag() const;
    bool isServerRunning() const;
    const std::string serverAddress() const;
};

Detailed Documentation

class for Engine server with gRPC support

The class provides an Engine server with gRPC as middleware. All RPC services are implemented. EngineProtoWrapper is used to perform the actual simulation initialization, shutdown, reset, data exchange and run step operations.

Construction

EngineGrpcServer()

No dummy servers, only those with name and url.

EngineGrpcServer(
    const std::string serverAddress,
    EngineProtoWrapper* engineWrapper
)

Constructor.

Parameters:

serverAddress

Address of the gRPC server

engineWrapper

Class processing requests to the Engine

Methods

void startServer()

Starts the gRPC server in synchronous mode.

void startServerAsync()

Starts the gRPC server in asynchronous mode.

void shutdownServer()

Shutdowns the gRPC server.

virtual bool initRunFlag() const

Indicates if the simulation was initialized and is running.

virtual bool shutdownFlag() const

Indicates if shutdown was requested by the client.

bool isServerRunning() const

Indicates whether the gRPC server is currently running.

const std::string serverAddress() const

Returns address of the gRPC server.