libusermetrics
Metric.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_METRIC_H_
20#define USERMETRICSINPUT_METRIC_H_
21
23#include <QtCore/QSharedPointer>
24
30
31class Metric;
32
36typedef QSharedPointer<Metric> MetricPtr;
37
41
50class Q_DECL_EXPORT Metric: public QObject {
51public:
55 explicit Metric(QObject *parent = 0);
56
60 virtual ~Metric();
61
71 virtual MetricUpdate * update(const QString &username = "") = 0;
72
80 virtual void update(double value, const QString &username = "") = 0;
81
89 virtual void increment(double amount = 1.0f,
90 const QString &username = "") = 0;
91};
92
93}
94
99#endif // USERMETRICSINPUT_METRIC_H_
An update to a Metric.
Definition MetricUpdate.h:44
This class represents a single user metric.
Definition Metric.h:50
virtual void increment(double amount=1.0f, const QString &username="")=0
Increment the "today" value for a simple user metric.
Metric(QObject *parent=0)
This constructor cannot be used - the class is pure-virtual.
virtual ~Metric()
Destructor.
virtual void update(double value, const QString &username="")=0
Update the "today" value for a simple user metric.
virtual MetricUpdate * update(const QString &username="")=0
Create an MetricUpdate to a particular Metric.
The user metrics input library namespace.
Definition Metric.h:29
MetricType
Definition Metric.h:38
@ SYSTEM
Definition Metric.h:39
@ USER
Definition Metric.h:39
QSharedPointer< Metric > MetricPtr
Definition Metric.h:36