ESMF_NamedAliasCplComp Function

private function ESMF_NamedAliasCplComp(object, keywordEnforcer, name, rc)

Arguments

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

Return Value type(ESMF_CplComp)


Source Code

  function ESMF_NamedAliasCplComp(object, keywordEnforcer, name, rc)
!
! !RETURN VALUE:
    type(ESMF_CplComp) :: ESMF_NamedAliasCplComp
!
! !ARGUMENTS:
    type(ESMF_CplComp),intent(in)             :: object
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
    character(len = *), intent(in),  optional :: name
    integer,            intent(out), optional :: rc
!EOPI
!------------------------------------------------------------------------------
    integer                 :: localrc
    character(ESMF_MAXSTR)  :: nameDefault

    if (present(rc)) rc = ESMF_SUCCESS

    ! first create regular alias
    ESMF_NamedAliasCplComp = object

    ! next mark as namedAlias
    ESMF_NamedAliasCplComp%isNamedAlias = .true.

    ! finally set name
    if (present(name)) then
      ESMF_NamedAliasCplComp%name = trim(name)
    else
      call ESMF_CplCompGet(object, name=nameDefault, rc=localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
      ESMF_NamedAliasCplComp%name = trim(nameDefault)
    endif

  end function ESMF_NamedAliasCplComp