The priority_queue_t
derived-type has an array containing segment data
and the number of data. The array component is allocatable.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(segment_t), | public, | allocatable | :: | heap(:) | |||
integer(kind=int32), | public | :: | number | = | 0 |
The clear
subroutine deallocates the queue.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(priority_queue_t), | intent(inout) | :: | pq |
The dequeue
function takes out and returns the prior segment from the queue.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(priority_queue_t), | intent(inout) | :: | pq | |||
type(segment_t), | intent(inout) | :: | res |
The enqueue
subroutine is responsible for allocating heap structure and
holding the disjoined segment data with ascending priority order.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(priority_queue_t), | intent(inout) | :: | pq | |||
type(segment_t), | intent(in) | :: | seg |