ECOBMC ;BP/CMF - Methods object
;;2.0;EVENT CAPTURE;**100**;8 May 96;Build 21
;@author - Chris Flegel
;@date - 17 May 2009
;@version - 1.0
;;
Q
;;private methods
ADD(RESULT,HANDLE,VALUE) ; add Method object to list
N CREATE,CHILD,ITEM,X
D METHOD(.CREATE,HANDLE_".Get_namespace")
S CHILD=$$CREATE^ECOBM(CREATE)
D COLLECT^ECOBL(.ITEM,HANDLE,CHILD)
D METHOD^ECOBM(.RESULT,CHILD_".SetName."_VALUE)
D METHOD(.X,HANDLE_".Criteria.Index."_ITEM)
S RESULT=CHILD
Q
;;
INFO(RESULT,HANDLE,PARAMS) ; view method details
N METHOD,JUSTIFY,OFFSET
D PARSE("Offset",PARAMS)
D METHOD(.METHOD,HANDLE_".First")
F Q:METHOD="-1^End of list" D
.D METHOD^ECOBM(.RESULT,METHOD_".ShowName."_JUSTIFY)
.D METHOD^ECOBM(.RESULT,METHOD_".ShowDescription."_OFFSET)
.D METHOD^ECOBM(.RESULT,METHOD_".ShowParams."_OFFSET)
.D METHOD^ECOBM(.RESULT,METHOD_".ShowReturns."_OFFSET)
.D METHOD(.METHOD,HANDLE_".Next")
.Q
Q
OVERRIDE(RESULT,HANDLE,VALUE) ; override established method
N LIST,CHILD
S RESULT="-1^Method does not exist to override"
D METHOD(.LIST,HANDLE_".Find."_VALUE)
D METHOD(.CHILD,LIST_".First")
I CHILD'="-1^End of list" S RESULT=CHILD
D DESTROY^ECOBL(LIST)
Q
;;
PARSE(PARSE,VALUE) ;
D PARSE^ECOBL(PARSE,VALUE) ; parent method
Q
;;
PROPERTY(HANDLE,SCOPE,PROPERTY,VALUE) ; parent method
D PROPERTY^ECOBL(HANDLE,SCOPE,PROPERTY,VALUE)
Q
;;
;; public methods
CREATE(NAME) ;
; call parent first
N HANDLE,X
S HANDLE=$$CREATE^ECOBL(NAME)
;;
D SELF^ECOB(.RESULT,HANDLE,"Methods","Methods","METHOD^ECOBMC(.RESULT,ARGUMENT)","ECOBL")
;;
D METHOD(.X,HANDLE_".Criteria.SetArgument.GetName")
D METHOD(.X,HANDLE_".Criteria.SetOnReturn.handle")
Q HANDLE
;;
DESTROY(HANDLE) ;
; call parent last
N CHILD
D METHOD(.CHILD,HANDLE_".First")
F Q:+CHILD=-1 D
.D DESTROY^ECOBM(CHILD)
.D METHOD(.CHILD,HANDLE_".Next")
.Q
Q $$DESTROY^ECOBL(HANDLE)
;;
METHOD(RESULT,ARGUMENT) ;
; argument=(name.count[handle]).method.(additional.params...)
N HANDLE,METHOD,PARAMS
D PARSE("Handle",ARGUMENT)
D PARSE("Method",ARGUMENT)
D PARSE("Params",ARGUMENT)
I METHOD="Add" D ADD(.RESULT,HANDLE,PARAMS) Q
I METHOD="Override" D OVERRIDE(.RESULT,HANDLE,PARAMS) Q
I METHOD="Info" D INFO(.RESULT,HANDLE,PARAMS) Q
D METHOD^ECOBL(.RESULT,ARGUMENT)
Q
;;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HECOBMC 2345 printed Oct 16, 2024@17:58:49 Page 2
ECOBMC ;BP/CMF - Methods object
+1 ;;2.0;EVENT CAPTURE;**100**;8 May 96;Build 21
+2 ;@author - Chris Flegel
+3 ;@date - 17 May 2009
+4 ;@version - 1.0
+5 ;;
+6 QUIT
+7 ;;private methods
ADD(RESULT,HANDLE,VALUE) ; add Method object to list
+1 NEW CREATE,CHILD,ITEM,X
+2 DO METHOD(.CREATE,HANDLE_".Get_namespace")
+3 SET CHILD=$$CREATE^ECOBM(CREATE)
+4 DO COLLECT^ECOBL(.ITEM,HANDLE,CHILD)
+5 DO METHOD^ECOBM(.RESULT,CHILD_".SetName."_VALUE)
+6 DO METHOD(.X,HANDLE_".Criteria.Index."_ITEM)
+7 SET RESULT=CHILD
+8 QUIT
+9 ;;
INFO(RESULT,HANDLE,PARAMS) ; view method details
+1 NEW METHOD,JUSTIFY,OFFSET
+2 DO PARSE("Offset",PARAMS)
+3 DO METHOD(.METHOD,HANDLE_".First")
+4 FOR
if METHOD="-1^End of list"
QUIT
Begin DoDot:1
+5 DO METHOD^ECOBM(.RESULT,METHOD_".ShowName."_JUSTIFY)
+6 DO METHOD^ECOBM(.RESULT,METHOD_".ShowDescription."_OFFSET)
+7 DO METHOD^ECOBM(.RESULT,METHOD_".ShowParams."_OFFSET)
+8 DO METHOD^ECOBM(.RESULT,METHOD_".ShowReturns."_OFFSET)
+9 DO METHOD(.METHOD,HANDLE_".Next")
+10 QUIT
End DoDot:1
+11 QUIT
OVERRIDE(RESULT,HANDLE,VALUE) ; override established method
+1 NEW LIST,CHILD
+2 SET RESULT="-1^Method does not exist to override"
+3 DO METHOD(.LIST,HANDLE_".Find."_VALUE)
+4 DO METHOD(.CHILD,LIST_".First")
+5 IF CHILD'="-1^End of list"
SET RESULT=CHILD
+6 DO DESTROY^ECOBL(LIST)
+7 QUIT
+8 ;;
PARSE(PARSE,VALUE) ;
+1 ; parent method
DO PARSE^ECOBL(PARSE,VALUE)
+2 QUIT
+3 ;;
PROPERTY(HANDLE,SCOPE,PROPERTY,VALUE) ; parent method
+1 DO PROPERTY^ECOBL(HANDLE,SCOPE,PROPERTY,VALUE)
+2 QUIT
+3 ;;
+4 ;; public methods
CREATE(NAME) ;
+1 ; call parent first
+2 NEW HANDLE,X
+3 SET HANDLE=$$CREATE^ECOBL(NAME)
+4 ;;
+5 DO SELF^ECOB(.RESULT,HANDLE,"Methods","Methods","METHOD^ECOBMC(.RESULT,ARGUMENT)","ECOBL")
+6 ;;
+7 DO METHOD(.X,HANDLE_".Criteria.SetArgument.GetName")
+8 DO METHOD(.X,HANDLE_".Criteria.SetOnReturn.handle")
+9 QUIT HANDLE
+10 ;;
DESTROY(HANDLE) ;
+1 ; call parent last
+2 NEW CHILD
+3 DO METHOD(.CHILD,HANDLE_".First")
+4 FOR
if +CHILD=-1
QUIT
Begin DoDot:1
+5 DO DESTROY^ECOBM(CHILD)
+6 DO METHOD(.CHILD,HANDLE_".Next")
+7 QUIT
End DoDot:1
+8 QUIT $$DESTROY^ECOBL(HANDLE)
+9 ;;
METHOD(RESULT,ARGUMENT) ;
+1 ; argument=(name.count[handle]).method.(additional.params...)
+2 NEW HANDLE,METHOD,PARAMS
+3 DO PARSE("Handle",ARGUMENT)
+4 DO PARSE("Method",ARGUMENT)
+5 DO PARSE("Params",ARGUMENT)
+6 IF METHOD="Add"
DO ADD(.RESULT,HANDLE,PARAMS)
QUIT
+7 IF METHOD="Override"
DO OVERRIDE(.RESULT,HANDLE,PARAMS)
QUIT
+8 IF METHOD="Info"
DO INFO(.RESULT,HANDLE,PARAMS)
QUIT
+9 DO METHOD^ECOBL(.RESULT,ARGUMENT)
+10 QUIT
+11 ;;