set_contents Subroutine

private subroutine set_contents(this, contents)

Arguments

Type IntentOptional AttributesName
class(node), intent(inout) :: this
class(container), intent(inout), allocatable:: contents

The new value to be stored in this node. The actual argument will be deallocated during the process of assigning it to the node.

Description

Places a new value into storage within the node. This value must already be heald within an allocatable container. The actual argument will be deallocated after the subroutine call, as its allocation is moved to the contents of the node.


Source Code

  subroutine set_contents(this, contents)
    !* Author: Chris MacMackin
    !  Date: February 2016
    ! 
    ! Places a new value into storage within the node. This value must
    ! already be heald within an allocatable [[container]]. The actual
    ! argument will be deallocated after the subroutine call, as its
    ! allocation is moved to the contents of the node.
    !
    class(node), intent(inout) :: this
    class(container), intent(inout), allocatable :: contents
      !* The new value to be stored in this node. The actual argument
      ! will be deallocated during the process of assigning it to the
      ! node.
    call this%unset_contents()
    call move_alloc(contents, this%contents)
  end subroutine set_contents