merged
This commit is contained in:
parent
18a14d204c
commit
717568b6d0
30 changed files with 4093 additions and 209 deletions
34
simulator_SIC_XE/gui/qt/MachineController.h
Normal file
34
simulator_SIC_XE/gui/qt/MachineController.h
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#ifndef MACHINECONTROLLER_H
|
||||
#define MACHINECONTROLLER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
#include <memory>
|
||||
|
||||
class Machine;
|
||||
|
||||
class MachineController : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MachineController(std::shared_ptr<Machine> machine = nullptr, QObject *parent = nullptr);
|
||||
~MachineController() override;
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
void step();
|
||||
|
||||
signals:
|
||||
void tick();
|
||||
void error(const QString &msg);
|
||||
|
||||
private:
|
||||
void runLoop();
|
||||
std::atomic<bool> m_running{false};
|
||||
std::thread m_thread;
|
||||
std::shared_ptr<Machine> m_machine;
|
||||
std::atomic<int> m_ticksSinceLastUpdate{0};
|
||||
std::chrono::steady_clock::time_point m_lastUpdateTime;
|
||||
};
|
||||
|
||||
#endif // MACHINECONTROLLER_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue