Rename Module to ModuleBase
This commit is contained in:
parent
a7fac3beb8
commit
fd1d416510
|
|
@ -16,9 +16,9 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
class NAZARA_AUDIO_API Audio : public Module<Audio>
|
class NAZARA_AUDIO_API Audio : public ModuleBase<Audio>
|
||||||
{
|
{
|
||||||
friend Module;
|
friend ModuleBase;
|
||||||
|
|
||||||
using Dependencies = TypeList<Core>;
|
using Dependencies = TypeList<Core>;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,14 @@
|
||||||
#define NAZARA_CORE_HPP
|
#define NAZARA_CORE_HPP
|
||||||
|
|
||||||
#include <Nazara/Prerequisites.hpp>
|
#include <Nazara/Prerequisites.hpp>
|
||||||
#include <Nazara/Core/Module.hpp>
|
#include <Nazara/Core/ModuleBase.hpp>
|
||||||
#include <Nazara/Core/TypeList.hpp>
|
#include <Nazara/Core/TypeList.hpp>
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
class NAZARA_CORE_API Core : public Module<Core>
|
class NAZARA_CORE_API Core : public ModuleBase<Core>
|
||||||
{
|
{
|
||||||
friend Module;
|
friend ModuleBase;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Dependencies = TypeList<>;
|
using Dependencies = TypeList<>;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class Module
|
class ModuleBase
|
||||||
{
|
{
|
||||||
friend class Core;
|
friend class Core;
|
||||||
|
|
||||||
|
|
@ -21,13 +21,13 @@ namespace Nz
|
||||||
static T* Instance();
|
static T* Instance();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Module(std::string moduleName, T* pointer);
|
ModuleBase(std::string moduleName, T* pointer);
|
||||||
~Module();
|
~ModuleBase();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct NoLog {};
|
struct NoLog {};
|
||||||
|
|
||||||
Module(std::string moduleName, T* pointer, NoLog);
|
ModuleBase(std::string moduleName, T* pointer, NoLog);
|
||||||
|
|
||||||
void LogInit();
|
void LogInit();
|
||||||
|
|
||||||
|
|
@ -35,6 +35,6 @@ namespace Nz
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <Nazara/Core/Module.inl>
|
#include <Nazara/Core/ModuleBase.inl>
|
||||||
|
|
||||||
#endif // NAZARA_MODULE_HPP
|
#endif // NAZARA_MODULE_HPP
|
||||||
|
|
@ -2,21 +2,21 @@
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Core/Module.hpp>
|
#include <Nazara/Core/ModuleBase.hpp>
|
||||||
#include <Nazara/Core/Log.hpp>
|
#include <Nazara/Core/Log.hpp>
|
||||||
#include <Nazara/Core/Debug.hpp>
|
#include <Nazara/Core/Debug.hpp>
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
template<typename T>
|
template<typename T>
|
||||||
Module<T>::Module(std::string moduleName, T* pointer) :
|
ModuleBase<T>::ModuleBase(std::string moduleName, T* pointer) :
|
||||||
Module(std::move(moduleName), pointer, NoLog{})
|
ModuleBase(std::move(moduleName), pointer, NoLog{})
|
||||||
{
|
{
|
||||||
LogInit();
|
LogInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
Module<T>::Module(std::string moduleName, T* pointer, NoLog) :
|
ModuleBase<T>::ModuleBase(std::string moduleName, T* pointer, NoLog) :
|
||||||
m_moduleName(std::move(moduleName))
|
m_moduleName(std::move(moduleName))
|
||||||
{
|
{
|
||||||
NazaraAssert(T::s_instance == nullptr, "only one instance of " + m_moduleName + " must exist at a given time");
|
NazaraAssert(T::s_instance == nullptr, "only one instance of " + m_moduleName + " must exist at a given time");
|
||||||
|
|
@ -24,20 +24,20 @@ namespace Nz
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
Module<T>::~Module()
|
ModuleBase<T>::~ModuleBase()
|
||||||
{
|
{
|
||||||
NazaraNotice("Uninitializing " + m_moduleName + "...");
|
NazaraNotice("Uninitializing " + m_moduleName + "...");
|
||||||
T::s_instance = nullptr;
|
T::s_instance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T* Module<T>::Instance()
|
T* ModuleBase<T>::Instance()
|
||||||
{
|
{
|
||||||
return T::s_instance;
|
return T::s_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void Module<T>::LogInit()
|
void ModuleBase<T>::LogInit()
|
||||||
{
|
{
|
||||||
NazaraNotice("Initializing " + m_moduleName + "...");
|
NazaraNotice("Initializing " + m_moduleName + "...");
|
||||||
}
|
}
|
||||||
|
|
@ -13,9 +13,9 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
class NAZARA_NETWORK_API Network : public Module<Network>
|
class NAZARA_NETWORK_API Network : public ModuleBase<Network>
|
||||||
{
|
{
|
||||||
friend Module;
|
friend ModuleBase;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Dependencies = TypeList<Core>;
|
using Dependencies = TypeList<Core>;
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
class NAZARA_PHYSICS2D_API Physics2D : public Module<Physics2D>
|
class NAZARA_PHYSICS2D_API Physics2D : public ModuleBase<Physics2D>
|
||||||
{
|
{
|
||||||
friend Module;
|
friend ModuleBase;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Dependencies = TypeList<Core>;
|
using Dependencies = TypeList<Core>;
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
class NAZARA_PHYSICS3D_API Physics3D : public Module<Physics3D>
|
class NAZARA_PHYSICS3D_API Physics3D : public ModuleBase<Physics3D>
|
||||||
{
|
{
|
||||||
friend Module;
|
friend ModuleBase;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Dependencies = TypeList<Core>;
|
using Dependencies = TypeList<Core>;
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
class NAZARA_PLATFORM_API Platform : public Module<Platform>
|
class NAZARA_PLATFORM_API Platform : public ModuleBase<Platform>
|
||||||
{
|
{
|
||||||
friend Module;
|
friend ModuleBase;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Dependencies = TypeList<Utility>;
|
using Dependencies = TypeList<Utility>;
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,9 @@ namespace Nz
|
||||||
class AbstractBuffer;
|
class AbstractBuffer;
|
||||||
class Buffer;
|
class Buffer;
|
||||||
|
|
||||||
class NAZARA_RENDERER_API Renderer : public Module<Renderer>
|
class NAZARA_RENDERER_API Renderer : public ModuleBase<Renderer>
|
||||||
{
|
{
|
||||||
friend Module;
|
friend ModuleBase;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Dependencies = TypeList<Platform>;
|
using Dependencies = TypeList<Platform>;
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
class NAZARA_SHADER_API Shader : public Module<Shader>
|
class NAZARA_SHADER_API Shader : public ModuleBase<Shader>
|
||||||
{
|
{
|
||||||
friend Module;
|
friend ModuleBase;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Dependencies = TypeList<Core>;
|
using Dependencies = TypeList<Core>;
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
class NAZARA_UTILITY_API Utility : public Module<Utility>
|
class NAZARA_UTILITY_API Utility : public ModuleBase<Utility>
|
||||||
{
|
{
|
||||||
friend Module;
|
friend ModuleBase;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Dependencies = TypeList<Core>;
|
using Dependencies = TypeList<Core>;
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ namespace Nz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Audio::Audio() :
|
Audio::Audio() :
|
||||||
Module("Audio", this)
|
ModuleBase("Audio", this)
|
||||||
{
|
{
|
||||||
// Initialisation of OpenAL
|
// Initialisation of OpenAL
|
||||||
if (!OpenAL::Initialize())
|
if (!OpenAL::Initialize())
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ namespace Nz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Core::Core() :
|
Core::Core() :
|
||||||
Module("Core", this, Module::NoLog{})
|
ModuleBase("Core", this, ModuleBase::NoLog{})
|
||||||
{
|
{
|
||||||
Log::Initialize();
|
Log::Initialize();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ namespace Nz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Network::Network() :
|
Network::Network() :
|
||||||
Module("Network", this)
|
ModuleBase("Network", this)
|
||||||
{
|
{
|
||||||
// Initialize module here
|
// Initialize module here
|
||||||
if (!SocketImpl::Initialize())
|
if (!SocketImpl::Initialize())
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
Physics2D::Physics2D() :
|
Physics2D::Physics2D() :
|
||||||
Module("Physics2D", this)
|
ModuleBase("Physics2D", this)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
Physics3D::Physics3D() :
|
Physics3D::Physics3D() :
|
||||||
Module("Physics3D", this)
|
ModuleBase("Physics3D", this)
|
||||||
{
|
{
|
||||||
if (!Collider3D::Initialize())
|
if (!Collider3D::Initialize())
|
||||||
throw std::runtime_error("failed to initialize colliders");
|
throw std::runtime_error("failed to initialize colliders");
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ namespace Nz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Platform::Platform() :
|
Platform::Platform() :
|
||||||
Module("Platform", this)
|
ModuleBase("Platform", this)
|
||||||
{
|
{
|
||||||
if (!Window::Initialize())
|
if (!Window::Initialize())
|
||||||
throw std::runtime_error("failed to initialize window system");
|
throw std::runtime_error("failed to initialize window system");
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
Renderer::Renderer() :
|
Renderer::Renderer() :
|
||||||
Module("Renderer", this)
|
ModuleBase("Renderer", this)
|
||||||
{
|
{
|
||||||
struct RendererImplementations
|
struct RendererImplementations
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
Shader::Shader() :
|
Shader::Shader() :
|
||||||
Module("Shader", this)
|
ModuleBase("Shader", this)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ namespace Nz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Utility::Utility() :
|
Utility::Utility() :
|
||||||
Module("Utility", this)
|
ModuleBase("Utility", this)
|
||||||
{
|
{
|
||||||
if (!Animation::Initialize())
|
if (!Animation::Initialize())
|
||||||
throw std::runtime_error("failed to initialize animations");
|
throw std::runtime_error("failed to initialize animations");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue