ESMF_InfoRemove Subroutine

public subroutine ESMF_InfoRemove(info, keyParent, keywordEnforcer, keyChild, attnestflag, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Info), intent(inout) :: info
character(len=*), intent(in) :: keyParent
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
character(len=*), intent(in), optional :: keyChild
type(ESMF_AttNest_Flag), intent(in), optional :: attnestflag
integer, intent(out), optional :: rc

Source Code

subroutine ESMF_InfoRemove(info, keyParent, keywordEnforcer, keyChild, attnestflag, rc)
! !ARGUMENTS:
  type(ESMF_Info), intent(inout) :: info
  character(len=*), intent(in) :: keyParent
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
  character(len=*), intent(in), optional :: keyChild
  type(ESMF_AttNest_Flag), intent(in), optional :: attnestflag
  integer, intent(out), optional :: rc
!
! !DESCRIPTION:
!     Remove a key-value pair from an \texttt{ESMF\_Info} object.
!
!     The arguments are:
!     \begin{description}
!     \item [info]
!       Target \texttt{ESMF\_Info} object.
!     \item [keyParent]
!       String key to identify the parent location for the removal. If no \textit{keyChild}
!       is specified, then the root location is assumed. See section \ref{info_key_format}
!       for an overview of the key format.
!     \item [{[keyChild]}]
!       String key to identify the value for the removal. This \textit{may not}
!       be a path.
!     \item [{[attnestflag]}]
!       Setting to \texttt{ESMF\_ATTNEST\_ON} triggers a recursive search for
!       \textit{keyParent}. The first instance of the key will be found in the
!       hierarchy. Default is \texttt{ESMF\_ATTNEST\_OFF}.
!     \item [{[rc]}]
!       Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!     \end{description}
!EOP

  integer :: localrc
  character(:), allocatable :: localkeyChild
  logical(C_BOOL) :: recursive

  localrc = ESMF_FAILURE
  if (present(rc)) rc = ESMF_FAILURE
  recursive = .false.

  if (present(keyChild)) then
    localkeyChild = keyChild
  else
    localkeyChild = ""
  end if
  if (present(attnestflag)) then
    if (attnestflag%value==ESMF_ATTNEST_ON%value) recursive = .true.
  end if

  call c_info_erase(info%ptr, trim(keyParent)//C_NULL_CHAR, &
                     trim(localkeyChild)//C_NULL_CHAR, recursive, localrc)
  if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return

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