Salome HOME
NRI : Merge from BRANCH_Superv_DataStream.
[modules/superv.git] / examples / GraphObjRef.py
1
2 # Generated python file of Graph GraphObjRef
3
4 from SuperV import *
5 # Graph creation 
6 GraphObjRef = Graph( 'GraphObjRef' )
7 GraphObjRef.SetName( 'GraphObjRef' )
8 GraphObjRef.SetAuthor( '' )
9 GraphObjRef.SetComment( '' )
10 GraphObjRef.Coords( 0 , 0 )
11
12 # Creation of Factory Nodes
13
14 Addition = GraphObjRef.FNode( 'AddComponent' , 'AddComponent' , 'Addition' )
15 Addition.SetName( 'Addition' )
16 Addition.SetAuthor( '' )
17 Addition.SetContainer( 'localhost/AdditionServer' )
18 Addition.SetComment( 'Addition from AddComponent' )
19 Addition.Coords( 10 , 15 )
20
21 # Creation of InLine Nodes
22 PySyrComponent = []
23 PySyrComponent.append( 'from LifeCycleCORBA import *     ' )
24 PySyrComponent.append( 'def SyrComponent( aContainer , aComponent ) :     ' )
25 PySyrComponent.append( '    print "SyrComponent(",aContainer,",",aComponent,")"     ' )
26 PySyrComponent.append( '    orb = CORBA.ORB_init([], CORBA.ORB_ID)     ' )
27 PySyrComponent.append( '    print "SyrComponent orb",orb   ' )
28 PySyrComponent.append( '    lcc = LifeCycleCORBA(orb)     ' )
29 PySyrComponent.append( '    print "SyrComponent lcc",lcc   ' )
30 PySyrComponent.append( '    print "SyrComponent(",aContainer,",",aComponent,")"     ' )
31 PySyrComponent.append( '    ComponentRef = lcc.FindOrLoadComponent( aContainer , aComponent )     ' )
32 PySyrComponent.append( '    print "SyrComponent(",aContainer,",",aComponent,") --> ",ComponentRef     ' )
33 PySyrComponent.append( '    return ComponentRef    ' )
34 PySyrComponent.append( '' )
35 SyrComponent = GraphObjRef.INode( 'SyrComponent' , PySyrComponent )
36 SyrComponent.InPort( 'aContainer' , 'string' )
37 SyrComponent.InPort( 'aComponent' , 'string' )
38 SyrComponent.OutPort( 'anObjRef' , 'objref' )
39 SyrComponent.SetName( 'SyrComponent' )
40 SyrComponent.SetAuthor( '' )
41 SyrComponent.SetComment( 'Compute Node' )
42 SyrComponent.Coords( 26 , 209 )
43
44 # Creation of Loop Nodes
45 PyInit = []
46 PyInit.append( 'def Init( Adder , anObjRef , Index ) :       ' )
47 PyInit.append( '    return Adder,anObjRef,0  ' )
48 PyInit.append( '' )
49 PyMoreInit = []
50 PyMoreInit.append( 'def More( Adder , anObjRef , Index ) :      ' )
51 PyMoreInit.append( '    OutLoop = 0      ' )
52 PyMoreInit.append( '    if 10 > Index :      ' )
53 PyMoreInit.append( '        OutLoop = 1      ' )
54 PyMoreInit.append( '    return OutLoop,Adder,anObjRef,Index   ' )
55 PyMoreInit.append( '' )
56 PyNextInit = []
57 PyNextInit.append( 'def Nextfori( Adder , anObjRef , Index ) :     ' )
58 PyNextInit.append( '    Index = Index + 1     ' )
59 PyNextInit.append( '    return Adder,anObjRef,Index   ' )
60 PyNextInit.append( '' )
61 Init,EndInit = GraphObjRef.LNode( 'Init' , PyInit , 'More' , PyMoreInit , 'Nextfori' , PyNextInit )
62 EndInit.SetName( 'EndInit' )
63 EndInit.SetAuthor( '' )
64 EndInit.SetComment( '' )
65 EndInit.Coords( 441 , 177 )
66 Init.InPort( 'Addder' , 'objref' )
67 Init.InPort( 'anObjRef' , 'objref' )
68 Init.InPort( 'Index' , 'long' )
69 Init.OutPort( 'Addder' , 'objref' )
70 Init.OutPort( 'anObjRef' , 'objref' )
71 Init.OutPort( 'Index' , 'long' )
72 Init.SetName( 'Init' )
73 Init.SetAuthor( '' )
74 Init.SetComment( '' )
75 Init.Coords( 236 , 161 )
76
77 # Creation of Links
78 AdditionAdder = Addition.Port( 'Adder' )
79 InitAddder = GraphObjRef.Link( AdditionAdder , Init.Port( 'Addder' ) )
80 InitAddder.AddCoord( 1 , 202 , 194 )
81 InitAddder.AddCoord( 2 , 201 , 95 )
82
83 SyrComponentanObjRef = SyrComponent.Port( 'anObjRef' )
84 InitanObjRef = GraphObjRef.Link( SyrComponentanObjRef , Init.Port( 'anObjRef' ) )
85 InitanObjRef.AddCoord( 1 , 209 , 224 )
86 InitanObjRef.AddCoord( 2 , 208 , 289 )
87
88 InitAddder = Init.Port( 'Addder' )
89 EndInitAddder = GraphObjRef.Link( InitAddder , EndInit.Port( 'Addder' ) )
90
91 InitanObjRef = Init.Port( 'anObjRef' )
92 EndInitanObjRef = GraphObjRef.Link( InitanObjRef , EndInit.Port( 'anObjRef' ) )
93
94 InitIndex = Init.Port( 'Index' )
95 EndInitIndex = GraphObjRef.Link( InitIndex , EndInit.Port( 'Index' ) )
96
97 # Creation of Input datas
98 SyrComponentaContainer = SyrComponent.Input( 'aContainer' , 'FactoryServer')
99 SyrComponentaComponent = SyrComponent.Input( 'aComponent' , 'SyrComponent')
100 InitIndex = Init.Input( 'Index' , 0)
101
102 # Creation of Output variables
103 EndInitAddder = EndInit.Port( 'Addder' )
104 EndInitanObjRef = EndInit.Port( 'anObjRef' )
105 EndInitIndex = EndInit.Port( 'Index' )
106
107 GraphObjRef.Run()
108 GraphObjRef.DoneW()
109 GraphObjRef.State()
110 GraphObjRef.PrintPorts()