Add peek method to circular buffer.
This commit is contained in:
committed by
Graydon Hoare
parent
17fa6bfd9a
commit
d6cba83322
@@ -127,6 +127,11 @@ circular_buffer::dequeue(void *dst) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t *
|
||||||
|
circular_buffer::peek() {
|
||||||
|
return &_buffer[_next];
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
circular_buffer::is_empty() {
|
circular_buffer::is_empty() {
|
||||||
return _unread == 0;
|
return _unread == 0;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public:
|
|||||||
void transfer(void *dst);
|
void transfer(void *dst);
|
||||||
void enqueue(void *src);
|
void enqueue(void *src);
|
||||||
void dequeue(void *dst);
|
void dequeue(void *dst);
|
||||||
|
uint8_t *peek();
|
||||||
bool is_empty();
|
bool is_empty();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user