26 lines
482 B
C++
26 lines
482 B
C++
#ifndef RINGBUFFER_H
|
|
#define RINGBUFFER_H
|
|
|
|
#include <cstddef>
|
|
class Ringbuffer
|
|
{
|
|
public:
|
|
Ringbuffer();
|
|
Ringbuffer(size_t size);
|
|
~Ringbuffer();
|
|
size_t size() const;
|
|
size_t size_free();
|
|
size_t size_used();
|
|
size_t read(void *buf, size_t bufSize);
|
|
bool write(void *buf, size_t bufSize);
|
|
|
|
private:
|
|
size_t pSize;
|
|
unsigned char* headptr;
|
|
unsigned char* endptr;
|
|
unsigned char* readptr;
|
|
unsigned char* writeptr;
|
|
};
|
|
|
|
#endif // RINGBUFFER_H
|