Salome HOME
6fb09923819a48cd4f7580dfe7fee999b3627c9a
[samples/datafiles.git] / Superv / Python / GraphObjRef.py
1 # Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
10 #
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 # Lesser General Public License for more details.
15 #
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 #
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22
23 # Generated python file of Graph GraphObjRef
24 #
25 from SuperV import *
26
27 # Graph creation of GraphObjRef
28 def DefGraphObjRef() :
29     GraphObjRef = Graph( 'GraphObjRef' )
30     GraphObjRef.SetName( 'GraphObjRef' )
31     GraphObjRef.SetAuthor( '' )
32     GraphObjRef.SetComment( '' )
33     GraphObjRef.Coords( 0 , 0 )
34     
35     # Creation of Factory Nodes
36     
37     Addition = GraphObjRef.FNode( 'AddComponent' , 'AddComponent' , 'Addition' )
38     Addition.SetName( 'Addition' )
39     Addition.SetAuthor( '' )
40     Addition.SetContainer( 'localhost/AdditionServer' )
41     Addition.SetComment( 'Addition from AddComponent' )
42     Addition.Coords( 10 , 15 )
43     IAdditionGate = Addition.GetInPort( 'Gate' )
44     OAdditionAdder = Addition.GetOutPort( 'Adder' )
45     OAdditionGate = Addition.GetOutPort( 'Gate' )
46     
47     # Creation of InLine Nodes
48     PySyrComponent = []
49     PySyrComponent.append( 'from LifeCycleCORBA import *     ' )
50     PySyrComponent.append( 'def SyrComponent( aContainer , aComponent ) :     ' )
51     PySyrComponent.append( '    print "SyrComponent(",aContainer,",",aComponent,")"     ' )
52     PySyrComponent.append( '    orb = CORBA.ORB_init([], CORBA.ORB_ID)     ' )
53     PySyrComponent.append( '    print "SyrComponent orb",orb   ' )
54     PySyrComponent.append( '    lcc = LifeCycleCORBA(orb)     ' )
55     PySyrComponent.append( '    print "SyrComponent lcc",lcc   ' )
56     PySyrComponent.append( '    print "SyrComponent(",aContainer,",",aComponent,")"     ' )
57     PySyrComponent.append( '    ComponentRef = lcc.FindOrLoadComponent( aContainer , aComponent )     ' )
58     PySyrComponent.append( '    print "SyrComponent(",aContainer,",",aComponent,") --> ",ComponentRef     ' )
59     PySyrComponent.append( '    return ComponentRef    ' )
60     PySyrComponent.append( '' )
61     SyrComponent = GraphObjRef.INode( 'SyrComponent' , PySyrComponent )
62     SyrComponent.SetName( 'SyrComponent' )
63     SyrComponent.SetAuthor( '' )
64     SyrComponent.SetComment( 'Compute Node' )
65     SyrComponent.Coords( 26 , 209 )
66     ISyrComponentaContainer = SyrComponent.InPort( 'aContainer' , 'string' )
67     ISyrComponentaComponent = SyrComponent.InPort( 'aComponent' , 'string' )
68     ISyrComponentGate = SyrComponent.GetInPort( 'Gate' )
69     OSyrComponentanObjRef = SyrComponent.OutPort( 'anObjRef' , 'objref' )
70     OSyrComponentGate = SyrComponent.GetOutPort( 'Gate' )
71     
72     # Creation of Loop Nodes
73     PyInit = []
74     PyInit.append( 'from time import * ' )
75     PyInit.append( 'def Init( Adder , anObjRef , Index ) : ' )
76     PyInit.append( '    sleep( 1 ) ' )
77     PyInit.append( '    return Adder,anObjRef,0   ' )
78     PyInit.append( ' ' )
79     PyMoreInit = []
80     PyMoreInit.append( 'def More( Adder , anObjRef , Index ) :       ' )
81     PyMoreInit.append( '    OutLoop = 0       ' )
82     PyMoreInit.append( '    if 10 > Index :       ' )
83     PyMoreInit.append( '        OutLoop = 1       ' )
84     PyMoreInit.append( '    return OutLoop,Adder,anObjRef,Index    ' )
85     PyMoreInit.append( ' ' )
86     PyNextInit = []
87     PyNextInit.append( 'def Nextfori( Adder , anObjRef , Index ) :      ' )
88     PyNextInit.append( '    Index = Index + 1      ' )
89     PyNextInit.append( '    return Adder,anObjRef,Index    ' )
90     PyNextInit.append( ' ' )
91     Init,EndInit = GraphObjRef.LNode( 'Init' , PyInit , 'More' , PyMoreInit , 'Nextfori' , PyNextInit )
92     EndInit.SetName( 'EndInit' )
93     EndInit.SetAuthor( '' )
94     EndInit.SetComment( 'Compute Node' )
95     EndInit.Coords( 449 , 165 )
96     PyEndInit = []
97     EndInit.SetPyFunction( '' , PyEndInit )
98     IInitDoLoop = Init.GetInPort( 'DoLoop' )
99     IInitAddder = Init.InPort( 'Addder' , 'objref' )
100     IInitanObjRef = Init.InPort( 'anObjRef' , 'objref' )
101     IInitIndex = Init.InPort( 'Index' , 'long' )
102     IInitGate = Init.GetInPort( 'Gate' )
103     OInitDoLoop = Init.GetOutPort( 'DoLoop' )
104     OInitAddder = Init.GetOutPort( 'Addder' )
105     OInitanObjRef = Init.GetOutPort( 'anObjRef' )
106     OInitIndex = Init.GetOutPort( 'Index' )
107     IEndInitDoLoop = EndInit.GetInPort( 'DoLoop' )
108     IEndInitAddder = EndInit.GetInPort( 'Addder' )
109     IEndInitanObjRef = EndInit.GetInPort( 'anObjRef' )
110     IEndInitIndex = EndInit.GetInPort( 'Index' )
111     IEndInitGate = EndInit.GetInPort( 'Gate' )
112     OEndInitDoLoop = EndInit.GetOutPort( 'DoLoop' )
113     OEndInitAddder = EndInit.GetOutPort( 'Addder' )
114     OEndInitanObjRef = EndInit.GetOutPort( 'anObjRef' )
115     OEndInitIndex = EndInit.GetOutPort( 'Index' )
116     OEndInitGate = EndInit.GetOutPort( 'Gate' )
117     Init.SetName( 'Init' )
118     Init.SetAuthor( '' )
119     Init.SetComment( 'Compute Node' )
120     Init.Coords( 236 , 161 )
121     
122     # Creation of Links
123     LAdditionAdderInitAddder = GraphObjRef.Link( OAdditionAdder , IInitAddder )
124     LAdditionAdderInitAddder.AddCoord( 1 , 202 , 194 )
125     LAdditionAdderInitAddder.AddCoord( 2 , 201 , 95 )
126     
127     LSyrComponentanObjRefInitanObjRef = GraphObjRef.Link( OSyrComponentanObjRef , IInitanObjRef )
128     LSyrComponentanObjRefInitanObjRef.AddCoord( 1 , 209 , 224 )
129     LSyrComponentanObjRefInitanObjRef.AddCoord( 2 , 208 , 289 )
130     
131     LInitAddderEndInitAddder = GraphObjRef.Link( OInitAddder , IEndInitAddder )
132     
133     LInitanObjRefEndInitanObjRef = GraphObjRef.Link( OInitanObjRef , IEndInitanObjRef )
134     
135     LInitIndexEndInitIndex = GraphObjRef.Link( OInitIndex , IEndInitIndex )
136     
137     # Input datas
138     ISyrComponentaContainer.Input( 'FactoryServer' )
139     ISyrComponentaComponent.Input( 'SyrComponent' )
140     IInitIndex.Input( 0 )
141     
142     # Output Ports of the graph
143     #OEndInitAddder = EndInit.GetOutPort( 'Addder' )
144     #OEndInitanObjRef = EndInit.GetOutPort( 'anObjRef' )
145     #OEndInitIndex = EndInit.GetOutPort( 'Index' )
146     return GraphObjRef
147
148
149 GraphObjRef = DefGraphObjRef()