gem5 v24.0.0.0
|
Circular buffer backed by a vector. More...
#include <circlebuf.hh>
Public Types | |
using | value_type = T |
Public Member Functions | |
CircleBuf (size_t size) | |
bool | empty () const |
size_t | size () const |
size_t | capacity () const |
void | flush () |
Throw away any data in the buffer. | |
template<class OutputIterator > | |
void | peek (OutputIterator out, size_t len) const |
Copy buffer contents without advancing the read pointer. | |
template<class OutputIterator > | |
void | peek (OutputIterator out, off_t offset, size_t len) const |
Copy buffer contents without advancing the read pointer. | |
template<class OutputIterator > | |
void | read (OutputIterator out, size_t len) |
Copy buffer contents and advance the read pointer. | |
template<class InputIterator > | |
void | write (InputIterator in, size_t len) |
Add elements to the end of the ring buffers and advance. | |
Private Attributes | |
std::vector< T > | buffer |
size_t | start = 0 |
size_t | used = 0 |
size_t | maxSize |
Circular buffer backed by a vector.
The data in the cricular buffer is stored in a standard vector.
Definition at line 58 of file circlebuf.hh.
using gem5::CircleBuf< T >::value_type = T |
Definition at line 67 of file circlebuf.hh.
|
inlineexplicit |
Definition at line 69 of file circlebuf.hh.
|
inline |
Definition at line 73 of file circlebuf.hh.
References gem5::CircleBuf< T >::maxSize.
Referenced by gem5::Fifo< T >::capacity().
|
inline |
Definition at line 71 of file circlebuf.hh.
References gem5::CircleBuf< T >::used.
Referenced by gem5::Terminal::console_in(), gem5::Terminal::dataAvailable(), gem5::Fifo< T >::empty(), gem5::Terminal::readData(), and TEST().
|
inline |
Throw away any data in the buffer.
Definition at line 79 of file circlebuf.hh.
References gem5::CircleBuf< T >::start, and gem5::CircleBuf< T >::used.
Referenced by gem5::arrayParamIn(), gem5::Fifo< T >::flush(), and gem5::CircleBuf< T >::write().
|
inline |
Copy buffer contents without advancing the read pointer.
out | Output iterator/pointer |
offset | Offset into the ring buffer |
len | Number of elements to copy |
Definition at line 107 of file circlebuf.hh.
References gem5::CircleBuf< T >::buffer, gem5::ArmISA::len, gem5::CircleBuf< T >::maxSize, gem5::ArmISA::offset, panic_if, gem5::CircleBuf< T >::start, and gem5::CircleBuf< T >::used.
|
inline |
Copy buffer contents without advancing the read pointer.
out | Output iterator/pointer |
len | Number of elements to copy |
Definition at line 93 of file circlebuf.hh.
References gem5::ArmISA::len, and gem5::CircleBuf< T >::peek().
Referenced by gem5::Terminal::accept(), gem5::arrayParamOut(), gem5::CircleBuf< T >::peek(), gem5::Fifo< T >::peek(), gem5::CircleBuf< T >::read(), TEST(), TEST(), and TEST().
|
inline |
Copy buffer contents and advance the read pointer.
out | Output iterator/pointer |
len | Number of elements to read |
Definition at line 140 of file circlebuf.hh.
References gem5::ArmISA::len, gem5::CircleBuf< T >::peek(), gem5::CircleBuf< T >::start, and gem5::CircleBuf< T >::used.
Referenced by gem5::Fifo< T >::read(), gem5::Terminal::readData(), TEST(), TEST(), and TEST().
|
inline |
Definition at line 72 of file circlebuf.hh.
References gem5::CircleBuf< T >::used.
Referenced by gem5::Terminal::accept(), gem5::arrayParamOut(), gem5::Fifo< T >::size(), TEST(), TEST(), TEST(), and TEST().
|
inline |
Add elements to the end of the ring buffers and advance.
Writes which would exceed the capacity of the queue fill the avaialble space, and then continue overwriting the head of the queue. The head advances as if that data had been read out.
in | Input iterator/pointer |
len | Number of elements to read |
Definition at line 158 of file circlebuf.hh.
References gem5::CircleBuf< T >::buffer, gem5::CircleBuf< T >::flush(), gem5::ArmISA::len, gem5::CircleBuf< T >::maxSize, gem5::CircleBuf< T >::start, and gem5::CircleBuf< T >::used.
Referenced by gem5::arrayParamIn(), gem5::Terminal::data(), TEST(), TEST(), TEST(), TEST(), TEST(), gem5::Fifo< T >::write(), and gem5::Terminal::writeData().
|
private |
Definition at line 61 of file circlebuf.hh.
Referenced by gem5::CircleBuf< T >::peek(), and gem5::CircleBuf< T >::write().
|
private |
Definition at line 64 of file circlebuf.hh.
Referenced by gem5::CircleBuf< T >::capacity(), gem5::CircleBuf< T >::peek(), and gem5::CircleBuf< T >::write().
|
private |
Definition at line 62 of file circlebuf.hh.
Referenced by gem5::CircleBuf< T >::flush(), gem5::CircleBuf< T >::peek(), gem5::CircleBuf< T >::read(), and gem5::CircleBuf< T >::write().
|
private |
Definition at line 63 of file circlebuf.hh.
Referenced by gem5::CircleBuf< T >::empty(), gem5::CircleBuf< T >::flush(), gem5::CircleBuf< T >::peek(), gem5::CircleBuf< T >::read(), gem5::CircleBuf< T >::size(), and gem5::CircleBuf< T >::write().