forked from bitdog-io/restraining_bolt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueue.h
More file actions
39 lines (30 loc) · 774 Bytes
/
Copy pathQueue.h
File metadata and controls
39 lines (30 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Queue.h
#ifndef _QUEUE_h
#define _QUEUE_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#else
#include "WProgram.h"
#endif
#include "ArduinoLog.h"
// define default capacity of the queue
constexpr auto QUEUE_SIZE = 20;
// Class for Queue
class Queue
{
const char** _arr; // array to store queue elements
int _capacity; // maximum capacity of the queue
int _front; // front points to front element in the queue (if any)
int _rear; // rear points to last element in the queue
int _count; // current size of the queue
public:
Queue( int size = QUEUE_SIZE ); // constructor
~Queue(); // destructor
const char* dequeue();
void enqueue( const char* item );
const char* peek();
int size();
bool isEmpty();
bool isFull();
};
#endif