#pragma once #include #include // One line of the bridge protocol: a verb and its fields, separated by tabs. // Nonemm.Digital/BridgeLine.cs is the other end of the same format. namespace protocol { struct Line { std::string verb; std::vector fields; // Empty when the field is not there, which keeps a short line from being an // error on either side. std::string field(size_t index) const; long number(size_t index) const; }; Line read(const std::string& line); // Writes one line to standard output and flushes it. Safe to call from any // thread. void write(const std::string& verb, const std::vector& fields = {}); void write(const std::string& verb, long value); } // namespace protocol