24#ifndef _GEMA_SIMULATION_H_
25#define _GEMA_SIMULATION_H_
69 QUIET_LOG_MODE = 0x00001,
70 VERBOSE_LOG_MODE = 0x00002,
71 NOCONSOLE_LOG_MODE = 0x00004,
72 REGRESSION_LOG_MODE = 0x00008,
73 MEMORY_LOG_MODE = 0x00010,
74 NOMEMORY_LOG_MODE = 0x00020,
75 TIME_LOG_MODE = 0x00040,
76 NOTIME_LOG_MODE = 0x00080,
77 SERVER_LOG_MODE = 0x00100,
78 NOSERVER_LOG_MODE = 0x00200,
79 PLUGININFO_LOG_MODE = 0x00400,
80 BLASVERSION_LOG_MODE= 0x00800,
81 NO_TRACK_MODE = 0x01000,
82 NS_SP_TRACK_MODE = 0x02000,
83 NS_DP_TRACK_MODE = 0x04000,
84 DS_SP_TRACK_MODE = 0x08000,
85 DS_DP_TRACK_MODE = 0x10000,
99 ServerMode serverMode,
unsigned localServerPort,
100 QString serverAddrFile,
bool rsrcFiles);
103 int timeout = -1, lua_State* state = NULL);
105 bool initEmptySimulation();
129 GmPath* paths() {
return _paths; }
143 void cancelRequested();
146 bool setConfigFile(
QString configFile,
QString logFile,
int logMode,
151 bool setupLogging (
LuaEnv& env,
QString logFile,
int logMode);
152 bool setupMonitorServer(
LuaEnv& env,
ServerMode serverMode,
unsigned localServerPort,
bool logToServer,
QString serverAddrFile);
153 bool setupUnitManager (
LuaEnv& env);
154 bool setupProgressLevelConfiguration(
LuaEnv& env,
int trackMode);
155 bool loadConfigValueTables(
LuaEnv& env);
158 void clearDataOnError(
bool abort);
Basic class for defining a GeMA physical Simulation, containing references to the model definition,...
Definition gmSimulation.h:59
bool _externalState
Are we using an external Lua environment provided in initSimulation() ?
Definition gmSimulation.h:183
GmLogCategory _logger
Basic logger object for the library.
Definition gmSimulation.h:169
void sectionParsed(QString section, LuaTable &data)
Signal emmited whenever a model section has been parsed from the Lua file.
const GmLogCategory & logger()
Returns the basic logger for the GeMA library.
Definition gmSimulation.h:117
GmSimulationData * _simulationData
Object storing the complete Simulation information.
Definition gmSimulation.h:162
GmSimulationData * data() const
Returns a reference to the simulation data.
Definition gmSimulation.h:123
const GmPath * paths() const
Returns the object storing information for path macro susbstitution.
Definition gmSimulation.h:128
QList< LuaEnv * > _workerEnvList
A list with Lua environments for worker threads.
Definition gmSimulation.h:187
bool _rsrcFiles
If set to true, the config file and the model file are allowed to be resource files.
Definition gmSimulation.h:167
GmCommServer * _monitorServer
The monitor server. Will be NULL if monitoring is not enabled.
Definition gmSimulation.h:171
bool _loadCompleted
A flag set to true when the model loading has finished successfully. Also protected by _envMutex.
Definition gmSimulation.h:185
LuaEnv * env()
Returns the simulation environment.
Definition gmSimulation.h:120
void clear()
Clears the current simulation environment, preparing the object for a new simulation: new calls to in...
Definition gmSimulation.h:112
QVariantMap _configConstants
The set of constants defined on the config file.
Definition gmSimulation.h:165
GmPath * _paths
Object storing the set of important simulation paths for macro translation.
Definition gmSimulation.h:164
LogModes
Predefined Log modes & Progress track levels. Can be ored together.
Definition gmSimulation.h:68
bool _redirectPrint
Should we redirect Lua print() calls to the logger?
Definition gmSimulation.h:184
LuaEnv * _env
Lua environment used to read the Simulation. Reused during the execution step as it contains function...
Definition gmSimulation.h:182
ServerMode
Server initialization modes.
Definition gmSimulation.h:90
@ LOCAL_SERVER_MODE
The monitor server will be turned on, listening for connections on the local host.
Definition gmSimulation.h:94
@ CONFIG_SERVER_MODE
The monitor server will be turned on or off depending on the config file.
Definition gmSimulation.h:91
@ ENABLE_SERVER_MODE
The monitor server will be turned on.
Definition gmSimulation.h:92
@ DISABLE_SERVER_MODE
The monitor server will be turned off.
Definition gmSimulation.h:93
QMutex _envMutex
The mutex used to control the possible data race during the creation of the Lua environments and poss...
Definition gmSimulation.h:177
GmSimulationLoader * _simulationLoader
Simulation loader.
Definition gmSimulation.h:163
bool _monitorRuleTesting
Should we enable monitor rule testing?
Definition gmSimulation.h:172
QVariantMap _configOptions
The set of options defined on the config file.
Definition gmSimulation.h:166
Auxiliary class responsible for loading simulation information from a Lua File.
Definition gmSimulationLoader.h:44
Declaration of useful configuration definitions.
GmSimulationResult
Enumeration describing the result of a simulation.
Definition gmSimulation.h:48
@ GM_RESULT_CANCELED
The simulation was cancelled by user request.
Definition gmSimulation.h:50
@ GM_RESULT_ABORTED
The simulation was aborted by a run time error.
Definition gmSimulation.h:51
@ GM_RESULT_OK
The simulation completed successfully.
Definition gmSimulation.h:49