Marcus Lee / LinearArray

linearArray.h

Committer:
UHSLMarcus
Date:
2017-03-14
Revision:
9:68d882e457c5
Parent:
2:92576523c23e
Child:
10:864b79e79ca8

File content as of revision 9:68d882e457c5:

#ifndef LINEAR_ARRAY_H
#define LINEAR_ARRAY_H

#include "mbed.h"

template<class type>
class LinearArray {
	public:
		LinearArray(int size, bool forced = false);
		~LinearArray();
		int push(type item);
		type& pop();
		bool try_pop(type& item);
		type& peek();
		type& peek(int idx);
		int size();
		bool empty();
		bool full();
		int count();
	private:
		type* _array;
		int _elem_count;
		int _array_size;
		int _front;
		int _rear;
		bool _forced;

};

#include "LinearArray.hpp"

#endif /* LINEAR_ARRAY_H */