gRPC: Add SetGridProperties.py example

This commit is contained in:
Gaute Lindkvist 2019-05-22 19:58:12 +02:00
parent 7c475e72e4
commit 9ac15ec553
2 changed files with 24 additions and 6 deletions

View File

@ -288,6 +288,17 @@ grpc::Status RiaGrpcPropertiesService::SetActiveCellResults(grpc::ServerContext*
return stateHandler->receiveStreamRequest(request);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
grpc::Status RiaGrpcPropertiesService::SetGridResults(grpc::ServerContext* context,
const rips::ResultRequestChunk* request,
rips::Empty* reply,
RiaGridCellResultsStateHandler* stateHandler)
{
return stateHandler->receiveStreamRequest(request);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -302,9 +313,12 @@ std::vector<RiaAbstractGrpcCallback*> RiaGrpcPropertiesService::createCallbacks(
new RiaGrpcStreamCallback<Self, ResultRequest, ResultArray, RiaGridCellResultsStateHandler>(
this, &Self::GetGridResults, &Self::RequestGetGridResults, new RiaGridCellResultsStateHandler),
new RiaGrpcClientStreamCallback<Self, ResultRequestChunk, Empty, RiaActiveCellResultsStateHandler>(
this, &Self::SetActiveCellResults, &Self::RequestSetActiveCellResults, new RiaActiveCellResultsStateHandler)
this, &Self::SetActiveCellResults, &Self::RequestSetActiveCellResults, new RiaActiveCellResultsStateHandler),
new RiaGrpcClientStreamCallback<Self, ResultRequestChunk, Empty, RiaGridCellResultsStateHandler>(
this, &Self::SetGridResults, &Self::RequestSetGridResults, new RiaGridCellResultsStateHandler)
};
}
static bool RiaGrpcPropertiesService_init =
RiaGrpcServiceFactory::instance()->registerCreator<RiaGrpcPropertiesService>(typeid(RiaGrpcPropertiesService).hash_code());

View File

@ -34,21 +34,25 @@ class RiaGridCellResultsStateHandler;
class RiaGrpcPropertiesService final : public rips::Properties::AsyncService, public RiaGrpcServiceInterface
{
public:
grpc::Status GetAvailableProperties(grpc::ServerContext* context,
grpc::Status GetAvailableProperties(grpc::ServerContext* context,
const rips::PropertiesRequest* request,
rips::AvailableProperties* reply) override;
rips::AvailableProperties* reply) override;
grpc::Status GetActiveCellResults(grpc::ServerContext* context,
const rips::ResultRequest* request,
rips::ResultArray* reply,
rips::ResultArray* reply,
RiaActiveCellResultsStateHandler* stateHandler);
grpc::Status GetGridResults(grpc::ServerContext* context,
const rips::ResultRequest* request,
rips::ResultArray* reply,
rips::ResultArray* reply,
RiaGridCellResultsStateHandler* stateHandler);
grpc::Status SetActiveCellResults(grpc::ServerContext* context,
const rips::ResultRequestChunk* request,
rips::Empty* reply,
RiaActiveCellResultsStateHandler* stateHandler);
grpc::Status SetGridResults(grpc::ServerContext* context,
const rips::ResultRequestChunk* request,
rips::Empty* reply,
RiaGridCellResultsStateHandler* stateHandler);
std::vector<RiaAbstractGrpcCallback*> createCallbacks() override;
};