summaryrefslogtreecommitdiff
path: root/src/Process.hpp
blob: 64340e453a2666827b9e73ea20018ec58633482a (plain)
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
#include <string>
#define ENGINE_TIMEOUT 5 // In seconds
#define BUFFER_SIZE 1024

namespace uciadapter {

class Process {

public:
  /// @brief Kill the engine
  virtual void Kill() = 0;
  /// @brief Start the engine from file path
  virtual void Start(std::string) = 0;
  /// @brief Read one line from the stdout of the engine (could raise a
  /// ReadTimeoutExpire)
  virtual std::string ReadLine() = 0;
  /// @brief Write to engine stdin
  virtual void Write(std::string) = 0;
  virtual ~Process(){};
};

struct FailedToStartEngine : public std::exception {
  const char *what() const throw() { return ("Could not start the engine"); }
};
struct ReadTimeoutExpire : public std::exception {
  const char *what() const throw() { return ("Engine is not responding"); }
};

} // namespace uciadapter