VPTissue Reference Manual
SimWorker.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Universiteit Antwerpen
3  *
4  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
5  * the European Commission - subsequent versions of the EUPL (the "Licence");
6  * You may not use this work except in compliance with the Licence.
7  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the Licence is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the Licence for the specific language governing
13  * permissions and limitations under the Licence.
14  */
20 #include "session/SimWorker.h"
21 
22 #include <QString>
23 #include <exception>
24 
25 using namespace std;
26 
27 namespace SimPT_Shell {
28 namespace Session {
29 
30 SimWorker::SimWorker(shared_ptr<SimPT_Sim::SimInterface> s)
31  : m_sim(s)
32 {
33 }
34 
35 void SimWorker::Work()
36 {
37  QString message = "";
38  try {
39  m_sim->TimeStep(); // May throw Exception.
40  }
41  catch(const exception& e) {
42  message = QString::fromStdString(e.what());
43  }
44  catch(...) {
45  message = "Unknown exception in sim.";
46  }
47 
48  emit Worked(message);
49 }
50 
51 } // namespace
52 } // namespace
STL namespace.
Namespace for SimPT shell package.
Definition: Client.cpp:50
Header for SimWorker.