Adds a pair key-value to the list.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(sllist_obj), | intent(inout) | :: | this |
List object |
||
| integer, | intent(in) | :: | key |
Key in key-val pair to add to list |
||
| class(*), | intent(in) | :: | val |
Val in key-val pair to add to list |
pure recursive subroutine sllist_obj_Put(this,key,val) !> Adds a pair key-value to the list. implicit none class(sllist_obj), intent(inout) :: this !! List object integer, intent(in) :: key !! Key in key-val pair to add to list class(*), intent(in) :: val !! Val in key-val pair to add to list if (this%key .ge. 0) then if (this%key .ne. key) then if ( .not. associated(this%child) ) allocate(this%child) call sllist_obj_Put(this%child,key,val) end if else this%key = key select type(val) type is (real(leapDP)) allocate(this%val, source=val) type is (real(leapSP)) allocate(this%val, source=val) type is (integer(leapI4)) allocate(this%val, source=val) type is (integer(leapI8)) allocate(this%val, source=val) class default error stop 'LEAP: error in linked-list usage -- unsupported type.' end select end if return end subroutine sllist_obj_Put