GemaCoreLib
The GeMA Core library
Loading...
Searching...
No Matches
gmResultsRule.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_RESULTS_RULE_H_
25#define _GEMA_RESULTS_RULE_H_
26
27#include "gmCoreConfig.h"
28#include "gmLog.h"
29
30#include <QString>
31#include <QVector>
32
33class LuaTable;
34class GmResultsData;
38
46
56{
57public:
58
59 virtual ~GmResultsRule();
60
62 QString id() const { return _id; }
63
65 QString description() const { return _description; }
66
68 virtual GmResultsRuleType type() const = 0;
69
71 const QVector<GmResultsDataSet*>& dataSets() const { return _dataSets; }
72
74 const QVector<GmResultsTimeSet*>& timeSets() const { return _timeSets; }
75
77 bool hasTimeSet() const { return !_timeSets.isEmpty(); }
78
79 virtual void print(const GmLogCategory& logger, GmLogLevel level) const;
80
82 virtual bool run(const GmLogCategory& logger) = 0;
83
84protected:
85 GmResultsRule(QString id, QString description, const QVector<GmResultsDataSet*>& dataSets,
86 const QVector<GmResultsTimeSet*>& timeSets, bool trackObj, const GmSimulationData* simData);
87
88 static bool fillCommonFields(const GmResultsData* data, LuaTable& tab, const GmLogCategory& logger,
89 QString& id, QString& description, QVector<GmResultsDataSet*>& dataSets,
90 QVector<GmResultsTimeSet*>& timeSets, bool& trackObj);
91
94
97
99 int _itemId;
101
102private:
103 Q_DISABLE_COPY(GmResultsRule);
104
105};
106#endif
Class representing a category with multiple logging levels.
Definition gmLog.h:58
Auxiliar class used to store the complete set of results data for a simulation.
Definition gmResultsData.h:58
A set storing what should be exported (saved / printed / monitored) by the result rule classes.
Definition gmResultsDataSet.h:58
A result rule represents an action that will be executed over one or more data sets at the moments (t...
Definition gmResultsRule.h:56
QString _description
A description of the save rule.
Definition gmResultsRule.h:93
QVector< GmResultsTimeSet * > _timeSets
The list of associated time sets.
Definition gmResultsRule.h:96
int _itemId
The run progress item id for result rules of this kind (subclass: save rules, print rules or monitor ...
Definition gmResultsRule.h:99
virtual GmResultsRuleType type() const =0
Returns the result rule type.
bool hasTimeSet() const
Returns true if this rule is associated with a time set.
Definition gmResultsRule.h:77
QVector< GmResultsDataSet * > _dataSets
The list of associated data sets.
Definition gmResultsRule.h:95
const QVector< GmResultsDataSet * > & dataSets() const
Returns the list of data sets acted upon by this rule.
Definition gmResultsRule.h:71
QString id() const
Returns the result rule name.
Definition gmResultsRule.h:62
QString _id
The save rule id (name)
Definition gmResultsRule.h:92
QString description() const
Returns the result rule description.
Definition gmResultsRule.h:65
int _objItemId
The run progress item for this object if the user requested to monitor the time for this specific res...
Definition gmResultsRule.h:100
const QVector< GmResultsTimeSet * > & timeSets() const
Returns the list of time sets defining when this rule should be acted upon.
Definition gmResultsRule.h:74
const GmSimulationData * _simData
The simulation data object.
Definition gmResultsRule.h:98
virtual bool run(const GmLogCategory &logger)=0
The virtual method responsible for executing this rule's actions.
A rule specifying the execution moments (time, iterations, etc) that a result rule should be executed...
Definition gmResultsTimeSet.h:39
Auxiliar class used to store the complete set of simulation data.
Definition gmSimulationData.h:55
Declaration of useful configuration definitions for the Core library.
#define GMC_API_EXPORT
Macro for controlling if the class is being exported (GEMA_CORE_LIB defined) or imported (GEMA_CORE_L...
Definition gmCoreConfig.h:35
Declaration of support functions and macros for information logging.
GmLogLevel
Available log levels list.
Definition gmLog.h:36
GmResultsRuleType
The current available types for a result rule.
Definition gmResultsRule.h:41
@ GM_RESULTS_MONITOR_RULE
A monitor rule.
Definition gmResultsRule.h:44
@ GM_RESULTS_PRINT_RULE
A print rule.
Definition gmResultsRule.h:43
@ GM_RESULTS_SAVE_RULE
A save rule.
Definition gmResultsRule.h:42