Files
NazaraEngine/include/Nazara/Core/ModuleBase.inl
Jérôme Leclercq 03e2801dbe Split engine to packages NazaraUtils and NZSL (#375)
* Move code to NazaraUtils and NZSL packages

* Reorder includes

* Tests: Remove glslang and spirv-tools deps

* Tests: Remove glslang init

* Remove NazaraUtils tests and fix Vector4Test

* Fix Linux compilation

* Update msys2-build.yml

* Fix assimp package

* Update xmake.lua

* Update xmake.lua

* Fix shader compilation on MinGW

* Final fixes

* The final fix 2: the fix strikes back!

* Disable cache on CI

* The return of the fix™️
2022-05-25 19:36:10 +02:00

57 lines
1.2 KiB
C++

// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/ModuleBase.hpp>
#include <Nazara/Core/Log.hpp>
#include <Nazara/Core/Debug.hpp>
namespace Nz
{
template<typename T>
ModuleBase<T>::ModuleBase(std::string moduleName, T* pointer) :
ModuleBase(std::move(moduleName), pointer, NoLog{})
{
LogInit();
}
template<typename T>
ModuleBase<T>::ModuleBase(std::string moduleName, T* pointer, NoLog) :
m_moduleName(std::move(moduleName))
{
NazaraAssert(T::s_instance == nullptr, "only one instance of " + m_moduleName + " can exist at a given time");
T::s_instance = pointer;
}
template<typename T>
ModuleBase<T>::~ModuleBase()
{
LogUninit();
T::s_instance = nullptr;
}
template<typename T>
T* ModuleBase<T>::Instance()
{
return T::s_instance;
}
template<typename T>
void ModuleBase<T>::LogInit()
{
NazaraNotice("Initializing " + m_moduleName + "...");
}
template<typename T>
void ModuleBase<T>::LogUninit()
{
if (m_moduleName.empty())
return;
NazaraNotice("Uninitialized " + m_moduleName);
m_moduleName.clear();
}
}
#include <Nazara/Core/DebugOff.hpp>