]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Get access of variable in the context dict of PyScriptNode instance.
authorAnthony Geay <anthony.geay@edf.fr>
Tue, 30 Jul 2019 08:31:08 +0000 (10:31 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Tue, 30 Jul 2019 08:31:08 +0000 (10:31 +0200)
idl/SALOME_PyNode.idl
src/Container/SALOME_PyNode.py

index 8a5d3756274bd1f8a6dcafe1b472b3fa978ec1a9..e3dfd3c847f159092f36fbf8fad3e070f20a0542 100644 (file)
@@ -82,6 +82,8 @@ module Engines
     */
     pickledArgs execute(in listofstring outargsname, in pickledArgs inargs) raises (SALOME::SALOME_Exception);
 
+    
+    pickledArgs getValueOfVarInContext(in string varName) raises (SALOME::SALOME_Exception);
   } ;
 
 };
index dc6cb552adcb8bc5678d50081fec2e29e824fb2b..be34f21fc1076cc927c1e4594eda20082ea4cdbe 100644 (file)
@@ -37,9 +37,11 @@ class Generic(SALOME__POA.GenericObj):
     self.cnt=1
 
   def Register(self):
+    print("Register called : %d"%self.cnt)
     self.cnt+=1
 
   def UnRegister(self):
+    print("UnRegister called : %d"%self.cnt)
     self.cnt-=1
     if self.cnt <= 0:
       oid=self.poa.servant_to_id(self)
@@ -49,6 +51,9 @@ class Generic(SALOME__POA.GenericObj):
     print("WARNING SALOME::GenericObj::Destroy() function is obsolete! Use UnRegister() instead.")
     self.UnRegister()
 
+  def __del__(self):
+    print("Destuctor called")
+
 class PyNode_i (Engines__POA.PyNode,Generic):
   """The implementation of the PyNode CORBA IDL"""
   def __init__(self, nodeName,code,poa,my_container):
@@ -137,3 +142,11 @@ class PyScriptNode_i (Engines__POA.PyScriptNode,Generic):
       exc_typ,exc_val,exc_fr=sys.exc_info()
       l=traceback.format_exception(exc_typ,exc_val,exc_fr)
       raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"".join(l),"PyScriptNode: %s, outargsname: %s" % (self.nodeName,outargsname),0))
+
+  def getValueOfVarInContext(self,varName):
+    try:
+      return pickle.dumps(self.context[varName],-1)
+    except:
+      exc_typ,exc_val,exc_fr=sys.exc_info()
+      l=traceback.format_exception(exc_typ,exc_val,exc_fr)
+      raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"".join(l),"PyScriptNode: %s" %self.nodeName,0))