metaforce/Runtime/CMemory.hpp

37 lines
859 B
C++
Raw Normal View History

2016-02-13 09:02:47 +00:00
#ifndef __PSHAG_CMEMORY_HPP__
#define __PSHAG_CMEMORY_HPP__
2015-08-17 05:26:58 +00:00
2015-08-23 18:53:43 +00:00
#include "IAllocator.hpp"
2016-02-13 09:02:47 +00:00
namespace pshag
{
2015-08-22 01:58:41 +00:00
class COsContext;
2015-08-17 05:26:58 +00:00
class CMemory
{
public:
2015-08-28 00:11:31 +00:00
static void Startup();
2015-08-17 05:26:58 +00:00
static void Shutdown();
2015-08-28 00:11:31 +00:00
static void SetAllocator(IAllocator&);
2015-08-23 18:53:43 +00:00
static void OffsetFakeStatics(int);
static void SetOutOfMemoryCallback(const IAllocator::TOutOfMemoryCallback, void*);
static void Free(void*);
2015-08-23 23:58:07 +00:00
static void* Alloc(size_t, IAllocator::EHint, IAllocator::EScope, IAllocator::EType, const CCallStack&);
2015-08-17 05:26:58 +00:00
};
class CMemorySys
{
public:
2015-08-28 00:11:31 +00:00
CMemorySys(IAllocator&);
2015-08-17 05:26:58 +00:00
~CMemorySys();
2015-08-17 20:33:58 +00:00
static IAllocator& GetGameAllocator();
2015-08-17 05:26:58 +00:00
};
}
2015-08-23 23:58:07 +00:00
/* Custom new funcs */
void* operator new(std::size_t sz, const char* funcName, const char* typeName);
void* operator new[](std::size_t sz, const char* funcName, const char* typeName);
2016-02-13 09:02:47 +00:00
#endif // __PSHAG_CMEMORY_HPP__