diff options
Diffstat (limited to 'kernel/kapi/boot_module/registry.cpp')
| -rw-r--r-- | kernel/kapi/boot_module/registry.cpp | 131 |
1 files changed, 0 insertions, 131 deletions
diff --git a/kernel/kapi/boot_module/registry.cpp b/kernel/kapi/boot_module/registry.cpp deleted file mode 100644 index 9876866b..00000000 --- a/kernel/kapi/boot_module/registry.cpp +++ /dev/null @@ -1,131 +0,0 @@ -#include <kapi/boot_modules/registry.hpp> - -#include <kapi/boot_modules.hpp> -#include <kapi/system.hpp> -#include <kapi/test_support/boot_modules.hpp> - -#include <cstddef> -#include <optional> -#include <utility> - -namespace kapi::boot_modules -{ - - namespace - { - constinit auto instance = std::optional<registry>{}; - } - - auto registry::init() -> void - { - if (instance) - { - system::panic("[OS] Boot module registry has already been initialized."); - } - - instance.emplace(); - } - - auto registry::get() -> registry & - { - if (!instance) - { - system::panic("[OS] Boot module registry has not been initialized."); - } - - return *instance; - } - - auto registry::begin() const noexcept -> const_iterator - { - return m_modules.begin(); - } - - auto registry::end() const noexcept -> const_iterator - { - return m_modules.end(); - } - - auto registry::cbegin() const noexcept -> const_iterator - { - return m_modules.cbegin(); - } - - auto registry::cend() const noexcept -> const_iterator - { - return m_modules.cend(); - } - - auto registry::rbegin() const noexcept -> const_reverse_iterator - { - return m_modules.rbegin(); - } - - auto registry::rend() const noexcept -> const_reverse_iterator - { - return m_modules.rend(); - } - - auto registry::crbegin() const noexcept -> const_reverse_iterator - { - return m_modules.crbegin(); - } - - auto registry::crend() const noexcept -> const_reverse_iterator - { - return m_modules.crend(); - } - - auto registry::front() const noexcept -> const_reference - { - return m_modules.front(); - } - - auto registry::back() const noexcept -> const_reference - { - return m_modules.back(); - } - - auto registry::size() const noexcept -> std::size_t - { - return m_modules.size(); - } - - auto registry::empty() const noexcept -> bool - { - return m_modules.empty(); - } - - auto registry::at(std::size_t index) const -> const_reference - { - return m_modules.at(index); - } - - auto registry::operator[](std::size_t index) const noexcept -> const_reference - { - return m_modules[index]; - } - - auto registry::add(module module) -> void - { - m_modules.push_back(module); - } - -} // namespace kapi::boot_modules - -namespace kapi::test_support::boot_modules -{ - - auto deinit_registry() -> void - { - kapi::boot_modules::instance.reset(); - } - - auto inject_registry(kapi::boot_modules::registry && registry) -> std::optional<kapi::boot_modules::registry> - { - auto old = std::move(kapi::boot_modules::instance); - kapi::boot_modules::instance.emplace(std::move(registry)); - return old; - } - -} // namespace kapi::test_support::boot_modules |
