subroutine ESMF_DELayoutSerialize(delayout, buffer, length, offset, &
inquireflag, rc)
!
! !ARGUMENTS:
type(ESMF_DELayout), intent(in) :: delayout
character, pointer :: buffer(:)
integer, intent(inout) :: length
integer, intent(inout) :: offset
type(ESMF_InquireFlag), intent(in), optional :: inquireflag
integer, intent(out), optional :: rc
!
! !DESCRIPTION:
! Takes an {\tt ESMF\_DELayout} object and adds all the information needed
! to save the information to a file or recreate the object based on this
! information. Expected to be used by {\tt ESMF\_StateReconcile()} and
! by {\tt ESMF\_DELayoutWrite()} and {\tt ESMF\_DELayoutRead()}.
!
! The arguments are:
! \begin{description}
! \item [delayout]
! {\tt ESMF\_DELayout} object to be serialized.
! \item [buffer]
! Data buffer which will hold the serialized information.
! \item [length]
! Current length of buffer, in bytes. If the serialization
! process needs more space it will allocate it and update
! this length.
! \item [offset]
! Current write offset in the current buffer. This will be
! updated by this routine and return pointing to the next
! available byte in the buffer.
! \item [inquireflag]
! Flag to tell if serialization is to be done (ESMF_NOINQUIRE)
! or if this is simply a size inquiry (ESMF_INQUIREONLY)
! \item [{[rc]}]
! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
!
!EOPI
!------------------------------------------------------------------------------
integer :: localrc ! local return code
type(ESMF_InquireFlag) :: linquireflag ! local inquiry flag
! initialize return code; assume routine not implemented
localrc = ESMF_RC_NOT_IMPL
if (present(rc)) rc = ESMF_RC_NOT_IMPL
! Check init status of arguments
ESMF_INIT_CHECK_DEEP(ESMF_DELayoutGetInit, delayout, rc)
if (present (inquireflag)) then
linquireflag = inquireflag
else
linquireflag = ESMF_NOINQUIRE
end if
! Call into the C++ interface.
call c_ESMC_DELayoutSerialize(delayout, buffer, length, offset, &
linquireflag, localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! return successfully
if (present(rc)) rc = ESMF_SUCCESS
end subroutine ESMF_DELayoutSerialize