/cvmfs/atlas.cern.ch/repo/sw/ASG/AnalysisBase/2.4.31/CxxUtils/CxxUtils/libcalg/queue.h File Reference
Double-ended queue.
More...
Go to the source code of this file.
Detailed Description
Double-ended queue.
A double ended queue stores a list of values in order. New values can be added and removed from either end of the queue.
To create a new queue, use queue_new. To destroy a queue, use queue_free.
To add values to a queue, use queue_push_head and queue_push_tail.
To read values from the ends of a queue, use queue_pop_head and queue_pop_tail. To examine the ends without removing values from the queue, use queue_peek_head and queue_peek_tail.
Define Documentation
#define QUEUE_NULL ((void *) 0) |
Typedef Documentation
typedef struct _Queue Queue |
A value stored in a Queue.
Function Documentation
void queue_free |
( |
Queue * |
queue |
) |
|
Destroy a queue.
- Parameters:
-
| queue | The queue to destroy. |
int queue_is_empty |
( |
Queue * |
queue |
) |
|
Query if any values are currently in a queue.
- Parameters:
-
- Returns:
- Zero if the queue is not empty, non-zero if the queue is empty.
Queue* queue_new |
( |
void |
|
) |
|
Create a new double-ended queue.
- Returns:
- A new queue, or NULL if it was not possible to allocate the memory.
Read value from the head of a queue, without removing it from the queue.
- Parameters:
-
- Returns:
- Value at the head of the queue, or QUEUE_NULL if the queue is empty.
Read a value from the tail of a queue, without removing it from the queue.
- Parameters:
-
- Returns:
- Value at the tail of the queue, or QUEUE_NULL if the queue is empty.
Remove a value from the head of a queue.
- Parameters:
-
- Returns:
- Value that was at the head of the queue, or QUEUE_NULL if the queue is empty.
Remove a value from the tail of a queue.
- Parameters:
-
- Returns:
- Value that was at the head of the queue, or QUEUE_NULL if the queue is empty.
Add a value to the head of a queue.
- Parameters:
-
| queue | The queue. |
| data | The value to add. |
- Returns:
- Non-zero if the value was added successfully, or zero if it was not possible to allocate the memory for the new entry.
Add a value to the tail of a queue.
- Parameters:
-
| queue | The queue. |
| data | The value to add. |
- Returns:
- Non-zero if the value was added successfully, or zero if it was not possible to allocate the memory for the new entry.