Skip to content

Instantly share code, notes, and snippets.

@imdanielsp
Created April 23, 2017 21:31
Show Gist options
  • Save imdanielsp/f58c7dfe04778d170906e122c32bd328 to your computer and use it in GitHub Desktop.
Save imdanielsp/f58c7dfe04778d170906e122c32bd328 to your computer and use it in GitHub Desktop.
Header of the Opaque Queue
/**
* \brief T is the template type used in the queue. For other types
* support, change 'int' to the type desired.
* */
typedef int T;
/**
* \brief A forward declaration of the queue. This gives the client
* access to the Queue object itself without knowing the expecificts of the
* implementation making the object opaque.
* */
typedef struct Queue Queue;
typedef Queue* pQueue;
/**
* \brief Creates the queue.
*
* \returns pQueue
* */
pQueue makeQueue();
/**
* \brief Push a T to the queue.
*
* \param pQueue queue, T data
*
* \return size_t the new size of the queue.
* */
size_t push(pQueue queue, T data);
/**
* \brief Remove the next item in the queue.
*
* \param pQueue queue
*
* \return T*, where T is the data.
* */
T* pop(pQueue queue);
/**
* \brief Returns the size of the current queue
*
* \param pQueue queue
*
* \return size_t the size of the queue.
* */
size_t queueSize(pQueue queue);
/**
* \brief Deallocates the queue and the data if any.
*
* \param pQueue* pPqueue
*
* */
void destroyQueue(pQueue* pPqueue);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment