aot_path_addNode Subroutine

public subroutine aot_path_addNode(me, NodeType, pos, key)

With this subroutine a node is appended to the end of the list of nodes of the given path.

You need to provide a NodeType (table or function), and either its position or key to identify it in the parent object.

Arguments

Type IntentOptional Attributes Name
type(aot_path_type), intent(inout) :: me

Path to append the node to

character(len=*), intent(in) :: NodeType

Type of the node (table of function)

integer, intent(in), optional :: pos

Position in the parenting table

character(len=*), intent(in), optional :: key

Key within the parenting table


Source Code

  subroutine aot_path_addNode(me, NodeType, pos, key)
    !> Path to append the node to
    type(aot_path_type), intent(inout) :: me
    !> Type of the node (table of function)
    character(len=*), intent(in) :: NodeType
    !> Position in the parenting table
    integer, intent(in), optional :: pos
    !> Key within the parenting table
    character(len=*), intent(in), optional :: key

    if (.not.associated(me%GlobalNode)) then
      ! New list without any nodes so far
      allocate(me%GlobalNode)
      me%head => me%GlobalNode
    else
      ! Existing list, append at the end
      allocate(me%head%child)
      me%head => me%head%child
    end if

    if (present(pos)) then
      me%head%ID_kind = 'position'
      me%head%pos = pos
    end if

    ! Specified keys overwrite positions
    if (present(key)) then
      me%head%ID_kind = 'key'
      me%head%key = key
    end if

    me%head%NodeType = NodeType

  end subroutine aot_path_addNode