ESMF_IO_YAMLWrite Subroutine

public subroutine ESMF_IO_YAMLWrite(yaml, keywordEnforcer, fileName, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_IO_YAML) :: yaml
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
character(len=*), intent(in), optional :: fileName
integer, intent(out), optional :: rc

Source Code

  subroutine ESMF_IO_YAMLWrite(yaml, keywordEnforcer, fileName, rc)
!
! !ARGUMENTS:
    type(ESMF_IO_YAML)                             :: yaml
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
    character(len=*),        intent(in),  optional :: fileName
    integer,                 intent(out), optional :: rc

! !DESCRIPTION:
!     Writes the YAML content of a {\tt ESMF\_YAML\_IO} object to file.
!
!     The arguments are:
!     \begin{description}
!     \item[{yaml}]
!          Write YAML content of this {\tt ESMF\_IO_YAML} object.
!     \item[{fileName}]
!          The file name to be written to.
!     \item[{[rc]}]
!          Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!     \end{description}
!     
!EOPI

    ! local return code
    integer :: localrc
!
!   ! Assume failure until success
    if (present(rc)) rc = ESMF_RC_NOT_IMPL

    if (present(fileName)) then
!     invoke C to C++ entry point
      call c_ESMC_IO_YAMLWrite(yaml, fileName, localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
    else
!     invoke C to C++ entry point
      call c_ESMC_IO_YAMLPrint(yaml, localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
    end if
!

    ! Return success
    if (present(rc)) rc = localrc

  end subroutine ESMF_IO_YAMLWrite