current state of 'sat-solver'
[platform/upstream/libsolv.git] / src / queue.h
1 /*
2  * queue.h
3  * 
4  */
5
6 #ifndef QUEUE_H
7 #define QUEUE_H
8
9 #include "pooltypes.h"
10
11 typedef struct _Queue {
12   Id *elements;         // current elements
13   int count;            // current number of elements (minimal size for elements pointer)
14   Id *alloc;            // this is whats actually allocated, elements > alloc if shifted
15   int left;             // space left in alloc *after* elements+count
16 } Queue;
17
18 // clear queue
19
20 #define QUEUEEMPTY(q) ((q)->alloc ? ((q)->left += ((q)->elements - (q)->alloc) + (q)->count, (q)->elements = (q)->alloc, (q)->count = 0) : ((q)->left += (q)->count, (q)->count = 0))
21
22 extern void clonequeue(Queue *t, Queue *s);
23 extern void queueinit(Queue *q);
24 extern void queueinit_buffer(Queue *q, Id *buf, int size);
25 extern void queuefree(Queue *q);
26 extern Id queueshift(Queue *q);
27 extern void queuepush(Queue *q, Id id);
28 extern void queuepushunique(Queue *q, Id id);
29
30 #endif /* QUEUE_H */