🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
PilotCommander.hpp
浏览该文件的文档.
1
19
20#pragma once
21
22#include "AstGlobal.h"
23#include <QObject>
24#include <string>
25#include <atomic>
26#include <thread>
27#include <functional>
28
29AST_NAMESPACE_BEGIN
30
31class PilotSession;
32class PilotRecorder;
33
43class AST_UIPILOT_API PilotCommander : public QObject
44{
45 Q_OBJECT
46
47public:
52 explicit PilotCommander(PilotSession* session, PilotRecorder* recorder,
53 QObject* parent = nullptr);
54
56 ~PilotCommander() override;
57 PilotCommander(const PilotCommander&) = delete;
58 PilotCommander& operator=(const PilotCommander&) = delete;
59
63 std::string execute(const std::string& line);
64
66 void executeAsync(const std::string& line);
67
69 void startStdinLoop();
70
72 void stop();
73
75 bool isRunning() const { return running_; }
76
78 static const char* helpText();
79
81 void setOutputCallback(std::function<void(const std::string&)> cb);
82
83Q_SIGNALS:
85 void outputReady(const QString& text);
86
89
90private:
92 std::string dispatch(const std::string& line);
93
95 std::string executeSafe(const std::string& line);
96
97 PilotSession* session_;
98 PilotRecorder* recorder_;
99 std::atomic<bool> running_{true};
100 std::thread stdinThread_{};
101 std::function<void(const std::string&)> outputCb_{};
102};
103
106AST_NAMESPACE_END
命令调度器
定义 PilotCommander.hpp:44
void quitRequested()
请求退出应用
void outputReady(const QString &text)
有输出内容就绪
bool isRunning() const
是否正在运行
定义 PilotCommander.hpp:75
界面操作录制器
定义 PilotRecorder.hpp:39
AstUiPilot 对话会话
定义 PilotSession.hpp:40