Back to index

salome-kernel  6.5.0
dsccalcium.py
Go to the documentation of this file.
00001 #  -*- coding: iso-8859-1 -*-
00002 # Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00003 #
00004 # This library is free software; you can redistribute it and/or
00005 # modify it under the terms of the GNU Lesser General Public
00006 # License as published by the Free Software Foundation; either
00007 # version 2.1 of the License.
00008 #
00009 # This library is distributed in the hope that it will be useful,
00010 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 # Lesser General Public License for more details.
00013 #
00014 # You should have received a copy of the GNU Lesser General Public
00015 # License along with this library; if not, write to the Free Software
00016 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00017 #
00018 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00019 #
00020 
00021 ## @package dsccalcium
00022 # \brief Module that provides the base class for DSC components implemented in python
00023 #
00024 
00025 import calcium
00026 import SALOME_ComponentPy
00027 import SALOME_DriverPy
00028 import Engines
00029 
00030 ## The SALOME base class for all DSC components implemented in python (interface Engines::Superv_Component).
00031 #
00032 #
00033 class PyDSCComponent(SALOME_ComponentPy.SALOME_ComponentPy_i,
00034                      SALOME_DriverPy.SALOME_DriverPy_i):
00035   """
00036      A Python DSC component is implemented by a Python class that has
00037      the name of the component and is located in a python module that has the
00038      name of the component.
00039 
00040      You must derive it and implement init_service and those methods
00041      that are services of the component.
00042   """
00043   def __init__ ( self, orb, poa, contID, containerName, instanceName, interfaceName ):
00044     SALOME_ComponentPy.SALOME_ComponentPy_i.__init__(self, orb, poa,
00045                     contID, containerName, instanceName, interfaceName, 0)
00046     SALOME_DriverPy.SALOME_DriverPy_i.__init__(self, interfaceName)
00047     # create the DSC proxy
00048     self.proxy=calcium.PySupervCompo(orb,poa,contID,instanceName,interfaceName )
00049     # Store a reference on naming service in _naming_service attribute 
00050     self._naming_service = SALOME_ComponentPy.SALOME_NamingServicePy_i( self._orb )
00051 
00052   def init_service(self,service):
00053     return True
00054 
00055   enums={Engines.DSC.RemovingConnection:calcium.DSC.RemovingConnection,
00056          Engines.DSC.AddingConnection:calcium.DSC.AddingConnection,
00057          Engines.DSC.ApplicationError:calcium.DSC.ApplicationError,
00058         }
00059   def get_provides_port(self,name,error):
00060     return self.proxy.get_provides_port(name,error)
00061 
00062   def connect_uses_port(self,name,port):
00063     self.proxy.connect_uses_port(name,port)
00064 
00065   def connect_provides_port(self,name):
00066     self.proxy.connect_provides_port(name)
00067 
00068   def disconnect_provides_port(self,name,message):
00069     self.proxy.disconnect_provides_port(name,message._v)
00070     #self.proxy.disconnect_provides_port(name,self.enums[message])
00071 
00072   def disconnect_uses_port(self,name,port,message):
00073     self.proxy.disconnect_uses_port(name,port,message._v)
00074     #self.proxy.disconnect_uses_port(name,port,self.enums[message])
00075 
00076   def get_port_properties(self,name):
00077     return self.proxy.get_port_properties(name)
00078 
00079   def setInputFileToService(self,service_name,Salome_file_name):
00080     return self.proxy.setInputFileToService(service_name,Salome_file_name)
00081 
00082   def checkInputFilesToService(self,service_name):
00083     return self.proxy.checkInputFilesToService(service_name)
00084 
00085   def getInputFileToService(self,service_name,Salome_file_name):
00086     return self.proxy.getInputFileToService(service_name,Salome_file_name)
00087 
00088   def setOutputFileToService(self,service_name,Salome_file_name):
00089     return self.proxy.setOutputFileToService(service_name,Salome_file_name)
00090 
00091   def getOutputFileToService(self,service_name,Salome_file_name):
00092     return self.proxy.getOutputFileToService(service_name,Salome_file_name)
00093 
00094   def checkOutputFilesToService(self,service_name):
00095     return self.proxy.checkOutputFilesToService(service_name)
00096 
00097   def beginService(self,service_name):
00098     SALOME_ComponentPy.SALOME_ComponentPy_i.beginService(self,service_name)
00099     self.proxy.setTimeOut()
00100