67b283f551ea40ed9175642534122bdfc08e4909
[stockfish] / src / hashprobe.h
1 #ifndef HASHPROBE_H_INCLUDED
2 #define HASHPROBE_H_INCLUDED
3
4 #include "types.h"
5
6 #include <deque>
7 #include <string>
8
9 #include <grpc/grpc.h>
10 #include <grpc++/server.h>
11 #include <grpc++/server_builder.h>
12 #include "hashprobe.grpc.pb.h"
13
14 class HashProbeImpl final : public hashprobe::HashProbe::Service {
15 public:
16         grpc::Status Probe(grpc::ServerContext* context,
17                            const hashprobe::HashProbeRequest* request,
18                            hashprobe::HashProbeResponse *response);
19
20 private:
21         void FillMove(Move move, hashprobe::HashProbeMove* decoded);
22         void ProbeMove(Position* pos, std::deque<StateInfo>* setup_states, bool invert, hashprobe::HashProbeLine* response);
23         void FillValue(Value value, hashprobe::HashProbeScore* score);
24 };
25
26 class HashProbeThread {
27 public:
28         HashProbeThread(const std::string &server_address);
29         void Shutdown();
30
31 private:
32         HashProbeImpl service;
33         grpc::ServerBuilder builder;
34         std::unique_ptr<grpc::Server> server;
35 };
36
37 #endif