Salome HOME
Merge from V6_main_20120808 08Aug12
[samples/datafiles.git] / Superv / Python / GraphObjRef.py
1 #  Copyright (C) 2007-2011  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.
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 # Generated python file of Graph GraphObjRef
23 #
24 from SuperV import *
25
26 # Graph creation of GraphObjRef
27 def DefGraphObjRef() :
28     GraphObjRef = Graph( 'GraphObjRef' )
29     GraphObjRef.SetName( 'GraphObjRef' )
30     GraphObjRef.SetAuthor( '' )
31     GraphObjRef.SetComment( '' )
32     GraphObjRef.Coords( 0 , 0 )
33     
34     # Creation of Factory Nodes
35     
36     Addition = GraphObjRef.FNode( 'AddComponent' , 'AddComponent' , 'Addition' )
37     Addition.SetName( 'Addition' )
38     Addition.SetAuthor( '' )
39     Addition.SetContainer( 'localhost/AdditionServer' )
40     Addition.SetComment( 'Addition from AddComponent' )
41     Addition.Coords( 10 , 15 )
42     IAdditionGate = Addition.GetInPort( 'Gate' )
43     OAdditionAdder = Addition.GetOutPort( 'Adder' )
44     OAdditionGate = Addition.GetOutPort( 'Gate' )
45     
46     # Creation of InLine Nodes
47     PySyrComponent = []
48     PySyrComponent.append( 'from LifeCycleCORBA import *     ' )
49     PySyrComponent.append( 'def SyrComponent( aContainer , aComponent ) :     ' )
50     PySyrComponent.append( '    print "SyrComponent(",aContainer,",",aComponent,")"     ' )
51     PySyrComponent.append( '    orb = CORBA.ORB_init([], CORBA.ORB_ID)     ' )
52     PySyrComponent.append( '    print "SyrComponent orb",orb   ' )
53     PySyrComponent.append( '    lcc = LifeCycleCORBA(orb)     ' )
54     PySyrComponent.append( '    print "SyrComponent lcc",lcc   ' )
55     PySyrComponent.append( '    print "SyrComponent(",aContainer,",",aComponent,")"     ' )
56     PySyrComponent.append( '    ComponentRef = lcc.FindOrLoadComponent( aContainer , aComponent )     ' )
57     PySyrComponent.append( '    print "SyrComponent(",aContainer,",",aComponent,") --> ",ComponentRef     ' )
58     PySyrComponent.append( '    return ComponentRef    ' )
59     PySyrComponent.append( '' )
60     SyrComponent = GraphObjRef.INode( 'SyrComponent' , PySyrComponent )
61     SyrComponent.SetName( 'SyrComponent' )
62     SyrComponent.SetAuthor( '' )
63     SyrComponent.SetComment( 'Compute Node' )
64     SyrComponent.Coords( 26 , 209 )
65     ISyrComponentaContainer = SyrComponent.InPort( 'aContainer' , 'string' )
66     ISyrComponentaComponent = SyrComponent.InPort( 'aComponent' , 'string' )
67     ISyrComponentGate = SyrComponent.GetInPort( 'Gate' )
68     OSyrComponentanObjRef = SyrComponent.OutPort( 'anObjRef' , 'objref' )
69     OSyrComponentGate = SyrComponent.GetOutPort( 'Gate' )
70     
71     # Creation of Loop Nodes
72     PyInit = []
73     PyInit.append( 'from time import * ' )
74     PyInit.append( 'def Init( Adder , anObjRef , Index ) : ' )
75     PyInit.append( '    sleep( 1 ) ' )
76     PyInit.append( '    return Adder,anObjRef,0   ' )
77     PyInit.append( ' ' )
78     PyMoreInit = []
79     PyMoreInit.append( 'def More( Adder , anObjRef , Index ) :       ' )
80     PyMoreInit.append( '    OutLoop = 0       ' )
81     PyMoreInit.append( '    if 10 > Index :       ' )
82     PyMoreInit.append( '        OutLoop = 1       ' )
83     PyMoreInit.append( '    return OutLoop,Adder,anObjRef,Index    ' )
84     PyMoreInit.append( ' ' )
85     PyNextInit = []
86     PyNextInit.append( 'def Nextfori( Adder , anObjRef , Index ) :      ' )
87     PyNextInit.append( '    Index = Index + 1      ' )
88     PyNextInit.append( '    return Adder,anObjRef,Index    ' )
89     PyNextInit.append( ' ' )
90     Init,EndInit = GraphObjRef.LNode( 'Init' , PyInit , 'More' , PyMoreInit , 'Nextfori' , PyNextInit )
91     EndInit.SetName( 'EndInit' )
92     EndInit.SetAuthor( '' )
93     EndInit.SetComment( 'Compute Node' )
94     EndInit.Coords( 449 , 165 )
95     PyEndInit = []
96     EndInit.SetPyFunction( '' , PyEndInit )
97     IInitDoLoop = Init.GetInPort( 'DoLoop' )
98     IInitAddder = Init.InPort( 'Addder' , 'objref' )
99     IInitanObjRef = Init.InPort( 'anObjRef' , 'objref' )
100     IInitIndex = Init.InPort( 'Index' , 'long' )
101     IInitGate = Init.GetInPort( 'Gate' )
102     OInitDoLoop = Init.GetOutPort( 'DoLoop' )
103     OInitAddder = Init.GetOutPort( 'Addder' )
104     OInitanObjRef = Init.GetOutPort( 'anObjRef' )
105     OInitIndex = Init.GetOutPort( 'Index' )
106     IEndInitDoLoop = EndInit.GetInPort( 'DoLoop' )
107     IEndInitAddder = EndInit.GetInPort( 'Addder' )
108     IEndInitanObjRef = EndInit.GetInPort( 'anObjRef' )
109     IEndInitIndex = EndInit.GetInPort( 'Index' )
110     IEndInitGate = EndInit.GetInPort( 'Gate' )
111     OEndInitDoLoop = EndInit.GetOutPort( 'DoLoop' )
112     OEndInitAddder = EndInit.GetOutPort( 'Addder' )
113     OEndInitanObjRef = EndInit.GetOutPort( 'anObjRef' )
114     OEndInitIndex = EndInit.GetOutPort( 'Index' )
115     OEndInitGate = EndInit.GetOutPort( 'Gate' )
116     Init.SetName( 'Init' )
117     Init.SetAuthor( '' )
118     Init.SetComment( 'Compute Node' )
119     Init.Coords( 236 , 161 )
120     
121     # Creation of Links
122     LAdditionAdderInitAddder = GraphObjRef.Link( OAdditionAdder , IInitAddder )
123     LAdditionAdderInitAddder.AddCoord( 1 , 202 , 194 )
124     LAdditionAdderInitAddder.AddCoord( 2 , 201 , 95 )
125     
126     LSyrComponentanObjRefInitanObjRef = GraphObjRef.Link( OSyrComponentanObjRef , IInitanObjRef )
127     LSyrComponentanObjRefInitanObjRef.AddCoord( 1 , 209 , 224 )
128     LSyrComponentanObjRefInitanObjRef.AddCoord( 2 , 208 , 289 )
129     
130     LInitAddderEndInitAddder = GraphObjRef.Link( OInitAddder , IEndInitAddder )
131     
132     LInitanObjRefEndInitanObjRef = GraphObjRef.Link( OInitanObjRef , IEndInitanObjRef )
133     
134     LInitIndexEndInitIndex = GraphObjRef.Link( OInitIndex , IEndInitIndex )
135     
136     # Input datas
137     ISyrComponentaContainer.Input( 'FactoryServer' )
138     ISyrComponentaComponent.Input( 'SyrComponent' )
139     IInitIndex.Input( 0 )
140     
141     # Output Ports of the graph
142     #OEndInitAddder = EndInit.GetOutPort( 'Addder' )
143     #OEndInitanObjRef = EndInit.GetOutPort( 'anObjRef' )
144     #OEndInitIndex = EndInit.GetOutPort( 'Index' )
145     return GraphObjRef
146
147
148 GraphObjRef = DefGraphObjRef()