Motion Master 6.0.0-alpha.50
Next-generation motion control software
Loading...
Searching...
No Matches
platform.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <expected>
5#include <filesystem>
6#include <string>
7
8namespace mm::core {
9
19std::filesystem::path exeDir();
20
25void openInBrowser(const std::string& url);
26
34 public:
35 SingleInstanceLock() = default;
36 SingleInstanceLock(SingleInstanceLock&& other) noexcept;
41
42 private:
43 explicit SingleInstanceLock(std::intptr_t handle) : handle_(handle) {}
44 friend std::expected<SingleInstanceLock, std::string> acquireSingleInstanceLock();
45
46 static constexpr std::intptr_t kInvalid = -1;
47 std::intptr_t handle_ = kInvalid;
48};
49
62std::expected<SingleInstanceLock, std::string> acquireSingleInstanceLock();
63
64} // namespace mm::core
RAII holder of the process-wide single-instance lock.
Definition platform.h:33
~SingleInstanceLock()
Definition platform.cc:72
SingleInstanceLock(const SingleInstanceLock &)=delete
friend std::expected< SingleInstanceLock, std::string > acquireSingleInstanceLock()
Acquire the process-wide lock that permits only one running Motion Master.
Definition platform.cc:83
SingleInstanceLock & operator=(const SingleInstanceLock &)=delete
SingleInstanceLock & operator=(SingleInstanceLock &&other) noexcept
Definition platform.cc:66
Definition cyclic_timer.h:6
std::expected< SingleInstanceLock, std::string > acquireSingleInstanceLock()
Acquire the process-wide lock that permits only one running Motion Master.
Definition platform.cc:83
std::filesystem::path exeDir()
Return the directory that contains the running executable.
Definition platform.cc:27
void openInBrowser(const std::string &url)
Open the given URL in the system default browser.
Definition platform.cc:45