ESMF_HConfigCreateStringSeq Function

private function ESMF_HConfigCreateStringSeq(content, keywordEnforcer, rc)

Arguments

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

Return Value type(ESMF_HConfig)


Source Code

  function ESMF_HConfigCreateStringSeq(content, keywordEnforcer, rc)
!
! !RETURN VALUE:
    type(ESMF_HConfig) :: ESMF_HConfigCreateStringSeq
!
! !ARGUMENTS:
    character(len=*),   intent(in)            :: content(:)
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
    integer,            intent(out), optional :: rc
!
! !DESCRIPTION:
!   Create a new HConfig object.
!
!   The arguments are:
!   \begin{description}
!   \item[content]
!     String content.
!   \item[{[rc]}]
!     Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!   \end{description}
!
!EOP
!------------------------------------------------------------------------------
    integer                       :: localrc        ! local return code
    integer                       :: count, i

    ! initialize return code; assume routine not implemented
    localrc = ESMF_RC_NOT_IMPL
    if (present(rc)) rc = ESMF_RC_NOT_IMPL

    ! start with empty hconfig
    ESMF_HConfigCreateStringSeq = ESMF_HConfigCreate(rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    count = size(content)
    do i=1, count
      ! add this element of the sequence
      call ESMF_HConfigAdd(ESMF_HConfigCreateStringSeq, content(i), rc=localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
    enddo

    ! return successfully
    if (present(rc)) rc = ESMF_SUCCESS

  end function ESMF_HConfigCreateStringSeq