8#include <init.capnp.proxy.h>
21#include <system_error>
26 void print(
const std::string& message)
override { std::cout <<
"mpprinter: " << message << std::endl; }
32 std::unique_ptr<Printer>
makePrinter()
override {
return std::make_unique<PrinterImpl>(); }
38 std::ofstream(
"debug.log", std::ios_base::app) <<
log_data.message << std::endl;
44 std::cout <<
"Usage: mpprinter <fd>\n";
49 std::cerr <<
argv[1] <<
" is not a number or is larger than an int\n";
53 std::unique_ptr<Init>
init = std::make_unique<InitImpl>();
54 mp::ServeStream<InitInterface>(loop, fd, *
init);
std::unique_ptr< Printer > makePrinter() override
void print(const std::string &message) override
Event loop implementation.
void loop()
Run event loop.
static void LogPrint(mp::LogMessage log_data)
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.