#pragma once #include #include #include #include #include class SocketServer { public: using CommandCallback = std::function; explicit SocketServer(const std::string& socketPath); ~SocketServer(); bool start(CommandCallback callback); void stop(); bool isRunning() const { return running_; } private: void serverLoop(); void handleClient(int clientFd); std::string socketPath_; int serverFd_; std::atomic running_; std::unique_ptr serverThread_; CommandCallback commandCallback_; };