Back to index

salome-kernel  6.5.0
Public Member Functions | Public Attributes
SALOME_PyNode.PyScriptNode_i Class Reference
Inheritance diagram for SALOME_PyNode.PyScriptNode_i:
Inheritance graph
Collaboration diagram for SALOME_PyNode.PyScriptNode_i:
Collaboration graph

List of all members.

Public Member Functions

def __init__
def execute
def Register
def UnRegister
def Destroy

Public Attributes


Detailed Description

The implementation of the PyScriptNode CORBA IDL that executes a script

Definition at line 80 of file

Constructor & Destructor Documentation

def SALOME_PyNode.PyScriptNode_i.__init__ (   self,
Initialize the node : compilation in the local context

Definition at line 82 of file

00083   def __init__(self, nodeName,code,poa,my_container):
00084     """Initialize the node : compilation in the local context"""
00085     Generic.__init__(self,poa)
00086     self.nodeName=nodeName
00087     self.code=code
00088     self.my_container=my_container._container
00089     linecache.cache[nodeName]=0,None,string.split(code,'\n'),nodeName
00090     self.ccode=compile(code,nodeName,'exec')
00091     self.context={}
00092     self.context["my_container"] = self.my_container

Member Function Documentation

def SALOME_PyNode.Generic.Destroy (   self) [inherited]

Definition at line 49 of file

00050   def Destroy(self):
00051     print "WARNING SALOME::GenericObj::Destroy() function is obsolete! Use UnRegister() instead."
00052     self.UnRegister()

Here is the call graph for this function:

def SALOME_PyNode.PyScriptNode_i.execute (   self,
Execute the script stored in attribute ccode with pickled args (argsin)

Definition at line 93 of file

00094   def execute(self,outargsname,argsin):
00095     """Execute the script stored in attribute ccode with pickled args (argsin)"""
00096     try:
00097       argsname,kws=cPickle.loads(argsin)
00098       self.context.update(kws)
00099       exec self.ccode in self.context
00100       argsout=[]
00101       for arg in outargsname:
00102         if not self.context.has_key(arg):
00103           raise KeyError("There is no variable %s in context" % arg)
00104         argsout.append(self.context[arg])
00105       argsout=cPickle.dumps(tuple(argsout),-1)
00106       return argsout
00107     except:
00108       exc_typ,exc_val,exc_fr=sys.exc_info()
00109       l=traceback.format_exception(exc_typ,exc_val,exc_fr)
00110       raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"".join(l),"PyScriptNode: %s, outargsname: %s" % (self.nodeName,outargsname),0))

Here is the caller graph for this function:

def SALOME_PyNode.Generic.Register (   self) [inherited]

Definition at line 40 of file

00041   def Register(self):
00042     self.cnt+=1

def SALOME_PyNode.Generic.UnRegister (   self) [inherited]

Definition at line 43 of file

00044   def UnRegister(self):
00045     self.cnt-=1
00046     if self.cnt <= 0:
00047       oid=self.poa.servant_to_id(self)
00048       self.poa.deactivate_object(oid)

Here is the caller graph for this function:

Member Data Documentation

Definition at line 89 of file

Definition at line 38 of file

Definition at line 86 of file

Definition at line 90 of file

Definition at line 87 of file

Definition at line 85 of file

Definition at line 37 of file

The documentation for this class was generated from the following file: