Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed ESC SR04 TSI
Diff: com/queue/queue.h
- Revision:
- 16:5f736b955d53
diff -r f07910c5b815 -r 5f736b955d53 com/queue/queue.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/com/queue/queue.h Thu Jun 06 00:18:29 2013 +0000
@@ -0,0 +1,49 @@
+/**************************** queue.h ****************************************/
+/* */
+/* Authers: Greg Abdo. */
+/* Date: February 23, 2013 */
+/* Version: 1.0 */
+/* */
+/* The queue is used to stack StructureItem in order with a FILO arrangement.*/
+/*****************************************************************************/
+
+#ifndef QUEUE_H
+#define QUEUE_H
+
+#include "mbed.h"
+
+using namespace std;
+
+class queue
+{
+public:
+ queue(); // Queue constructor
+ ~queue(); // Queue destructor
+
+ bool isEmpty(); // Check for an empty queue.
+ void clear(); // Clears the entire queue.
+ void add( char* ); // Push commandData into the queue.
+ char* peek(); // Look at the last item in the queue.
+ char* pop(); // Pop the top item off the queue.
+ void printAll(); // Print the entire queue.
+
+private:
+ struct queueNode // Node object for the queue.
+ {
+ queueNode( char* array )
+ {
+ data = array;
+ next = NULL;
+ }
+
+ ~queueNode()
+ {}
+
+ char* data; // Pointer to the StructureItem object.
+ queueNode * next; // Next node in the queue.
+ };
+
+ queueNode * front; // Root of the queue.
+};
+
+#endif
