CObject
|
Queue data structure interface. More...
#include <CIQueue.h>
Public Member Functions | |
size_t | CCThreadedQueue_Size (struct CCThreadedQueue *self) |
CIQueueError | CIQueue_Insert (struct CIQueue *self, const void *element) |
CIQueueError | CIQueue_Remove (struct CIQueue *self, void *element) |
CIQueueError | CIQueue_Peek (struct CIQueue *self, void *element) |
size_t | CIQueue_Size (struct CIQueue *self) |
size_t | CIQueue_MaxSize (struct CIQueue *self) |
void | CIQueue_Clear (struct CIQueue *self) |
Data Fields | |
struct CInterface | interface |
Interface for queues. Provides methods for inserting, popping, peeking, and polling the queue's size.
Implementing classes must implement the behaviour specified in the functions described below.
This is a copy by value queue. That means a pointer to data is is given to the queues functions, and the data pointed to is then copied into the queue.
Implementing classes must provide a way to define the length of data copied in/out of the queue.
size_t CCThreadedQueue_Size | ( | struct CCThreadedQueue * | self | ) |
Get the number of elements currently in the queue. This is an unreliable method and should only be used for logging purposes.
self | The queue. |
void CIQueue_Clear | ( | struct CIQueue * | self | ) |
Reset the queue to having zero elements in it. All data copied into the queue is lost.
self | The queue. |
CIQueueError CIQueue_Insert | ( | struct CIQueue * | self, |
const void * | element | ||
) |
Insert an element into the tail of the queue by copy.
self | The queue. |
element | Pointer to data to copy into queue. |
size_t CIQueue_MaxSize | ( | struct CIQueue * | self | ) |
Get the maximum number of elements allowed in the queue.
self | The queue. |
CIQueueError CIQueue_Peek | ( | struct CIQueue * | self, |
void * | element | ||
) |
Peek at the element in the head of the queue by copy. This does not remove the head.
self | The queue. |
element | Data in the head of the queue will be copied to the location pointed to by this. |
CIQueueError CIQueue_Remove | ( | struct CIQueue * | self, |
void * | element | ||
) |
Remove an element from the head of the queue by copy.
self | The queue |
element | Data in the head of the queue will be copied into the location pointed to by this. Pass in NULL to remove the the head of the queue without copying out the data. |
size_t CIQueue_Size | ( | struct CIQueue * | self | ) |
Get the number of elements currently in the queue.
self | The queue. |