mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Added all raknet headers for full raknet support Added Testclass "TestCB.cpp" which is a test implementation for raknet plugin "File List Transfer". We will use this plugin for file transfer in multiplayer git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2638 3b4a5df2-a311-0410-b5c6-a8a6f20db521
41 lines
963 B
C++
41 lines
963 B
C++
#ifndef __BYTE_POOL_H
|
|
#define __BYTE_POOL_H
|
|
|
|
#include "RakMemoryOverride.h"
|
|
#include "DS_MemoryPool.h"
|
|
#include "Export.h"
|
|
#include "SimpleMutex.h"
|
|
#include "RakAssert.h"
|
|
|
|
// #define _DISABLE_BYTE_POOL
|
|
// #define _THREADSAFE_BYTE_POOL
|
|
|
|
namespace DataStructures
|
|
{
|
|
// Allocate some number of bytes from pools. Uses the heap if necessary.
|
|
class RAK_DLL_EXPORT BytePool
|
|
{
|
|
public:
|
|
BytePool();
|
|
~BytePool();
|
|
// Should be at least 8 times bigger than 8192
|
|
void SetPageSize(int size);
|
|
unsigned char* Allocate(int bytesWanted);
|
|
void Release(unsigned char *data);
|
|
void Clear(void);
|
|
protected:
|
|
MemoryPool<unsigned char[128]> pool128;
|
|
MemoryPool<unsigned char[512]> pool512;
|
|
MemoryPool<unsigned char[2048]> pool2048;
|
|
MemoryPool<unsigned char[8192]> pool8192;
|
|
#ifdef _THREADSAFE_BYTE_POOL
|
|
SimpleMutex mutex128;
|
|
SimpleMutex mutex512;
|
|
SimpleMutex mutex2048;
|
|
SimpleMutex mutex8192;
|
|
#endif
|
|
};
|
|
}
|
|
|
|
#endif
|