Traverse the list until key is found. Returns the associated value to the key, or -1 if key not found.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(sllist_obj), | intent(in) | :: | this |
List object |
||
| integer, | intent(in) | :: | key |
Key in list |
||
| real(kind=leapSP), | intent(out) | :: | val |
Value associated with key to return |
pure recursive subroutine sllist_obj_Get_real_sp(this,key,val) !> Traverse the list until key is found. Returns ! the associated value to the key, or -1 ! if key not found. implicit none class(sllist_obj), intent(in) :: this !! List object integer, intent(in) :: key !! Key in list real(leapSP), intent(out) :: val !! Value associated with key to return if (this%key == key) then select type(my_val=>this%val) type is (real(leapSP)) val = my_val end select else if(associated(this%child)) then ! keep going call sllist_obj_Get_real_sp(this%child,key,val) else ! at the end of the list, no key found ! exit indication val = -1.0_leapSP return end if return end subroutine sllist_obj_Get_real_sp