LibRCG  3.1.1
queue.h
Go to the documentation of this file.
1 
11 #ifndef _QUEUE_H_
12 #define _QUEUE_H_
13 
14 #include "iterator.h"
15 
19 typedef struct sQueueNode
20 {
22  void* value;
24  struct sQueueNode* next;
25 }SQueueNode;
26 
31 
35 typedef struct sQueue
36 {
38  int size;
44 }SQueue;
45 
49 typedef SQueue* Queue;
50 
51 //==============================================================================
52 
60 Queue newQueue(void);
61 
71 void queueDelete(Queue queue);
72 
83 int queueInsert(Queue queue,void* value);
84 
102 int queueRemove(Queue queue,void** value);
103 
121 int queueConsult(Queue queue,void** value);
122 
131 int queueSize(Queue queue);
132 
145 int queueMap(Queue queue,void(*fun)(void*));
146 
159 
160 #endif
int size
Number of elements of this queue.
Definition: queue.h:38
Queue node structure.
Definition: queue.h:19
int queueSize(Queue queue)
Returns the size of a queue.
Definition: queue.c:109
QueueNode last
Last node.
Definition: queue.h:43
void queueDelete(Queue queue)
Deletes a queue.
Definition: queue.c:26
Queue structure.
Definition: queue.h:35
struct sQueueNode * next
Next node.
Definition: queue.h:24
int queueInsert(Queue queue, void *value)
Inserts an element in a queue.
Definition: queue.c:44
Iterator structure.
Definition: iterator.h:17
int queueRemove(Queue queue, void **value)
Removes an element from a queue.
Definition: queue.c:64
int queueMap(Queue queue, void(*fun)(void *))
Applies a function to the elements of a queue.
Definition: queue.c:116
SQueue * Queue
Queue definition.
Definition: queue.h:49
QueueNode head
Apontador para o início da queue.
Definition: queue.h:41
int queueConsult(Queue queue, void **value)
Provides the value at the head of a queue.
Definition: queue.c:95
void * value
Node's value.
Definition: queue.h:22
Iterator queueIterator(Queue queue)
Creates an iterator from a queue.
Definition: queue.c:131
Implementation of an iterator.
SQueueNode * QueueNode
Queue node definition.
Definition: queue.h:30
Queue newQueue(void)
Creates a queue.
Definition: queue.c:12

LibRCG © 2004-2015   Rui Carlos Gonçalves