Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ECOBUF

ECOBUF.m

Go to the documentation of this file.
  1. ECOBUF ;BP/CMF - Factory Object
  1. ;;2.0;EVENT CAPTURE;**100,107**;8 May 96;Build 14
  1. ;@author - Chris Flegel
  1. ;@date - 17 May 2009
  1. ;@version - 1.0
  1. ;;
  1. Q
  1. ;; private methods
  1. ;;
  1. FACTORY0() Q "^TMP($J,""ECOBUF"")"
  1. ;;
  1. FACTORY1() Q "^TMP($J,""ECOBUF"",1)"
  1. ;;
  1. FACTORY2() ;
  1. S ^XTMP("ECOBUF",0)=$G(DT)+1_"^"_$G(DT)
  1. Q "^XTMP(""ECOBUF"","_$S($G(DUZ)'="":DUZ,$G(DT)'="":DT,1:1)_")"
  1. ;;
  1. VALUE(VALUE) ;; parse "." out of Parameter values
  1. Q $S(VALUE="":"",1:$P(VALUE,".")_U_$P(VALUE,".",2,3))
  1. ;;
  1. ;; published methods
  1. FACTORY(RESULT,ARGUMENT) ; wrapper for factory methods - RPC "EC OBU FACTORY"
  1. N FACTORY,HANDLE,CREATE,DESTROY,CLASS,NAME,TARGET
  1. N ARG1,ARG2,ARG3
  1. S RESULT="-1^Invalid Factory Parameters",RESULT(0)=RESULT
  1. S ARGUMENT=$G(ARGUMENT)
  1. Q:ARGUMENT=""
  1. S ARG1=$P(ARGUMENT,".",1)
  1. S ARG2=$P(ARGUMENT,".",2)
  1. S ARG3=$P(ARGUMENT,".",3)
  1. S ARG3=$S(ARG3'="":ARG3,ARG1="Constructor"&(ARG3=""):$$FACTORY2(),1:"")
  1. Q:ARG1="Constructor"&(ARG3="")
  1. I ARG1="Constructor" D Q
  1. .S CLASS=ARG2
  1. .S NAME=ARG3
  1. .S CREATE=$$GET^XPAR("PKG","ECOB CONSTRUCTOR",CLASS,"E")
  1. .I CREATE="" S RESULT(0)="-1^Invalid Class Name" S RESULT=RESULT(0) Q
  1. .S CREATE="S RESULT=$$"_$$VALUE(CREATE)
  1. .X CREATE
  1. .S RESULT(0)=RESULT
  1. .Q
  1. I ARG1="Destructor" D Q
  1. .S TARGET=ARG2
  1. .I ARG3'="" S CLASS=ARG3
  1. .E D METHOD(.CLASS,TARGET_".of.Get_class")
  1. .S DESTROY=$$GET^XPAR("PKG","ECOB DESTRUCTOR",CLASS,"E")
  1. .I DESTROY="" S RESULT(0)="-1^Invalid Class Name" S RESULT=RESULT(0) Q
  1. .S DESTROY="S RESULT=$$"_$$VALUE(DESTROY)
  1. .S HANDLE=TARGET
  1. .X DESTROY
  1. .S RESULT(0)=RESULT
  1. .Q
  1. I ARG1="Method" D Q
  1. .D METHOD(.RESULT,$P(ARGUMENT,".",2,99))
  1. .S RESULT(0)=RESULT
  1. .Q
  1. Q
  1. ;;
  1. METHOD(RESULT,ARGUMENT) ;
  1. ; call parent last
  1. D METHOD^ECOBU(.RESULT,ARGUMENT) ; parent method
  1. S RESULT(0)=RESULT
  1. Q
  1. METHODS(RESULT,ARGUMENT) ;
  1. ; call parent last
  1. D METHOD^ECOBU(.RESULT,ARGUMENT) ; parent method
  1. Q
  1. OUT(ARGUMENT) ;method call as function
  1. N RESULT
  1. D METHOD(.RESULT,ARGUMENT)
  1. Q RESULT