#include <stdlib.h>
#include <stdio.h>
Go to the source code of this file.
Classes | |
struct | _Node |
Definition of a queue's node. More... | |
struct | _NodeQueue |
Definition the queue. More... | |
Typedefs | |
typedef struct _Node | Node |
Definition of a queue's node. | |
typedef struct _NodeQueue | NodeQueue |
Definition the queue. | |
Functions | |
int | queueIsEmpty (NodeQueue *q) |
void | pushNode (NodeQueue *q, int x, int y) |
void | pushNodeLast (NodeQueue *q, int x, int y) |
int | popNode (NodeQueue *q, Node *n) |
void | printQueue (NodeQueue *q) |
NodeQueue * | newQueue (void) |
int | delQueue (NodeQueue *q) |
int | isInQueue (NodeQueue *q, int x, int y) |
void | drainQueue (NodeQueue *q) |
Definition in file pathqueue.h.
int delQueue | ( | NodeQueue * | q | ) |
Free queue memory
q | Queue |
Definition at line 133 of file pathqueue.c.
References queueIsEmpty().
void drainQueue | ( | NodeQueue * | q | ) |
Free memory allocated in the queue
q | Queue |
Definition at line 162 of file pathqueue.c.
References popNode().
int isInQueue | ( | NodeQueue * | q, | |
int | x, | |||
int | y | |||
) |
Finds out if the node (X,Y) is in the queue
q | Queue | |
x | Coordonate X of a cell | |
y | Coordonate Y of a cell |
Definition at line 147 of file pathqueue.c.
References _NodeQueue::first, _Node::next, _Node::x, and _Node::y.
NodeQueue* newQueue | ( | void | ) |
Init queue values
q | Queue |
Definition at line 121 of file pathqueue.c.
References _NodeQueue::first, and _NodeQueue::last.
Pop the first node of the queue
q | Queue | |
n | Pointer to a node |
Definition at line 88 of file pathqueue.c.
References _NodeQueue::first, _NodeQueue::last, _PathPoint::next, queueIsEmpty(), _PathPoint::x, _Node::x, _PathPoint::y, and _Node::y.
void printQueue | ( | NodeQueue * | q | ) |
Print the queue
q | Queue |
Definition at line 106 of file pathqueue.c.
References _NodeQueue::first, _Node::next, _Node::x, and _Node::y.
void pushNode | ( | NodeQueue * | q, | |
int | x, | |||
int | y | |||
) |
Push a node into the queue in a FIFO mode
q | Queue | |
x | Coordonate X of a cell | |
y | Coordonate Y of a cell |
Definition at line 34 of file pathqueue.c.
References _NodeQueue::first, _NodeQueue::last, _PathPoint::next, _Node::next, queueIsEmpty(), _Node::x, and _Node::y.
void pushNodeLast | ( | NodeQueue * | q, | |
int | x, | |||
int | y | |||
) |
Push a node into the queue in a LIFO mode
q | Queue | |
x | Coordonate X of a cell | |
y | Coordonate Y of a cell |
Definition at line 61 of file pathqueue.c.
References _NodeQueue::first, _NodeQueue::last, _Node::next, queueIsEmpty(), _Node::x, and _Node::y.
int queueIsEmpty | ( | NodeQueue * | q | ) |
Tests if a queue is empty
q | A queue |
Definition at line 23 of file pathqueue.c.
References _NodeQueue::first, and _NodeQueue::last.