🛰️航天仿真算法库 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
61 std::string execute(const std::string& line);
62
64 void executeAsync(const std::string& line);
65
67 void startStdinLoop();
68
70 void stop();
71
73 bool isRunning() const { return running_; }
74
76 static const char* helpText();
77
79 void setOutputCallback(std::function<void(const std::string&)> cb);
80
81Q_SIGNALS:
83 void outputReady(const QString& text);
84
87
88private:
90 std::string dispatch(const std::string& line);
91
93 std::string executeSafe(const std::string& line);
94
95 PilotSession* session_;
96 PilotRecorder* recorder_;
97 std::atomic<bool> running_{true};
98 std::thread stdinThread_;
99 std::function<void(const std::string&)> outputCb_;
100};
101
104AST_NAMESPACE_END
命令调度器
定义 PilotCommander.hpp:44
void quitRequested()
请求退出应用
void outputReady(const QString &text)
有输出内容就绪
bool isRunning() const
是否正在运行
定义 PilotCommander.hpp:73
界面操作录制器
定义 PilotRecorder.hpp:39
AstUiPilot 对话会话
定义 PilotSession.hpp:40