libusermetrics

MetricManager.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of version 3 of the GNU Lesser General Public License as published
6 * by the Free Software Foundation.
7 *
8 * This library is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 * details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Pete Woods <pete.woods@canonical.com>
17 */
18
19 #ifndef USERMETRICSINPUT_METRICMANAGER_H_
20 #define USERMETRICSINPUT_METRICMANAGER_H_
21
22 #include <libusermetricsinput/Metric.h>
23
31 namespace UserMetricsInput {
32
33 class MetricManager;
34 class MetricParametersPrivate;
35
39 typedef QScopedPointer<MetricManager> MetricManagerPtr;
40
41 class Q_DECL_EXPORT MetricParameters {
42 public:
43
44 explicit MetricParameters(const QString &dataSourceId);
45
46 MetricParameters & formatString(const QString &formatString);
47
48 MetricParameters & emptyDataString(const QString &emptyDataString);
49
50 MetricParameters & textDomain(const QString &textDomain);
51
52 MetricParameters & minimum(double minimum);
53
54 MetricParameters & maximum(double maximum);
55
56 MetricParameters & type(MetricType type);
57
58 virtual ~MetricParameters();
59
60 QScopedPointer<MetricParametersPrivate> p;
61 };
62
69 class Q_DECL_EXPORT MetricManager: public QObject {
70 public:
74 explicit MetricManager(QObject *parent = 0);
75
79 virtual ~MetricManager();
80
86 static MetricManager * getInstance();
87
100 virtual MetricPtr add(const QString &dataSourceId,
101 const QString &formatString, const QString &emptyDataString = "",
102 const QString &textDomain = "") = 0;
103
113 virtual MetricPtr add(const MetricParameters &parameters) = 0;
114 };
115
138 }
139
144 #endif // USERMETRICSINPUT_METRICMANAGER_H_
UserMetricsInput
The user metrics input library namespace.
Definition: Metric.h:29
UserMetricsInput::MetricManager
Central place for registering and updating user metrics.
Definition: MetricManager.h:69
UserMetricsInput::MetricParameters::textDomain
MetricParameters & textDomain(const QString &textDomain)
UserMetricsInput::MetricParameters
Definition: MetricManager.h:41
UserMetricsInput::MetricParameters::minimum
MetricParameters & minimum(double minimum)
UserMetricsInput::MetricType
MetricType
Definition: Metric.h:38
UserMetricsInput::MetricParameters::formatString
MetricParameters & formatString(const QString &formatString)
Metric.h
UserMetricsInput::MetricParameters::maximum
MetricParameters & maximum(double maximum)
UserMetricsInput::MetricParameters::emptyDataString
MetricParameters & emptyDataString(const QString &emptyDataString)
UserMetricsInput::MetricManager::add
virtual MetricPtr add(const QString &dataSourceId, const QString &formatString, const QString &emptyDataString="", const QString &textDomain="")=0
Register a new Metric.
UserMetricsInput::MetricPtr
QSharedPointer< Metric > MetricPtr
Definition: Metric.h:31
UserMetricsInput::MetricManager::MetricManager
MetricManager(QObject *parent=0)
You cannot use this constructor. This is a pure-virtual class.
UserMetricsInput::MetricManager::~MetricManager
virtual ~MetricManager()
Destructs the metric manager and associated Metric instances.
UserMetricsInput::MetricManager::getInstance
static MetricManager * getInstance()
Gets a new instance of the MetricManager.
UserMetricsInput::MetricParameters::p
QScopedPointer< MetricParametersPrivate > p
Definition: MetricManager.h:60
UserMetricsInput::MetricParameters::type
MetricParameters & type(MetricType type)
UserMetricsInput::MetricParameters::~MetricParameters
virtual ~MetricParameters()
UserMetricsInput::MetricParameters::MetricParameters
MetricParameters(const QString &dataSourceId)
UserMetricsInput::MetricManager::add
virtual MetricPtr add(const MetricParameters &parameters)=0
Register a new Metric.
UserMetricsInput::MetricManagerPtr
QScopedPointer< MetricManager > MetricManagerPtr
Shared pointer for the MetricManager.
Definition: MetricManager.h:34