Queue
Info
Dependencies:
- PermMem
Implementation:
Queue.d on GitHub
This package is an implementation of the Queue data structure and a queue for function calls.
Initialization
N/A
Queue
Q_Create
Q_Create
Creates a new queue and returns a handle to it.
The function returns a handle to a queue.
Q_Enqueue
Q_Enqueue
Appends an integer to the back of the queue
var int queue
Handle of a queuevar int value
The value to be appended to the queue
Q_IsEmpty
Q_IsEmpty
Checks if the queue is empty.
var int queue
Handle of a queue
Return value
The function returns TRUE
if the queue is empty, FALSE
is returned otherwise.
Q_Advance
Q_Advance
Removes the oldest value from the queue and returns it.
var int queue
Handle of a queue
Return value
The function returns the oldest value in the queue.
Q_Peek
Q_Peek
Returns the oldest value in the queue without removing it.
var int queue
Handle of a queue
Return value
The function returns the oldest value in the queue.
Q_For
Q_For
Function with the funcID
is called with every element of the list as parameter.
The list element is passed to the function as a zCList
pointer.
var int queue
Handle of a queuevar int funcID
ID of function that is executed for all values in the queue (signature:void (zCList*)
)
Q_ForF
Q_ForF
Like Q_For
, but with function as a parameter instead of a function ID.
var int queue
Handle of a queuevar func f
This function is executed for all values in the queue (signature:void (zCList*)
)
CallbackQueue
CQ_Create
CQ_Create
Creates a new callback queue and returns a handle to it.
The function returns a handle to a callback queue.
CQ_EnqueueNoData
CQ_EnqueueNoData
Appends a function to the callback queue.
var int queue
Handle of a callback queuevar func function
A function with no return value, expecting no parameter
CQ_EnqueueData
CQ_EnqueueData
Appends a function together with a value to the callback queue.
var int queue
Handle of a callback queuevar func function
A function with no return value, expecting an integer as a parameter.var int data
When callingfunction
, this value is passed as a parameter
CQ_Enqueue
CQ_Enqueue
Appends a function together with an optional value to the callback queue. This function should not usually be used. Use CQ_EnqueueData
and CQ_EnqueueNoData
instead.
var int queue
Handle of a callback queuevar int funcID
The function ID of a function to be appended to the callback queue.var int data
If hasData is not 0, this value is passed to the associated function.var int hasData
Must be 0 if the function does not expect an integer as a parameter, otherwise not 0.
CQ_IsEmpty
CQ_IsEmpty
Checks if no function is in the callback queue.
var int queue
Handle of a callback queue
Return value
The function returns TRUE
if the callback queue is empty, FALSE
is returned otherwise.
CQ_Advance
CQ_Advance
Executes the foremost function of the callback queue and removes it from the callback queue.
var int queue
Handle of a callback queue
CQ_Exhaust
CQ_Exhaust
Executes all functions contained in the callback queue.
var int queue
Handle of a callback queue