24 lines
535 B
C++
24 lines
535 B
C++
// D:\Dev\Mosis\MosisService\designer\src\platform_singleton.cpp
|
|
// Platform singleton implementation for desktop
|
|
|
|
#include "platform.h"
|
|
#include <stdexcept>
|
|
|
|
namespace mosis {
|
|
|
|
// Platform singleton
|
|
static std::unique_ptr<IPlatform> g_platform;
|
|
|
|
IPlatform& GetPlatform() {
|
|
if (!g_platform) {
|
|
throw std::runtime_error("Platform not initialized. Call SetPlatform first.");
|
|
}
|
|
return *g_platform;
|
|
}
|
|
|
|
void SetPlatform(std::unique_ptr<IPlatform> platform) {
|
|
g_platform = std::move(platform);
|
|
}
|
|
|
|
} // namespace mosis
|