3#ifndef ENGINE_SHARED_RINGBUFFER_H
4#define ENGINE_SHARED_RINGBUFFER_H
41 void *
Prev(
void *pCurrent);
42 void *
Next(
void *pCurrent);
46 void Init(
void *pMemory,
int Size,
int Flags);
48 void SetPopCallback(
const std::function<
void(
void *pCurrent)> PopCallback);
70 PopCallback((T *)pCurrent);
80template<
typename T,
int TSIZE,
int TFLAGS = 0>
107 m_pBuffer =
static_cast<unsigned char *
>(malloc(Size));
Definition: ringbuffer.h:93
void Init(int Size, int Flags)
Definition: ringbuffer.h:104
virtual ~CDynamicRingBuffer()
Definition: ringbuffer.h:99
CDynamicRingBuffer(int Size, int Flags=0)
Definition: ringbuffer.h:97
unsigned char * m_pBuffer
Definition: ringbuffer.h:94
Definition: ringbuffer.h:13
CItem * m_pPrev
Definition: ringbuffer.h:15
CItem * m_pNext
Definition: ringbuffer.h:16
int m_Free
Definition: ringbuffer.h:17
int m_Size
Definition: ringbuffer.h:18
Definition: ringbuffer.h:11
CItem * m_pConsume
Definition: ringbuffer.h:24
static constexpr int ITEM_SIZE
Definition: ringbuffer.h:56
int PopFirst()
Definition: ringbuffer.cpp:137
void * First()
Definition: ringbuffer.cpp:195
int m_Size
Definition: ringbuffer.h:29
void SetPopCallback(const std::function< void(void *pCurrent)> PopCallback)
Definition: ringbuffer.cpp:132
void * Allocate(int Size)
Definition: ringbuffer.cpp:65
void Clear()
Definition: ringbuffer.cpp:53
CItem * m_pLast
Definition: ringbuffer.h:27
void * Prev(void *pCurrent)
Definition: ringbuffer.cpp:167
@ FLAG_RECYCLE
Definition: ringbuffer.h:54
CItem * m_pProduce
Definition: ringbuffer.h:23
CItem * PrevBlock(CItem *pItem)
Definition: ringbuffer.cpp:12
CItem * MergeBack(CItem *pItem)
Definition: ringbuffer.cpp:19
CItem * m_pBuffer
Definition: ringbuffer.h:21
void Init(void *pMemory, int Size, int Flags)
Definition: ringbuffer.cpp:45
CItem * NextBlock(CItem *pItem)
Definition: ringbuffer.cpp:5
void * Next(void *pCurrent)
Definition: ringbuffer.cpp:181
void * Last()
Definition: ringbuffer.cpp:202
int m_Flags
Definition: ringbuffer.h:30
CItem * m_pFirst
Definition: ringbuffer.h:26
std::function< void(void *pCurrent)> m_PopCallback
Definition: ringbuffer.h:32
Definition: ringbuffer.h:82
unsigned char m_aBuffer[TSIZE]
Definition: ringbuffer.h:83
CStaticRingBuffer()
Definition: ringbuffer.h:86
void Init()
Definition: ringbuffer.h:88
Definition: ringbuffer.h:63
T * Prev(T *pCurrent)
Definition: ringbuffer.h:74
int PopFirst()
Definition: ringbuffer.h:66
T * Allocate(int Size)
Definition: ringbuffer.h:65
T * Next(T *pCurrent)
Definition: ringbuffer.h:75
T * Last()
Definition: ringbuffer.h:77
T * First()
Definition: ringbuffer.h:76
void SetPopCallback(std::function< void(T *pCurrent)> PopCallback)
Definition: ringbuffer.h:67