CObject
CIQueue Struct Reference

Queue data structure interface. More...

#include <CIQueue.h>

+ Inheritance diagram for CIQueue:

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
 

Detailed Description

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.

Member Function Documentation

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.

Parameters
selfThe queue.
Returns
Number of elements currently in 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.

Parameters
selfThe queue.
CIQueueError CIQueue_Insert ( struct CIQueue self,
const void *  element 
)

Insert an element into the tail of the queue by copy.

Parameters
selfThe queue.
elementPointer to data to copy into queue.
Returns
Error code.
size_t CIQueue_MaxSize ( struct CIQueue self)

Get the maximum number of elements allowed in the queue.

Parameters
selfThe queue.
Returns
The maximum number of elements allowed in 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.

Parameters
selfThe queue.
elementData in the head of the queue will be copied to the location pointed to by this.
Returns
An error code.
CIQueueError CIQueue_Remove ( struct CIQueue self,
void *  element 
)

Remove an element from the head of the queue by copy.

Parameters
selfThe queue
elementData 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.
Returns
An error code.
size_t CIQueue_Size ( struct CIQueue self)

Get the number of elements currently in the queue.

Parameters
selfThe queue.
Returns
Number of elements currently in the queue.

The documentation for this struct was generated from the following files: