forgex_priority_queue_m Module

The forgex_priority_queue_m module defines priority_queue_t. This implementation was originally provided by ue1221.



Derived Types

type, public ::  priority_queue_t

The priority_queue_t derived-type has an array containing segment data and the number of data. The array component is allocatable.

Components

Type Visibility Attributes Name Initial
type(segment_t), public, allocatable :: heap(:)
integer(kind=int32), public :: number = 0

Type-Bound Procedures

procedure, public :: clear
procedure, public :: dequeue
procedure, public :: enqueue

Subroutines

private pure subroutine clear(pq)

The clear subroutine deallocates the queue.

Arguments

Type IntentOptional Attributes Name
class(priority_queue_t), intent(inout) :: pq

private pure subroutine dequeue(pq, res)

The dequeue function takes out and returns the prior segment from the queue.

Arguments

Type IntentOptional Attributes Name
class(priority_queue_t), intent(inout) :: pq
type(segment_t), intent(inout) :: res

private pure subroutine enqueue(pq, seg)

The enqueue subroutine is responsible for allocating heap structure and holding the disjoined segment data with ascending priority order.

Read more…

Arguments

Type IntentOptional Attributes Name
class(priority_queue_t), intent(inout) :: pq
type(segment_t), intent(in) :: seg