get_callbacks Subroutine

public subroutine get_callbacks(state, callbacks, rc)

Uses

  • proc~~get_callbacks~~UsesGraph proc~get_callbacks get_callbacks module~mapl_callbackmap mapl_CallbackMap proc~get_callbacks->module~mapl_callbackmap module~mapl_esmf_interfaces mapl_ESMF_Interfaces proc~get_callbacks->module~mapl_esmf_interfaces module~mapl_callbackmap->module~mapl_esmf_interfaces

Arguments

Type IntentOptional Attributes Name
type(ESMF_State), intent(inout) :: state
type(CallbackMap), intent(out), pointer :: callbacks
integer, intent(out), optional :: rc

Calls

proc~~get_callbacks~~CallsGraph proc~get_callbacks get_callbacks ESMF_AttributeGet ESMF_AttributeGet proc~get_callbacks->ESMF_AttributeGet ESMF_AttributeSet ESMF_AttributeSet proc~get_callbacks->ESMF_AttributeSet proc~mapl_return MAPL_Return proc~get_callbacks->proc~mapl_return proc~mapl_verify MAPL_Verify proc~get_callbacks->proc~mapl_verify at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_verify->proc~mapl_throw_exception

Called by

proc~~get_callbacks~~CalledByGraph proc~get_callbacks get_callbacks proc~mapl_methodadd MAPL_MethodAdd proc~mapl_methodadd->proc~get_callbacks

Source Code

    subroutine get_callbacks(state, callbacks, rc)
       use mapl_ESMF_Interfaces
       use mapl_CallbackMap
       type(ESMF_State), intent(inout) :: state
       type(CallbackMap), pointer, intent(out) :: callbacks
       integer, optional, intent(out) :: rc

       integer :: status
       integer(kind=ESMF_KIND_I4), allocatable :: valueList(:)
       logical :: isPresent

       type CallbackMapWrapper
          type(CallbackMap), pointer :: map
       end type
       type(CallbackMapWrapper) :: wrapper

       call ESMF_AttributeGet(state, name='MAPL_CALLBACK_MAP', isPresent=isPresent, _RC)
       if (.not. isPresent) then ! create callback map for this state
          allocate(callbacks)
          wrapper%map => callbacks
          valueList = transfer(wrapper, valueList)
          call ESMF_AttributeSet(state, name='MAPL_CALLBACK_MAP', valueList=valueList, _RC)
       end if

       ! Ugly hack to decode ESMF attribute as a gFTL map
       valueList = transfer(wrapper, valueList)
       call ESMF_AttributeGet(state, name='MAPL_CALLBACK_MAP', valueList=valueList, _RC)
       wrapper = transfer(valueList, wrapper)
       callbacks => wrapper%map

       _RETURN(ESMF_SUCCESS)

    end subroutine get_callbacks