The forgex_priority_queue_m
module defines priority_queue_t
.
This implementation was originally provided by ue1221.
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 |
procedure, public :: clear | |
procedure, public :: dequeue | |
procedure, public :: enqueue |
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 |