shared ring buffer continued
This commit is contained in:
parent
0ead44bea9
commit
4e9e465360
@ -5,13 +5,25 @@ SimpleRingBuffer::SimpleRingBuffer(const size_t size, bool overwriteOld,
|
||||
size_t maxExcessBytes) :
|
||||
RingBufferBase<>(0, size, overwriteOld),
|
||||
maxExcessBytes(maxExcessBytes) {
|
||||
if(maxExcessBytes > size) {
|
||||
this->maxExcessBytes = size;
|
||||
}
|
||||
else {
|
||||
this->maxExcessBytes = maxExcessBytes;
|
||||
}
|
||||
buffer = new uint8_t[size + maxExcessBytes];
|
||||
}
|
||||
|
||||
SimpleRingBuffer::SimpleRingBuffer(uint8_t *buffer, const size_t size,
|
||||
bool overwriteOld, size_t maxExcessBytes):
|
||||
RingBufferBase<>(0, size, overwriteOld), buffer(buffer),
|
||||
maxExcessBytes(maxExcessBytes) {}
|
||||
RingBufferBase<>(0, size, overwriteOld), buffer(buffer) {
|
||||
if(maxExcessBytes > size) {
|
||||
this->maxExcessBytes = size;
|
||||
}
|
||||
else {
|
||||
this->maxExcessBytes = maxExcessBytes;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SimpleRingBuffer::~SimpleRingBuffer() {
|
||||
|
@ -111,7 +111,7 @@ public:
|
||||
private:
|
||||
static const uint8_t READ_PTR = 0;
|
||||
uint8_t* buffer = nullptr;
|
||||
const size_t maxExcessBytes;
|
||||
size_t maxExcessBytes;
|
||||
size_t excessBytes = 0;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user