5#include <condition_variable>
50 MRVIEWER_API
static bool empty();
57 CommandLoop() =
default;
60 static CommandLoop& instance_();
75 bool queueClosed_{
false };
76 std::thread::id mainThreadId_;
77 std::queue<std::shared_ptr<Command>> commands_;
StartPosition
Specify execution in specific time of application start.
Definition MRCommandLoop.h:23
static bool empty()
Return true if loop is empty.
std::thread::id threadId
Definition MRCommandLoop.h:69
CommandFunc func
Definition MRCommandLoop.h:66
std::function< void()> CommandFunc
Definition MRCommandLoop.h:19
static void setMainThreadId(const std::thread::id &id)
This function setups main thread id, it should be called before any command.
static void processCommands()
Execute all commands from loop.
StartPosition state
Definition MRCommandLoop.h:67
static std::thread::id getMainThreadId()
std::condition_variable callerThreadCV
Definition MRCommandLoop.h:68
static void runCommandFromGUIThread(CommandFunc func)
static void setState(StartPosition state)
Update state of command loop, only can rise.
static void appendCommand(CommandFunc func, StartPosition state=StartPosition::BeforeWindowAppear)
static void removeCommands(bool closeLoop)
@ AfterPluginInit
executes after splash appeared
Definition MRCommandLoop.h:26
@ BeforeWindowAppear
executes during splash, after plugins init)
Definition MRCommandLoop.h:27
@ AfterWindowAppear
executes after splash is going to close, and just before main window is shown and have valid main win...
Definition MRCommandLoop.h:28
@ AfterSplashAppear
executes right after window is initialized
Definition MRCommandLoop.h:25
@ AfterWindowInit
Definition MRCommandLoop.h:24
only for bindings generation
Definition MRCameraOrientationPlugin.h:8