ESMF_InfoDestroy Subroutine

public subroutine ESMF_InfoDestroy(info, keywordEnforcer, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Info), intent(inout) :: info
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
integer, intent(out), optional :: rc

Source Code

subroutine ESMF_InfoDestroy(info, keywordEnforcer, rc)
! !ARGUMENTS:
  type(ESMF_Info), intent(inout) :: info
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
  integer, intent(out), optional :: rc
!
! !DESCRIPTION:
!     Destroy an \texttt{ESMF\_Info} object. Destroying an \texttt{ESMF\_Info}
!     object created internally by an ESMF object results in an error
!
!     The arguments are:
!     \begin{description}
!     \item [info]
!       Target \texttt{ESMF\_Info} object.
!     \item [{[rc]}]
!       Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!     \end{description}
!EOP

  integer :: localrc

  localrc = ESMF_FAILURE
  if (present(rc)) rc = ESMF_FAILURE

  if (info%is_view) then
    if (ESMF_LogFoundError(localrc, msg="Object is a view and may not be destroyed. Destroy its host object.", &
      ESMF_CONTEXT, rcToReturn=rc)) return
  endif

  call c_info_destroy(info%ptr, localrc)
  info%ptr = C_NULL_PTR
  if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return

  if (present(rc)) rc = ESMF_SUCCESS
end subroutine ESMF_InfoDestroy