ESMF_IORead Subroutine

public subroutine ESMF_IORead(io, fileName, schemaFileName, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_IO), intent(in) :: io
character(len=*), intent(in), optional :: fileName
character(len=*), intent(in), optional :: schemaFileName
integer, intent(out), optional :: rc

Source Code

      subroutine ESMF_IORead(io, fileName, schemaFileName, rc)
!
! TODO derived types, other than <object>, need to be inout?
! !ARGUMENTS:
      type(ESMF_IO),           intent(in)            :: io
      character (len=*),       intent(in),  optional :: fileName
      character (len=*),       intent(in),  optional :: schemaFileName
      integer,                 intent(out), optional :: rc
!   
! !DESCRIPTION:
!     Perform a read on an {\tt ESMF\_IO} object.  Any properties specified
!     will override, but not reset, those previously set on the io object.
!
!     The arguments are:
!     \begin{description}
!     \item[io]
!          The object instance to read.
!     \item[{[fileName]}]
!          The file name to be read from.
!     \item[{[schemaFileName]}]
!          The file name of the schema used to validate fileName.
!     \item[{[rc]}]
!          Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!     \end{description}
!EOPI
! !REQUIREMENTS:
!     IOx.y, IOx.y.z  TODO
!
!     ! initialize fileName length to zero for non-existent name
      integer :: fileNameLen, schemaFileNameLen, localrc
!
!     ! Assume failure until success
      if (present(rc)) rc = ESMF_RC_NOT_IMPL
      localrc = ESMF_RC_NOT_IMPL
!
!     ! check variables  TODO
!     ESMF_INIT_CHECK_DEEP(ESMF_IOGetInit,io,rc)

      fileNameLen = 0
      schemaFileNameLen = 0
!
!     ! get length of given fileName for C++ validation
      if (present(fileName)) then
        fileNameLen = len_trim(fileName)
      end if
      if (present(schemaFileName)) then
        schemaFileNameLen = len_trim(schemaFileName)
      end if

!     invoke C to C++ entry point  TODO
      call c_ESMC_IO_XMLRead(io, fileNameLen, fileName, &
                             schemaFileNameLen, schemaFileName, localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
!
!     ! Return success
      if (present(rc)) rc = ESMF_SUCCESS
      end subroutine ESMF_IORead