3#ifndef ENGINE_SHARED_RINGBUFFER_H
4#define ENGINE_SHARED_RINGBUFFER_H
39 void *
Prev(
void *pCurrent);
40 void *
Next(
void *pCurrent);
44 void Init(
void *pMemory,
int Size,
int Flags);
46 void SetPopCallback(
const std::function<
void(
void *pCurrent)> PopCallback);
66 PopCallback((T *)pCurrent);
76template<
typename T,
int TSIZE,
int TFLAGS = 0>
103 m_pBuffer =
static_cast<unsigned char *
>(malloc(Size));
Definition: ringbuffer.h:89
void Init(int Size, int Flags)
Definition: ringbuffer.h:100
virtual ~CDynamicRingBuffer()
Definition: ringbuffer.h:95
CDynamicRingBuffer(int Size, int Flags=0)
Definition: ringbuffer.h:93
unsigned char * m_pBuffer
Definition: ringbuffer.h:90
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:22
static constexpr int ITEM_SIZE
Definition: ringbuffer.h:54
int PopFirst()
Definition: ringbuffer.cpp:131
void * First()
Definition: ringbuffer.cpp:189
int m_Size
Definition: ringbuffer.h:27
void SetPopCallback(const std::function< void(void *pCurrent)> PopCallback)
Definition: ringbuffer.cpp:126
void * Allocate(int Size)
Definition: ringbuffer.cpp:59
CItem * m_pLast
Definition: ringbuffer.h:25
void * Prev(void *pCurrent)
Definition: ringbuffer.cpp:161
CItem * m_pProduce
Definition: ringbuffer.h:21
CItem * PrevBlock(CItem *pItem)
Definition: ringbuffer.cpp:12
CItem * MergeBack(CItem *pItem)
Definition: ringbuffer.cpp:19
@ FLAG_RECYCLE
Definition: ringbuffer.h:52
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:175
void * Last()
Definition: ringbuffer.cpp:196
int m_Flags
Definition: ringbuffer.h:28
CItem * m_pFirst
Definition: ringbuffer.h:24
std::function< void(void *pCurrent)> m_PopCallback
Definition: ringbuffer.h:30
Definition: ringbuffer.h:78
unsigned char m_aBuffer[TSIZE]
Definition: ringbuffer.h:79
CStaticRingBuffer()
Definition: ringbuffer.h:82
void Init()
Definition: ringbuffer.h:84
Definition: ringbuffer.h:59
T * Prev(T *pCurrent)
Definition: ringbuffer.h:70
int PopFirst()
Definition: ringbuffer.h:62
T * Allocate(int Size)
Definition: ringbuffer.h:61
T * Next(T *pCurrent)
Definition: ringbuffer.h:71
T * Last()
Definition: ringbuffer.h:73
T * First()
Definition: ringbuffer.h:72
void SetPopCallback(std::function< void(T *pCurrent)> PopCallback)
Definition: ringbuffer.h:63