Function (FC): Priority Queue - v1.0
This function implements a Priority Queue using an array to store the data.
The function supports enqueue, dequeue, and reading the first element of the queue,
with priority based on the buffer_priority parameter.
This Priority Queue is implemented using the Binary Heap algorithm, which is an efficient data
structure for maintaining the order of elements based on their priority.
The Binary Heap allows inserting elements and removing the highest priority element in logarithmic time,
making it suitable for applications where quick access to the highest priority elements is required.
Use Cases
Section titled “Use Cases”- Managing tasks or events with different priority levels.
- Implementing scheduling algorithms or resource management.
- Any situation where elements need to be processed in order of priority.
Dependencies
Section titled “Dependencies”| Type | Name | Version |
|---|---|---|
data type | priorityQueueInstanceAttributes | v1.0 |
data type | priorityQueueMetadata | v1.0 |
enumeration | EPriorityQueueMethod | v1.0 |
enumeration | EPriorityQueueStatus | v1.0 |
Parameters
Section titled “Parameters”| Parameter | Declaration | Type | Description |
|---|---|---|---|
method | Input | Int | Method to be executed. EPriorityQueueMethod |
instance | InOut | priorityQueueInstanceAttributes | Queue instance |
metadata | InOut | Array[*] of priorityQueueMetadata | Array of metadata of type priorityQueueMetadata |
data | InOut | Variant | Array of data of type <E> |
buffer_data | InOut | Variant | Data buffer of type <E> |
buffer_priority | InOut | DInt | Any value within its range: the largest number has the highest priority |
| - | Return | Int | Return of the status. EPriorityQueueStatus |