finished
This commit is contained in:
parent
77a072886c
commit
8b246c9774
6 changed files with 739 additions and 31 deletions
21
queue.h
21
queue.h
|
|
@ -3,7 +3,7 @@
|
|||
* ---------------------------------------------------------
|
||||
* Exercise Number: S03
|
||||
* Title: Queue Inteface
|
||||
* Author: */<your name>;/*
|
||||
* Author: Marc Tismonar
|
||||
* ----------------------------------------------------------
|
||||
* Description:
|
||||
* The declaration of a queue abstract data type.
|
||||
|
|
@ -14,6 +14,7 @@
|
|||
#include <stdbool.h>
|
||||
|
||||
/** The type of the integer queue: IntQueue. */
|
||||
typedef struct IntQueueData* IntQueue;
|
||||
|
||||
/**
|
||||
* Obtains ('creates') and provides a 'new' queue instance.
|
||||
|
|
@ -25,7 +26,7 @@
|
|||
*
|
||||
* @return IntQueue The queue instance or 0, if no queue could by instantiated.
|
||||
*/
|
||||
<type> queue_obtain();
|
||||
IntQueue queue_obtain();
|
||||
|
||||
/**
|
||||
* Releases a queue that was obtained earlier via function `obtain_queue`.
|
||||
|
|
@ -38,7 +39,7 @@
|
|||
* @param p_queue The pointer to the queue to release. The value of the pointer
|
||||
* is set to 0, if the queue was successfully released, otherwise it is left untouched.
|
||||
*/
|
||||
<type> queue_release(<params>);
|
||||
IntQueue queue_release(IntQueue* p_queue);
|
||||
|
||||
/**
|
||||
* Determines whether or not the given queue is valid.
|
||||
|
|
@ -46,7 +47,7 @@
|
|||
* @param queue The queue to evaluate.
|
||||
* @return `True` if the queue is valid, false otherwise.
|
||||
*/
|
||||
<type> queue_is_valid(<params>);
|
||||
bool queue_is_valid(IntQueue queue);
|
||||
|
||||
/**
|
||||
* Determines whether or not the queue contains at least one item.
|
||||
|
|
@ -54,7 +55,7 @@
|
|||
* @param queue The queue to evaluate.
|
||||
* @return `False` if the queue contains one or more items, `true` otherwise.
|
||||
*/
|
||||
<type> queue_is_empty(<params>);
|
||||
bool queue_is_empty(IntQueue queue);
|
||||
|
||||
/**
|
||||
* Provides the number of values stored in the queue.
|
||||
|
|
@ -62,14 +63,14 @@
|
|||
* @param queue The queue to evaluate.
|
||||
* @return The number of values the queue contains.
|
||||
*/
|
||||
<type> queue_get_size(I<params>);
|
||||
int queue_get_size(IntQueue queue);
|
||||
|
||||
/**
|
||||
* Clears the given queue by removing all values from the queue.
|
||||
*
|
||||
* @param queue The queue to clear.
|
||||
*/
|
||||
<type> queue_clear(<params>);
|
||||
void queue_clear(IntQueue queue);
|
||||
|
||||
/**
|
||||
* Inserts the given value to the queue (as new tail).
|
||||
|
|
@ -77,7 +78,7 @@
|
|||
* @param queue The queue to which the value shall be appended.
|
||||
* @param value The value to append to the queue.
|
||||
*/
|
||||
<type> queue_enqueue(<params>);
|
||||
void queue_enqueue(IntQueue queue, int value);
|
||||
|
||||
/**
|
||||
* Provides the value that 'dequeue' would provided but WITHOUT removing
|
||||
|
|
@ -86,7 +87,7 @@
|
|||
* @param queue The queue from which the value shall be peeked.
|
||||
* @return The next value or 0, if the queue is empty.
|
||||
*/
|
||||
<type> queue_peek(<params>);
|
||||
int queue_peek(IntQueue queue);
|
||||
|
||||
/**
|
||||
* Provides AND removes the next value from the queue.
|
||||
|
|
@ -94,5 +95,5 @@
|
|||
* @param queue The queue from which the value shall be removed and returned.
|
||||
* @return The value or 0, if the queue is empty.
|
||||
*/
|
||||
<type> queue_dequeue(<params>);
|
||||
int queue_dequeue(IntQueue queue);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue