1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2024 CEA, EDF
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 # python3 /home/H87074/salome/990_CEA/SALOME-master-native-DB11-SRC/SOURCES/yacs/src/yacsloader/driver.py micro_schema.xml
27 my_runtime_yacs = None
29 def initializeSALOME():
31 global my_runtime_yacs
35 SALOMERuntime.RuntimeSALOME.setRuntime()
36 my_runtime_yacs = SALOMERuntime.getSALOMERuntime()
38 def SALOMEInitializationNeeded(func):
39 def decaratedFunc(*args,**kwargs):
41 return func(*args,**kwargs)
44 @SALOMEInitializationNeeded
45 def loadGraph( xmlFileName ):
49 xmlFileName : XML file containing YACS schema
54 SALOMERuntime.SalomeProc : YACS graph instance
57 p=l.load( xmlFileName )
61 @SALOMEInitializationNeeded
62 def executeGraph( proc ):
67 proc ( SALOMERuntime.SalomeProc ) : YACS Proc instance to be evaluated
71 ex=pilot.ExecutorSwig()
75 def destroyElementsGeneratedByExecutionOfGraph():
77 my_runtime_yacs.fini( False )
79 if __name__ == "__main__":
81 parser = argparse.ArgumentParser()
82 parser.add_argument('xmlfilename',help="XML file containing YACS schema to be executed")
83 args = parser.parse_args()
84 proc = loadGraph( args.xmlfilename )
86 destroyElementsGeneratedByExecutionOfGraph()