Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
MemoryManager.hpp
1 // Copyright (C) 2017 Jérôme Leclercq
2 // This file is part of the "Nazara Engine - Core module"
3 // For conditions of distribution and use, see copyright notice in Config.hpp
4 
5 #pragma once
6 
7 #ifndef NAZARA_MEMORYMANAGER_HPP
8 #define NAZARA_MEMORYMANAGER_HPP
9 
10 #include <Nazara/Prerequesites.hpp>
11 #include <cstddef>
12 
13 namespace Nz
14 {
15  class NAZARA_CORE_API MemoryManager
16  {
17  public:
18  static void* Allocate(std::size_t size, bool multi = false, const char* file = nullptr, unsigned int line = 0);
19 
20  static void EnableAllocationFilling(bool allocationFilling);
21  static void EnableAllocationLogging(bool logAllocations);
22 
23  static void Free(void* pointer, bool multi = false);
24 
25  static unsigned int GetAllocatedBlockCount();
26  static std::size_t GetAllocatedSize();
27  static unsigned int GetAllocationCount();
28 
29  static bool IsAllocationFillingEnabled();
30  static bool IsAllocationLoggingEnabled();
31 
32  static void NextFree(const char* file, unsigned int line);
33 
34  private:
35  MemoryManager();
36  ~MemoryManager();
37 
38  static void Initialize();
39  static void TimeInfo(char buffer[23]);
40  static void Uninitialize();
41  };
42 }
43 
44 #endif // NAZARA_MEMORYMANAGER_HPP
TODO: Inherit SoundEmitter from Node.
Definition: Algorithm.hpp:12
Core class that represents a manager for the memory.
Definition: MemoryManager.hpp:15