5 #include <grpc++/grpc++.h>
7 #include "hashprobe.grpc.pb.h"
12 using grpc::ClientContext;
15 int main(int argc, char** argv) {
16 std::shared_ptr<Channel> channel(grpc::CreateChannel(
17 "localhost:50051", grpc::InsecureChannelCredentials()));
18 std::unique_ptr<HashProbe::Stub> stub(HashProbe::NewStub(channel));
22 if (fgets(buf, sizeof(buf), stdin) == nullptr || buf[0] == '\n') {
26 char *ptr = strchr(buf, '\n');
27 if (ptr != nullptr) *ptr = 0;
29 HashProbeRequest request;
32 HashProbeResponse response;
33 ClientContext context;
34 Status status = stub->Probe(&context, request, &response);
37 std::cout << response.found() << " "
38 << UCI::square(from_sq(Move(response.move())))
39 << UCI::square(to_sq(Move(response.move()))) << " ";
40 switch (response.bound()) {
41 case HashProbeResponse::BOUND_NONE:
42 case HashProbeResponse::BOUND_EXACT:
44 case HashProbeResponse::BOUND_UPPER:
47 case HashProbeResponse::BOUND_LOWER:
51 std::cout << UCI::value(Value(response.value())) << " ";
52 std::cout << response.depth() << std::endl;
54 std::cout << "ERROR" << std::endl;