orca-sim
|
#include <Buffer.hpp>
Public Member Functions | |
Buffer (std::string name, uint32_t capacity) | |
Constructor. More... | |
~Buffer () | |
Destructor. More... | |
T | top () |
Peeks at the top of the buffer. More... | |
void | pop () |
Removes the object at the front of the buffer. More... | |
uint32_t | full () |
Returns TRUE when the buffer is full. More... | |
void | push (T) |
Pushes an object to the back of the buffer. More... | |
uint32_t | capacity () |
Returns max size of the buffer. More... | |
uint32_t | size () |
Counts elements from the buffer. More... | |
a name that identifies the model, advisably not empty. | |
Default ctor. | |
std::string | GetName () |
Getter method for the <_name> field. More... | |
void | SetName (std::string s) |
Setter method for the <_name> field. More... | |
Private Attributes | |
std::string | _name |
std::queue< T > * | _queue |
uint32_t | _size |
uint32_t | _capacity |
Definition at line 53 of file Buffer.hpp.
Buffer::Buffer | ( | std::string | name, |
uint32_t | capacity | ||
) |
Constructor.
Instantiate a new buffer.
name | (optional) An arbitrary name for the instance of Buffer. |
name | A unique name for the buffer (optional) |
Definition at line 35 of file Buffer.cpp.
Buffer::~Buffer | ( | ) |
Destructor.
Dtor.
Cleans dynamic allocated memory before disposing the object.
Definition at line 46 of file Buffer.cpp.
uint32_t Buffer::capacity | ( | ) |
Returns max size of the buffer.
Return the next element to be popped from the buffer.
Definition at line 91 of file Buffer.cpp.
uint32_t Buffer::full | ( | ) |
Returns TRUE when the buffer is full.
Return the number of elements store into underlying container.
Definition at line 118 of file Buffer.cpp.
|
inherited |
void Buffer::pop | ( | ) |
Removes the object at the front of the buffer.
Remove the element at the top of the buffer.
Definition at line 56 of file Buffer.cpp.
void Buffer::push | ( | T | e | ) |
Pushes an object to the back of the buffer.
Push an element to the bottom of the buffer.
e |
Definition at line 74 of file Buffer.cpp.
|
inherited |
uint32_t Buffer::size | ( | ) |
Counts elements from the buffer.
Return the number of elements store into underlying container.
Definition at line 109 of file Buffer.cpp.
T Buffer::top | ( | ) |
Peeks at the top of the buffer.
Return the next element to be popped from the buffer.
Definition at line 100 of file Buffer.cpp.
|
private |
Definition at line 58 of file Buffer.hpp.
|
private |
Definition at line 55 of file Buffer.hpp.
|
private |
Definition at line 56 of file Buffer.hpp.
|
private |
Definition at line 57 of file Buffer.hpp.