#ifndef COMMANDEDITOR_H #define COMMANDEDITOR_H #include #include #include #include "common/utils/RingBuffer.h" #include "common/utils/String.h" class CommandEditor final { public: CommandEditor(); ~CommandEditor(); CommandEditor(const CommandEditor& other) = delete; CommandEditor& operator=(const CommandEditor& other) = delete; CommandEditor(CommandEditor&& other) = delete; CommandEditor& operator=(CommandEditor&& other) = delete; void preTick() const; void postTick() const; bool hasCommand() const; String readCommand(); private: static void onLineRead(char* line); void loop(); static std::mutex queueMutex; static RingBuffer queue; std::atomic_bool running; std::thread readThread; }; #endif