-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwrapper.hpp
More file actions
65 lines (42 loc) · 1.36 KB
/
wrapper.hpp
File metadata and controls
65 lines (42 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef PHILCHESS_UCI_WRAPPER_H
#define PHILCHESS_UCI_WRAPPER_H
#include <philchess/uci/types.hpp>
#include <pcl/locked_queue.hpp>
#include <atomic>
#include <functional>
#include <thread>
#include <type_traits>
namespace philchess {
namespace uci
{
template <typename ENGINE_T, typename IO_T>
class wrapper
{
public:
template <typename... ARGS>
wrapper(IO_T io, ARGS&& ...args);
~wrapper();
void uci();
void debug(debug_setting setting);
void isready();
void setoption(option opt);
void do_register(/*args?*/); //renamed due to register being reserved
void ucinewgame();
void position(board_position pos);
void go(search_settings settings);
void stop();
void ponderhit();
private:
IO_T io_;
pcl::monitor<ENGINE_T> engine_; //only accessed from within the worker thread, so the monitor is actually one more mutex than strictly necessary, but it ensures i dont do anything wrong here and I really dont trust myself with this xD...
std::thread worker_thd_;
std::atomic<bool> should_stop_;
pcl::locked_queue<std::function<bool()>> task_queue_;
std::atomic<debug_setting> debug_{debug_setting::disabled};
class engine_io;
template <std::size_t... idxs>
void setoption_impl(option opt, std::index_sequence<idxs...>);
};
}} //end namespace philchess::uci
#include "wrapper_impl.hpp"
#endif