3 # SuperVisionTest FactorialComponent : example of component that calculates factorial
5 # Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
6 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
8 # This library is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Lesser General Public
10 # License as published by the Free Software Foundation; either
11 # version 2.1 of the License.
13 # This library is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # Lesser General Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with this library; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
26 # File : FactorialComponent.py
28 # Module : SuperVisionTest
32 from omniORB import CORBA, PortableServer
34 import Engines, Engines__POA
35 import SuperVisionTest, SuperVisionTest__POA
36 from SALOME_ComponentPy import *
38 from FactorialComponent_idl import *
40 class FactorialComponent( SuperVisionTest__POA.FactorialComponent, SALOME_ComponentPy_i):
43 self.beginService( 'FactorialComponent eval' )
46 raise ArgumentError("factorial must be positive, not " + `val`)
48 print "eval return",val
49 self.sendMessage( NOTIF_STEP , "Done" )
50 self.endService( 'FactorialComponent eval' )
53 val1 = self.eval(val-1)
54 self.sendMessage( NOTIF_TRACE , "One More Time" )
55 print "eval return",val," * ",val1
59 self.beginService( 'FactorialComponent sigma' )
62 raise ArgumentError("sigma must be positive, not " + `val`)
71 print "sigma returns",s
72 self.endService( 'FactorialComponent sigma' )
75 def __init__(self, orb, poa, this, containerName, instanceName, interfaceName):
76 SALOME_ComponentPy_i.__init__(self, orb, poa, this, containerName,
77 instanceName, interfaceName, 0)
78 print "FactorialComponent::__init__"