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

RORTMP.m

Go to the documentation of this file.
  1. RORTMP ;HCIOFO/SG - TEMPORARY GLOBAL STORAGE ; 10/14/05 1:41pm
  1. ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
  1. ;
  1. ; DO NOT use this API to pass the data between tasks!
  1. ;
  1. Q
  1. ;
  1. ;***** ALLOCATES A TEMPORARY GLOBAL BUFFER
  1. ;
  1. ; [.SUBS] Subscript of the buffer is returned here
  1. ;
  1. ; Return Values:
  1. ; Closed root of the buffer
  1. ;
  1. ALLOC(SUBS) ;
  1. N NDX,NODE
  1. S NDX=$O(^TMP($J,"RORTMP-0",""),-1)+1
  1. S SUBS="RORTMP-"_NDX,NODE=$NA(^TMP($J,SUBS)) K @NODE
  1. S ^TMP($J,"RORTMP-0",NDX)=""
  1. Q NODE
  1. ;
  1. ;***** FREES THE TEMPORARY GLOBAL BUFFER
  1. ;
  1. ; NODE Closed root of the temporary global buffer
  1. ;
  1. FREE(NODE) ;
  1. N NDX S NDX=$$NDX(NODE)
  1. K:NDX>0 ^TMP($J,"RORTMP-0",NDX),@NODE
  1. Q
  1. ;
  1. ;***** EXTRACTS THE INDEX FROM THE CLOSED ROOT OF THE BUFFER
  1. ;
  1. ; NODE Closed root of the temporary global buffer
  1. ;
  1. ; Return Values:
  1. ; 0 Invalid closed root
  1. ; >0 Index of the buffer
  1. ;
  1. NDX(NODE) ;
  1. N SUBS
  1. Q:$E(NODE,1)'="^" 0
  1. Q:$NA(@NODE,1)'=$NA(^TMP($J)) 0
  1. S SUBS=$QS(NODE,2)
  1. Q:$P(SUBS,"-")'="RORTMP" 0
  1. S NDX=+$P(SUBS,"-",2)
  1. Q $S(NDX>0:NDX,1:0)
  1. ;
  1. ;***** FREES THE LAST ALLOCATED BUFFER(S)
  1. ;
  1. ; [NODE] Closed root of the temporary global buffer.
  1. ;
  1. ; If this parameter is defined and references a
  1. ; valid temporary buffer, then this buffer and
  1. ; all others allocated after it are freed.
  1. ;
  1. ; Otherwise, only the last buffer is freed.
  1. ;
  1. POP(NODE) ;
  1. N NDX S NDX=$$NDX($G(NODE))
  1. S:NDX'>0 NDX=+$O(^TMP($J,"RORTMP-0",""),-1)
  1. F Q:NDX'>0 D S NDX=$O(^TMP($J,"RORTMP-0",NDX))
  1. . D FREE($NA(^TMP($J,"RORTMP-"_NDX)))
  1. Q
  1. ;
  1. ;***** DELETES ALL TEMPORARY BUFFERS
  1. PURGE ;
  1. N I S I="RORTMP-"
  1. F S I=$O(^TMP($J,I)) Q:$E(I,1,7)'="RORTMP-" K ^TMP($J,I)
  1. Q