decompiler
1.0.0
|
A circular buffer template. More...
#include <prettyprint.hh>
Public Member Functions | |
circularqueue (int4 sz) | |
Construct queue of a given size. More... | |
~circularqueue (void) | |
Destructor. | |
void | setMax (int4 sz) |
Establish a new maximum queue size. More... | |
int4 | getMax (void) const |
Get the maximum queue size. | |
void | expand (int4 amount) |
Expand the (maximum) size of the queue. More... | |
void | clear (void) |
Clear the queue. | |
bool | empty (void) const |
Is the queue empty. | |
int4 | topref (void) const |
Get a reference to the last object on the queue/stack. | |
int4 | bottomref (void) const |
Get a reference to the first object on the queue/stack. | |
_type & | ref (int4 r) |
Retrieve an object by its reference. | |
_type & | top (void) |
Get the last object on the queue/stack. | |
_type & | bottom (void) |
Get the first object on the queue/stack. | |
_type & | push (void) |
Push a new object onto the queue/stack. | |
_type & | pop (void) |
Pop the (last) object on the stack. | |
_type & | popbottom (void) |
Get the (next) object in the queue. | |
Private Attributes | |
_type * | cache |
An array of the template object. | |
int4 | left |
Index within the array of the leftmost object in the queue. | |
int4 | right |
Index within the array of the rightmost object in the queue. | |
int4 | max |
Size of the array. | |
A circular buffer template.
A circular buffer implementation that can act as a stack: push(), pop(). Or it can act as a queue: push(), popbottom(). The size of the buffer can be expanded on the fly using expand(). The object being buffered must support a void constructor and the assignment operator. Objects can also be looked up via an integer reference.
ghidra::circularqueue< _type >::circularqueue | ( | int4 | sz | ) |
Construct queue of a given size.
sz | is the maximum number of objects the queue will hold |
void ghidra::circularqueue< _type >::expand | ( | int4 | amount | ) |
Expand the (maximum) size of the queue.
Expand the maximum size of this queue. Objects currently in the queue are preserved, which involves copying the objects. This routine invalidates references referring to objects currently in the queue, although the references can be systematically adjusted to be valid again.
amount | is the number of additional objects the resized queue will support |
Referenced by ghidra::EmitPrettyPrint::expand().
void ghidra::circularqueue< _type >::setMax | ( | int4 | sz | ) |
Establish a new maximum queue size.
This destroys the old queue and reallocates a new queue with the given maximum size
sz | the maximum size of the new queue |
Referenced by ghidra::EmitPrettyPrint::setMaxLineSize().