The delNode removes the last node from the list of nodes of the given path.
With the optional isEmpty argument, it can be tested, if the list is completely empty after this operation.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(aot_path_type), | intent(inout) | :: | me |
Path to delet the last node from |
||
logical, | intent(out), | optional | :: | isEmpty |
Flag, if resulting path is empty (contains no nodes anymore) |
subroutine aot_path_delNode(me, isEmpty) !> Path to delet the last node from type(aot_path_type), intent(inout) :: me !> Flag, if resulting path is empty (contains no nodes anymore) logical, intent(out), optional :: isEmpty type(aot_path_node_type), pointer :: curNode => NULL() logical :: emptyList emptyList = .true. if (associated(me%GlobalNode)) then curNode => me%GlobalNode do if (associated(curNode%child)) then if (associated(curNode%child, me%head)) then ! Found second Last Node (its child is the head) nullify(curNode%child) deallocate(me%head) me%head => curNode ! The list is not empty, there is at least one ! node remaining. emptyList = .false. ! Leave the loop exit end if else ! There is just the global node, no childs yet nullify(me%globalNode) deallocate(me%head) ! Leave the loop exit end if curNode => curNode%child end do end if if (present(isEmpty)) then isEmpty = emptyList end if end subroutine aot_path_delNode