2022-10-09 05:13:17 +00:00
|
|
|
#ifndef _CCIRCULARBUFFER
|
|
|
|
#define _CCIRCULARBUFFER
|
2022-09-11 05:54:54 +00:00
|
|
|
|
|
|
|
#include <types.h>
|
|
|
|
|
|
|
|
class CCircularBuffer {
|
|
|
|
public:
|
2022-09-18 06:05:46 +00:00
|
|
|
enum EOwnership { kOS_Owned, kOS_NotOwned };
|
|
|
|
|
|
|
|
CCircularBuffer(void* buf, int len, EOwnership owned = kOS_NotOwned);
|
|
|
|
bool IsWrappedMemory(int offset, int len);
|
|
|
|
void* Alloc(int len);
|
|
|
|
void Free(void* ptr, int len);
|
|
|
|
int GetAllocatedAmount() const;
|
2022-09-11 05:54:54 +00:00
|
|
|
|
|
|
|
private:
|
2022-10-09 05:37:23 +00:00
|
|
|
uchar x0_owned;
|
2022-09-18 06:05:46 +00:00
|
|
|
void* x4_ptr;
|
2022-10-09 05:37:23 +00:00
|
|
|
int x8_bufferLen;
|
|
|
|
int xc_;
|
|
|
|
int x10_nextFreeAddr;
|
|
|
|
int x14_;
|
2022-09-11 05:54:54 +00:00
|
|
|
};
|
2022-10-09 05:13:17 +00:00
|
|
|
|
|
|
|
#endif // _CCIRCULARBUFFER
|