24#ifndef _GEMA_ATTRIBUTE_RESULTS_MANAGER_H_
25#define _GEMA_ATTRIBUTE_RESULTS_MANAGER_H_
66 : _resultsData(resultsData),
68 _resultAttributes(true)
80 int nlin,
int ncol,
QString format,
int stats);
82 void removeResultAttribute(
int id);
83 bool renameResultAttribute(
int id,
QString newName);
91 void setResultAttributeValue(
int id,
double val);
92 void setResultAttributeValue(
int id,
double val1,
double val2);
93 void setResultAttributeValue(
int id,
double val1,
double val2,
double val3);
94 void setResultAttributeValue(
int id,
const double* val);
95 void setResultAttributeValue(
int id,
const GmVector& val);
96 void setResultAttributeValue(
int id,
const GmMatrix& val);
97 void setResultAttributeValue(
int id,
QString val);
99 void clearAttributeStatistics (
int id);
100 void updateAttributeStatistics(
int id);
103 bool isValidAttributeId(
int id)
const {
return id >= 0 &&
id < _resultAttributes.listSize() && _resultAttributes[id]; }
120 assert(isNumericResult(
id));
121 return info(
id)->attributeStats() ? value(
id)._statValue->_value :
128 assert(!isNumericResult(
id));
129 return *value(
id)._strValue;
137 assert(isNumericResult(
id));
138 return info(
id)->attributeStats() ? value(
id)._statValue->_statMin : NULL;
146 assert(isNumericResult(
id));
147 return info(
id)->attributeStats() ? value(
id)._statValue->_statMax : NULL;
155 assert(isNumericResult(
id));
156 return info(
id)->attributeStats() ? value(
id)._statValue->_statSum : NULL;
164 assert(isNumericResult(
id));
165 return info(
id)->attributeStats() ? value(
id)._statValue->_statCount : 0;
176 void removeRegisteredAttributes(
QObject* owner);
193 void clearStats(
int s);
194 void updateStats(
int s);
249 void unregisteredToRegistered(RegisteredAttrData* ad,
int attrId);
250 void registeredToUnregistered(RegisteredAttrData* ad);
252 void emitValueChanged(RegisteredAttrData* ad,
double val);
253 void emitValueChanged(RegisteredAttrData* ad,
QString val);
254 void emitValueChanged(RegisteredAttrData* ad,
const double* valList,
int n);
A class implementing the GmResultsDataSrcInfo interface, storing the metadata and id for a result dat...
Definition gmAttributeResultsDataSrc.h:41
A basic class used to store meta-data information about result attributes DEFINITIONS.
Definition gmAttributeResultsDataSrcInfo.h:32
A class used to host the metadata and the values for all attributes added to the results data....
Definition gmAttributeResultsManager.h:60
GmAttributeResultsDataSrcInfo * info(int id) const
Helper function to return the attribute info associated to a valid attribute id.
Definition gmAttributeResultsManager.h:244
bool _monitor
Is there someone monitoring data changes?
Definition gmAttributeResultsManager.h:263
QString resultAttributeString(int id) const
Returns the string value for the given STRING result attribute id.
Definition gmAttributeResultsManager.h:126
AttrValue & value(int id) const
Helper function to return the attribute value associated to a valid attribute id.
Definition gmAttributeResultsManager.h:247
QMap< QString, QVector< QPair< GmResultsDataSet *, GmAttributeResultsDataSrc * > > > _unregisteredAttributes
A map storing for each unregistered attribute name, the set of dataSet + dataSrc pairs referencing th...
Definition gmAttributeResultsManager.h:275
int resultAttributeId(QString name) const
Returns the id associated with the given result attribute name or -1 if no attribute with that name e...
Definition gmAttributeResultsManager.h:109
void attributeRegistered(int id, QString name)
Signal emitted whenever a new attribute was registered by registerResultAttribute()
quint64 resultAttributeStatisticsCount(int id) const
Returns the count of the saved results for the given NUMERIC result attribute id. Returns 0 if no sta...
Definition gmAttributeResultsManager.h:162
bool isValidAttributeId(int id) const
Returns true if the given id is a valid attribute id.
Definition gmAttributeResultsManager.h:103
bool isNumericResult(int id) const
Returns true if the given valid result id refers to a numeric based value.
Definition gmAttributeResultsManager.h:112
const double * resultAttributeStatisticsMinBuffer(int id) const
Returns the internal buffer used to store the minimum saved result for the given NUMERIC result attri...
Definition gmAttributeResultsManager.h:135
~GmAttributeResultsManager()
Destructor.
Definition gmAttributeResultsManager.h:72
QMap< QString, int > _resultAttributesMap
Map storing for each registered attribute name its id on the _resultAttributes list.
Definition gmAttributeResultsManager.h:266
const double * resultAttributeStatisticsMaxBuffer(int id) const
Returns the internal buffer used to store the maximum saved result for the given NUMERIC result attri...
Definition gmAttributeResultsManager.h:144
void attributeUnregistered(int id, QString name)
Signal emitted whenever a registered attribute is removed by removeResultAttribute() or by its owner ...
const double * resultAttributeBuffer(int id) const
Returns the internal buffer used to store the last saved result for the given NUMERIC result attribut...
Definition gmAttributeResultsManager.h:118
const GmAttributeResultsDataSrcInfo * resultAttributeInfo(int id) const
Returns the metadata associated with the given result attribute id.
Definition gmAttributeResultsManager.h:115
void enableMonitoring()
Enables the emission of the monitorValueChanged() family of signals (from the resultsData object)
Definition gmAttributeResultsManager.h:77
GmResultsData * _resultsData
The results data object. Used for emitting signals whenever an attribute value is changed for a monit...
Definition gmAttributeResultsManager.h:261
const double * resultAttributeStatisticsSumBuffer(int id) const
Returns the internal buffer used to store the sum of the saved results for the given NUMERIC result a...
Definition gmAttributeResultsManager.h:153
const QObject * attributeIdOwner(int id) const
Returns the owner object for the given result attribute.
Definition gmAttributeResultsManager.h:106
GmAttributeResultsManager(GmResultsData *resultsData)
Constructor.
Definition gmAttributeResultsManager.h:65
RegisteredAttrData * data(int id) const
Helper function to return the full attribute data associated to a valid attribute id.
Definition gmAttributeResultsManager.h:241
QtPtrList< RegisteredAttrData > _resultAttributes
A list storing for each registered result attribute its data. Might contain "holes" due to unregister...
Definition gmAttributeResultsManager.h:272
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
Declaration of the GmAttributeResultsDataSrcInfo class.
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 the GmMatrix class.
arma::mat GmMatrix
The basic type for a GeMA matrix object. Currently based on an Armadillo matrix.
Definition gmMatrix.h:38
Declaration of the GmVector class.
arma::vec GmVector
The basic type for a GeMA vector object. Currently based on an Armadillo vector.
Definition gmVector.h:34
An option to store an attribute value with statistics.
Definition gmAttributeResultsManager.h:183
double * _statSum
The buffer for storing the value sum.
Definition gmAttributeResultsManager.h:187
quint64 _statCount
The number of values accumulated on the stats attributes.
Definition gmAttributeResultsManager.h:188
double * _statMax
The buffer for storing the maximum value.
Definition gmAttributeResultsManager.h:186
double * _value
The value buffer.
Definition gmAttributeResultsManager.h:184
double * _statMin
The buffer for storing the minimum value.
Definition gmAttributeResultsManager.h:185
The data associated with registered attributes. It includes the object "owner" to allow for auto dere...
Definition gmAttributeResultsManager.h:224
AttrValue _value
The current attribute value.
Definition gmAttributeResultsManager.h:227
QVector< GmAttributeResultsDataSrc * > _monitoredList
The subset of _dataSrcList with data sources that should broadcast attribute changes.
Definition gmAttributeResultsManager.h:236
const QObject * _owner
The object that "owns" this attribute.
Definition gmAttributeResultsManager.h:226
GmAttributeResultsDataSrcInfo * _info
The metadata information on the registered attribute.
Definition gmAttributeResultsManager.h:225
QVector< QPair< GmResultsDataSet *, GmAttributeResultsDataSrc * > > _dataSrcList
If this attribute is referenced by any data set, the _dataSrcList references the data set and its ass...
Definition gmAttributeResultsManager.h:233
The union representing the saved value Using a QString instead of a QString* should be possible,...
Definition gmAttributeResultsManager.h:204
AttrValueWithStats * _statValue
The data used for storing a numeric value with statistics.
Definition gmAttributeResultsManager.h:206
double * _numValue
The buffer for storing a numeric value.
Definition gmAttributeResultsManager.h:205
QString * _strValue
A string value.
Definition gmAttributeResultsManager.h:207