1 // Copyright (C) 2006-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "RuntimeSALOME.hxx"
22 #include "Exception.hxx"
23 #include "Executor.hxx"
24 #include "parsers.hxx"
25 #include "VisitorSaveState.hxx"
26 #include "LoadState.hxx"
32 using YACS::YACSLoader;
33 using namespace YACS::ENGINE;
38 main (int argc, char* argv[])
40 if (argc != 3 && argc != 4)
42 cerr << "usage: " << argv[0] << " [--display=n] schema.xml state.xml" << endl;
52 if(std::string(argv[1]) == "--display=1")
54 else if(std::string(argv[1]) == "--display=2")
56 else if(std::string(argv[1]) == "--display=3")
60 RuntimeSALOME::setRuntime();
67 Proc* p=loader.load(argv[argfile]);
70 stateParser* rootParser = new stateParser();
71 stateLoader myStateLoader(rootParser, p);
72 myStateLoader.parse(argv[argState]);
74 std::ofstream f("toto");
77 cerr << "+++++++++++++++++++ start calculation +++++++++++++++++++" << endl;
78 executor.RunW(p, display, false);
79 cerr << "+++++++++++++++++++ end calculation +++++++++++++++++++" << endl;
80 std::ofstream g("titi");
83 YACS::ENGINE::VisitorSaveState vst(p);
84 vst.openFileDump("dumpState.xml");
88 YACS::ENGINE::getRuntime()->fini();
91 catch (YACS::Exception& e)
93 cerr << "Caught a YACS exception" << endl;
94 cerr << e.what() << endl;
95 YACS::ENGINE::getRuntime()->fini();
98 catch (const std::ios_base::failure&)
100 cerr << "Caught an io failure exception" << endl;
103 catch(CORBA::SystemException& ex)
105 cerr << "Caught a CORBA::SystemException." ;
108 CORBA::TypeCode_var tc = tmp.type();
109 const char *p = tc->name();
117 catch(omniORB::fatalException& fe)
119 cerr << "Caught omniORB::fatalException:" << endl;
120 cerr << " file: " << fe.file() << endl;
121 cerr << " line: " << fe.line() << endl;
122 cerr << " mesg: " << fe.errmsg() << endl;
127 cerr << "Caught unknown exception." << endl;