Version: 9.16.0
resume.cxx File Reference
#include "RuntimeSALOME.hxx"
#include "Proc.hxx"
#include "Exception.hxx"
#include "Executor.hxx"
#include "parsers.hxx"
#include "VisitorSaveState.hxx"
#include "LoadState.hxx"
#include <iostream>
#include <fstream>
Include dependency graph for resume.cxx:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 38 of file resume.cxx.

39{
40 if (argc != 3 && argc != 4)
41 {
42 cerr << "usage: " << argv[0] << " [--display=n] schema.xml state.xml" << endl;
43 return 1;
44 }
45 int display=0;
46 int argfile=1;
47 int argState=2;
48 if(argc == 4)
49 {
50 argfile=2;
51 argState=3;
52 if(std::string(argv[1]) == "--display=1")
53 display=1;
54 else if(std::string(argv[1]) == "--display=2")
55 display=2;
56 else if(std::string(argv[1]) == "--display=3")
57 display=3;
58 }
59
60 RuntimeSALOME::setRuntime();
61
63 Executor executor;
64
65 try
66 {
67 Proc* p=loader.load(argv[argfile]);
68 p->init();
70 stateParser* rootParser = new stateParser();
71 stateLoader myStateLoader(rootParser, p);
72 myStateLoader.parse(argv[argState]);
73
74 std::ofstream f("toto");
75 p->writeDot(f);
76 f.close();
77 cerr << "+++++++++++++++++++ start calculation +++++++++++++++++++" << endl;
78 executor.RunW(p, display, false);
79 cerr << "+++++++++++++++++++ end calculation +++++++++++++++++++" << endl;
80 std::ofstream g("titi");
81 p->writeDot(g);
82 g.close();
84 vst.openFileDump("dumpState.xml");
85 p->accept(&vst);
86 vst.closeFileDump();
87 delete p;
89 return 0;
90 }
91 catch (YACS::Exception& e)
92 {
93 cerr << "Caught a YACS exception" << endl;
94 cerr << e.what() << endl;
96 return 1;
97 }
98 catch (const std::ios_base::failure&)
99 {
100 cerr << "Caught an io failure exception" << endl;
101 return 1;
102 }
103 catch(CORBA::SystemException& ex)
104 {
105 cerr << "Caught a CORBA::SystemException." ;
106 CORBA::Any tmp;
107 tmp <<= ex;
108 CORBA::TypeCode_var tc = tmp.type();
109 const char *p = tc->name();
110 if ( *p != '\0' )
111 cerr <<p;
112 else
113 cerr << tc->id();
114 cerr << endl;
115 return 1;
116 }
117 catch(omniORB::fatalException& fe)
118 {
119 cerr << "Caught omniORB::fatalException:" << endl;
120 cerr << " file: " << fe.file() << endl;
121 cerr << " line: " << fe.line() << endl;
122 cerr << " mesg: " << fe.errmsg() << endl;
123 return 1;
124 }
125 catch(...)
126 {
127 cerr << "Caught unknown exception." << endl;
128 return 1;
129 }
130}
void display(CORBA::Any *data)
Definition: CORBAPorts.cxx:144
void init(bool start=true)
Initialize the bloc.
Definition: Bloc.cxx:95
void exUpdateState()
Update the bloc state.
Definition: Bloc.cxx:153
Threaded Executor.
Definition: Executor.hxx:63
void RunW(Scheduler *graph, int debug=0, bool fromScratch=true)
Definition: Executor.cxx:1833
Base class for all schema objects.
Definition: Proc.hxx:44
virtual void accept(Visitor *visitor)
Definition: Proc.cxx:199
virtual void writeDot(std::ostream &os) const
Dump to the input stream a dot representation of the node.
Definition: Proc.cxx:86
virtual void fini()
Definition: Runtime.hxx:73
class for parse an xml file, use a dedicated parser, to load a saved state of a SALOME execution.
Definition: LoadState.hxx:54
specialized parser to load SALOME execution saved states.
Definition: LoadState.hxx:81
const char * what(void) const noexcept
Definition: Exception.cxx:50
Proc * p
Definition: driver.cxx:216
YACSLIBENGINE_EXPORT Runtime * getRuntime()
Definition: Runtime.cxx:61
YACS::YACSLoader::YACSLoader * loader
Definition: yacs_clt.cxx:31

References YACS::ENGINE::Proc::accept(), YACS::ENGINE::VisitorSaveState::closeFileDump(), display(), testCppPluginInvokation::ex, YACS::ENGINE::Bloc::exUpdateState(), gui.CONNECTOR::f(), YACS::ENGINE::Runtime::fini(), YACS::ENGINE::getRuntime(), YACS::ENGINE::Bloc::init(), loader, YACS::ENGINE::VisitorSaveState::openFileDump(), p, YACS::ENGINE::stateLoader::parse(), YACS::ENGINE::Executor::RunW(), YACS::Exception::what(), and YACS::ENGINE::Proc::writeDot().