Prusa MINI Firmware overview
|
Circular Queue class. More...
#include <circularqueue.h>
Public Member Functions | |
CircularQueue () | |
Class constructor. More... | |
T | dequeue () |
Removes and returns a item from the queue. More... | |
bool | enqueue (T const &item) |
Adds an item to the queue. More... | |
bool | isEmpty () |
Checks if the queue has no items. More... | |
bool | isFull () |
Checks if the queue is full. More... | |
uint8_t | size () |
Gets the queue size. More... | |
T | peek () |
Gets the next item from the queue without removing it. More... | |
uint8_t | count () |
Gets the number of items on the queue. More... | |
Circular Queue class.
Marlin 3D Printer Firmware Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
Based on Sprinter and grbl. Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Implementation of the classic ring buffer data structure
CircularQueue< T, N >::CircularQueue | ( | ) |
T CircularQueue< T, N >::dequeue | ( | ) |
Removes and returns a item from the queue.
Removes the oldest item on the queue, pointed to by the buffer_t head field. The item is returned to the caller.
bool CircularQueue< T, N >::enqueue | ( | T const & | item | ) |
Adds an item to the queue.
Adds an item to the queue on the location pointed by the buffer_t tail variable. Returns false if no queue space is available.
item | Item to be added to the queue |
bool CircularQueue< T, N >::isEmpty | ( | ) |
bool CircularQueue< T, N >::isFull | ( | ) |
uint8_t CircularQueue< T, N >::size | ( | ) |
T CircularQueue< T, N >::peek | ( | void | ) |
uint8_t CircularQueue< T, N >::count | ( | ) |