Derek McLean / Mbed 2 deprecated uwb-quadcopter

Dependencies:   mbed ESC SR04 TSI

com/queue/queue.h

Committer:
gabdo
Date:
2013-06-09
Revision:
32:d2b973c8d196

File content as of revision 32:d2b973c8d196:

/**************************** 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.
    int queueLength();              // Return how many objects are in the queue.

private:
    int length;
    
    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