GemaLib
The GeMA library
gmSimulationRunner.h
Go to the documentation of this file.
1 /************************************************************************
2 **
3 ** Copyright (C) 2014 by Carlos Augusto Teixera Mendes
4 ** All rights reserved.
5 **
6 ** This file is part of the "GeMA" software. It's use should respect
7 ** the terms in the license agreement that can be found together
8 ** with this source code.
9 ** It is provided AS IS, with NO WARRANTY OF ANY KIND,
10 ** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
11 ** A PARTICULAR PURPOSE.
12 **
13 ************************************************************************/
14 
24 #ifndef _GEMA_SIMULATION_RUNNER_H_
25 #define _GEMA_SIMULATION_RUNNER_H_
26 
27 #include "gmSimulation.h"
28 
29 class GmSimulationData;
30 class GmPluginLoader;
31 class GmLogCategory;
32 
33 struct lua_State;
34 struct lua_Debug;
35 class LuaEnv;
36 
37 class GmProcess;
38 class GmCommServer;
39 
40 #include <QObject>
41 
43 class GM_API_EXPORT GmSimulationRunner: public QObject
44 {
45  Q_OBJECT
46 
47 public:
48  GmSimulationRunner(GmSimulationData* data, GmPluginLoader* loader, GmCommServer* server,
49  LuaEnv* env, const QList<LuaEnv*>& workerEnv);
51 
52  GmSimulationResult run();
53 
54 private slots:
55 
56 private:
57  void prepareEnvironment();
58  void setupMonitorHook();
59 
60  static int loadProcessMM(lua_State* L);
61  static void lineHook(lua_State* L, lua_Debug* ar);
62 
65  GmCommServer* _server;
70 };
71 
72 #endif
73 
Class responsible for executing a simulation.
Definition: gmSimulationRunner.h:43
Declaration of the GmSimulation class.
LuaEnv * _env
The environment where the simulation will be runned.
Definition: gmSimulationRunner.h:68
GmLogCategory _logger
Basic logger object for the library.
Definition: gmSimulationRunner.h:66
QList< GmProcess * > _procList
List of process objects instanced during the script execution.
Definition: gmSimulationRunner.h:67
GmCommServer * _server
The monitor server if this option was enabled.
Definition: gmSimulationRunner.h:65
GmSimulationData * _simulationData
Object storing the complete Simulation information.
Definition: gmSimulationRunner.h:63
const QList< LuaEnv * > & _workerEnvList
A list with worker thread environments.
Definition: gmSimulationRunner.h:69
GmSimulationResult
Enumeration describing the result of a simulation.
Definition: gmSimulation.h:47
GmPluginLoader * _pluginLoader
Plugin loader (needed since required processes are found while running the process script)
Definition: gmSimulationRunner.h:64