ESMF_InfoUpdate Subroutine

public subroutine ESMF_InfoUpdate(lhs, rhs, keywordEnforcer, recursive, overwrite, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Info), intent(inout) :: lhs
type(ESMF_Info), intent(in) :: rhs
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
logical, intent(in), optional :: recursive
logical, intent(in), optional :: overwrite
integer, intent(out), optional :: rc

Source Code

subroutine ESMF_InfoUpdate(lhs, rhs, keywordEnforcer, recursive, overwrite, rc)
! !ARGUMENTS:
  type(ESMF_Info), intent(inout) :: lhs
  type(ESMF_Info), intent(in) :: rhs
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
  logical, intent(in), optional :: recursive
  logical, intent(in), optional :: overwrite
  integer, intent(out), optional :: rc
!
! !DESCRIPTION:
!     Update the contents of \textit{lhs} using the contents of \textit{rhs}. The
!     operation inserts or overwrites any key in \textit{lhs} if it exists in \textit{rhs}.
!     Otherwise, the contents of \textit{lhs} is left unaltered. See the JSON
!     documentation for implementation details \cite{json_for_modern_cpp_update}.
!     If \textit{recursive} is \textit{.true.} (default is \texttt{.false.}),
!     nested objects will be updated by their component key/values. Otherwise,
!     the first instance or top-level key is replaced without the child contents
!     being updated element-by-element.
!
!     The arguments are:
!     \begin{description}
!     \item [lhs]
!       The \texttt{ESMF\_Info} object to update.
!     \item [rhs]
!       The \texttt{ESMF\_Info} object whose contents are used to update \textit{lhs}.
!     \item [{[recursive]}]
!       Default is \texttt{.false.}. If \texttt{.true.}, descend into nested objects
!       and recursively update the contents.
!     \item [{[overwrite]}]
!       Default is \texttt{.false.}. If \texttt{.true.}, key-values that exist
!       in \textit{lhs} will be overwritten by key-values in \textit{rhs}. Flag
!       is only applicable when \textit{recursive} is \texttt{.true.}.
!     \item [{[rc]}]
!       Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!     \end{description}
!EOP

  integer :: localrc
  integer :: recursive_int, overwrite_int

  localrc = ESMF_FAILURE
  if (present(rc)) rc = ESMF_FAILURE
  recursive_int = 0  ! .false.
  if (present(recursive)) then
    if (recursive) then
      recursive_int = 1  ! .true.
    end if
  end if
  overwrite_int = 0  ! .false.
  if (present(overwrite)) then
    if (overwrite) then
      overwrite_int = 1  ! .true.
    end if
  end if

  call c_info_update(lhs%ptr, rhs%ptr, recursive_int, overwrite_int, localrc)
  if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return

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