ESMF_StateItemConstruct Function

public function ESMF_StateItemConstruct(name, itemtype, keywordEnforcer, proxyflag, rc) result(sip)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: name
type(ESMF_StateItem_Flag), intent(in) :: itemtype
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
logical, intent(in), optional :: proxyflag
integer, intent(out), optional :: rc

Return Value type(ESMF_StateItem), pointer


Source Code

  function ESMF_StateItemConstruct (name, itemtype, keywordEnforcer, &
      proxyflag, rc) result (sip)
!
! !RETURN VALUE:
    type(ESMF_StateItem),     pointer    :: sip
!
! !ARGUMENTS:
    character(*),             intent(in) :: name
    type(ESMF_StateItem_Flag), intent(in) :: itemtype
    type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
    logical,                  intent(in),  optional :: proxyflag
    integer,                  intent(out), optional :: rc
!         
! !DESCRIPTION:
!   Pointer-valued function to create a StateItem.
!   \item[name]
!     Item name
!   \item[itemtype]
!     State item type code
!   \item[{[proxyflag]}]
!     Set proxy flag
!   \item[{[rc]}]
!     Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!   \end{description}
!
!EOPI
!------------------------------------------------------------------------------

    ! local vars
    integer :: memstat

    ! Initialize return code; assume failure until success is certain
    if (present(rc)) rc = ESMF_RC_NOT_IMPL

    allocate (sip, stat=memstat)
    if (ESMF_LogFoundAllocError(memstat, msg="creating StateItem", &
             ESMF_CONTEXT, rcToReturn=rc)) return

! print *, ESMF_METHOD, ': creating sip with name = ', trim (name)
    sip%namep = name
    sip%otype = itemtype
    sip%datap%spp => null ()

    if (present (proxyflag)) then
      sip%proxyFlag = proxyflag
    else
      sip%proxyFlag = .false.
    end if

    ESMF_INIT_SET_CREATED(sip)

    if (present(rc)) rc = ESMF_SUCCESS

  end function ESMF_StateItemConstruct