| 1 | // LAF OS Library |
|---|---|
| 2 | // Copyright (C) 2020 Igara Studio S.A. |
| 3 | // Copyright (C) 2016 David Capello |
| 4 | // |
| 5 | // This file is released under the terms of the MIT license. |
| 6 | // Read LICENSE.txt for more information. |
| 7 | |
| 8 | #ifdef HAVE_CONFIG_H |
| 9 | #include "config.h" |
| 10 | #endif |
| 11 | |
| 12 | #include "base/debug.h" |
| 13 | #include "os/ref.h" |
| 14 | #include "os/system.h" |
| 15 | |
| 16 | namespace os { |
| 17 | |
| 18 | static System* g_system = nullptr; |
| 19 | |
| 20 | System* make_system_impl(); // Defined on each back-end |
| 21 | |
| 22 | SystemRef make_system() |
| 23 | { |
| 24 | ASSERT(!g_system); |
| 25 | g_system = make_system_impl(); |
| 26 | return SystemRef(g_system); |
| 27 | } |
| 28 | |
| 29 | System* instance() |
| 30 | { |
| 31 | return g_system; |
| 32 | } |
| 33 | |
| 34 | void set_instance(System* system) |
| 35 | { |
| 36 | g_system = system; |
| 37 | } |
| 38 | |
| 39 | } // namespace os |
| 40 |