Marcus Lee / LinearArray
Revision:
9:68d882e457c5
Parent:
2:92576523c23e
Child:
10:864b79e79ca8
--- a/linearArray.h	Wed Oct 05 09:35:55 2016 +0000
+++ b/linearArray.h	Tue Mar 14 10:05:47 2017 +0000
@@ -3,23 +3,30 @@
 
 #include "mbed.h"
 
-template <class type>
+template<class type>
 class LinearArray {
-    public:
-        LinearArray(int size);
-        ~LinearArray();
-        int add(type item);
-        void remove(int index);
-        int size();
-        int elements();
-        bool hasSpace();
-        type& operator[](int index);
-    private:
-        type* array;
-        int elem_count;
-        int array_size;
-}; 
+	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 */
\ No newline at end of file
+#include "LinearArray.hpp"
+
+#endif /* LINEAR_ARRAY_H */