GemaCoreLib
The GeMA Core library
Loading...
Searching...
No Matches
gmAttributeResultsDataSrc.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_ATTRIBUTE_RESULTS_DATASRC_H_
25#define _GEMA_ATTRIBUTE_RESULTS_DATASRC_H_
26
28#include <QObject>
29
30#include <unitConverter.h>
31
32
41{
42 Q_OBJECT
43
44public:
46 : _trackId(-1), _alias(name), _unit(unit), _info(NULL), _id(-1), _conv(NULL) {}
47
48 virtual ~GmAttributeResultsDataSrc() { delete _conv; }
49
50 bool setInfo(const GmAttributeResultsDataSrcInfo* info, int id);
51
52 virtual void setMonitorTrackId(int id) { _trackId = id; }
53
54 virtual int monitorTrackId() const { return _trackId; }
55 virtual GmResultsDataSrcType type() const { return GM_RR_DS_ATTRIBUTE; }
56 virtual QString alias() const { return _alias; }
57 virtual QString description() const { return _info ? _info->description() : ""; }
58 virtual int size() const { return _info ? _info->size() : -1; }
59 virtual int nlin() const { return _info ? _info->nlin() : -1; }
60 virtual int ncol() const { return _info ? _info->ncol() : -1; }
61 virtual QString formatStr() const { return _info ? _info->formatStr() : ""; }
62
64 virtual int attributeStats() const { return _info ? _info->attributeStats() : 0; }
65
66 // If the user didn't gave a unit, the result will be on _info unit
67 virtual Unit unit() const { return _info ? (_unit.name().isEmpty() ? _info->unit() : _unit) : _unit; }
68
69 int resultId() const { return _id; }
70 UnitConverter* unitConverter() const { return _conv; }
71
72signals:
74 void infoChanged(int newSize);
75
76private:
78
83 int _id;
85};
86
87
88#endif
89
A class implementing the GmResultsDataSrcInfo interface, storing the metadata and id for a result dat...
Definition gmAttributeResultsDataSrc.h:41
virtual void setMonitorTrackId(int id)
Updates the data src's monitor track id.
Definition gmAttributeResultsDataSrc.h:52
const GmAttributeResultsDataSrcInfo * _info
The metadata info. Might be NULL for a while.
Definition gmAttributeResultsDataSrc.h:82
virtual int nlin() const
The number of lines in the returned result, taking into account any applied transformations or dim fi...
Definition gmAttributeResultsDataSrc.h:59
virtual QString formatStr() const
How should dataSrc values be formatted?
Definition gmAttributeResultsDataSrc.h:61
virtual QString description() const
Returns the data src description, when available.
Definition gmAttributeResultsDataSrc.h:57
UnitConverter * _conv
The unit converter, if necessary, from _info->unit() to _unit.
Definition gmAttributeResultsDataSrc.h:84
virtual int size() const
Returns the dimension of the data src values, taking into account any applied transformations or dim ...
Definition gmAttributeResultsDataSrc.h:58
virtual Unit unit() const
Returns the unit in which the data is expressed.
Definition gmAttributeResultsDataSrc.h:67
virtual GmResultsDataSrcType type() const
Returns the data src type.
Definition gmAttributeResultsDataSrc.h:55
int _id
The attribute id inside GmResultData when _info is not NULL. -1 when it is.
Definition gmAttributeResultsDataSrc.h:83
void infoChanged(int newSize)
Signal emited by setInfo() to publish that the attribute data src had its information "completed".
virtual int ncol() const
The number of columns in the returned result, taking into account any applied transformations or dim ...
Definition gmAttributeResultsDataSrc.h:60
virtual int monitorTrackId() const
Returns a numeric id for this data src (a value between 0 and the number of monitored data sources in...
Definition gmAttributeResultsDataSrc.h:54
virtual int attributeStats() const
Does this data src saves attribute statistics? A value > 0 defines the kind of stats.
Definition gmAttributeResultsDataSrc.h:64
QString _alias
The data src alias (needed while _info is NULL)
Definition gmAttributeResultsDataSrc.h:80
virtual QString alias() const
Returns the data src "exported" id.
Definition gmAttributeResultsDataSrc.h:56
Unit _unit
The exported unit. Might be different from _info->unit()
Definition gmAttributeResultsDataSrc.h:81
int _trackId
The numeric id for this data src (a value between 0 and the number of monitored data srcs in the mode...
Definition gmAttributeResultsDataSrc.h:79
A basic class used to store meta-data information about result attributes DEFINITIONS.
Definition gmAttributeResultsDataSrcInfo.h:32
A basic interface with the metadata common to all results data src types. This is the information tha...
Definition gmResultsDataSrcInfo.h:50
Declaration of the GmAttributeResultsDataSrcInfo class.
#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
GmResultsDataSrcType
The types of data sources stored by a rule.
Definition gmResultsDataSrcInfo.h:33
@ GM_RR_DS_ATTRIBUTE
Attribute data.
Definition gmResultsDataSrcInfo.h:34
Q_DISABLE_COPY(Class)