//From https://www.techiedelight.com/queue-implementation-cpp/
#pragma once

#include <iostream>
//#include <cstdlib>
#include <string>
using namespace std;

// TODO these 2 values really need to be passed to the constructor
#define qDEPTH 10
#define qWIDTH 256

class FIFO
{
public:
	FIFO(int depth, int width, string qID)	//constructor
	{
		capacity = qDEPTH;
		head = 0;
		tail = -1;
		count = 0;
		qName = qID;
	}
	
	~FIFO()      			   // destructor
	{
		//delete[] arr;
	}

	int32_t dequeue(string &timestamp, string &deQString);
	void enqueue(string timestamp, uint8_t inMsg[qWIDTH]);
	int peek();
	int getCount();
	bool isEmpty();
	bool isFull();
	
protected:
	string fifoTimestamp[qDEPTH];
	uint8_t fifoArray[qDEPTH][qWIDTH];           	// array to store queue elements
	int32_t capacity;           // maximum capacity of the queue
	int32_t head;          	// front points to front element in the queue (if any)
	int32_t tail;           	// rear points to last element in the queue
	int32_t count;          	// current size of the queue
	string qName;
};

