libusermetrics
usermetricsinput.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/*
20 * This file defines the C API of libusermetricsinput. If you can, it is strongly
21 * recommended to use the C++ API, MetricManager.h instead.
22 */
23
24#ifndef USERMETRICSINPUT_H_
25#define USERMETRICSINPUT_H_
26
27#ifdef USERMETRICSINPUT_METRICUPDATE_H_
28#error "Mixing C and C++ public header includes. You can only use one or the other."
29#endif
30
31#include <libusermetricsinput/UserMetricsInputExport.h>
32
33#ifdef __cplusplus
37extern "C" {
38#endif
39
43
48
53
58
63
69USERMETRICSINPUT_EXPORT
71
USERMETRICSINPUT_EXPORT
78 UserMetricsInputMetricManager metricManager);
86USERMETRICSINPUT_EXPORT
88 const char *dataSourceId);
89
96USERMETRICSINPUT_EXPORT
99 const char *formatString);
100
107USERMETRICSINPUT_EXPORT
109 UserMetricsInputMetricParameters metricParameter,
110 const char *emptyDataString);
111
118USERMETRICSINPUT_EXPORT
120 UserMetricsInputMetricParameters metricParameter,
121 const char *textDomain);
122
129USERMETRICSINPUT_EXPORT
131 UserMetricsInputMetricParameters metricParameter, double minimum);
132
139USERMETRICSINPUT_EXPORT
141 UserMetricsInputMetricParameters metricParameter, double maximum);
142
149USERMETRICSINPUT_EXPORT
151 UserMetricsInputMetricParameters metricParameter,
152 USERMETRICSINPUT_METRICTYPE metricType);
153
159USERMETRICSINPUT_EXPORT
161 UserMetricsInputMetricParameters metricParameters);
162
171USERMETRICSINPUT_EXPORT
173 UserMetricsInputMetricManager metricManager,
174 UserMetricsInputMetricParameters metricParameters);
175
183USERMETRICSINPUT_EXPORT
185 double amount, const char *username);
186
194USERMETRICSINPUT_EXPORT
196 double value, const char *username);
206USERMETRICSINPUT_EXPORT
208 UserMetricsInputMetric metric, const char *username);
209
217USERMETRICSINPUT_EXPORT
219 UserMetricsInputMetricUpdate metricUpdate);
220
231USERMETRICSINPUT_EXPORT
233 UserMetricsInputMetricUpdate metricUpdate, double data);
234
242USERMETRICSINPUT_EXPORT
244 UserMetricsInputMetricUpdate metricUpdate);
245
269#ifdef __cplusplus
270}
274#endif
275
276#endif
USERMETRICSINPUT_EXPORT void usermetricsinput_metricparameters_set_format_string(UserMetricsInputMetricParameters metricParameter, const char *formatString)
Set the string to print in the output API, e.g. "<b>%1</b> messages received today".
USERMETRICSINPUT_EXPORT UserMetricsInputMetric usermetricsinput_metricmanager_add(UserMetricsInputMetricManager metricManager, UserMetricsInputMetricParameters metricParameters)
Register a new UserMetricsInputMetric.
USERMETRICSINPUT_EXPORT void usermetricsinput_metricparameters_delete(UserMetricsInputMetricParameters metricParameters)
Free a UserMetricsInputMetricParameters.
void * UserMetricsInputMetric
A single user metric, e.g. "number of e-mails today" or "photos taken today".
Definition usermetricsinput.h:57
USERMETRICSINPUT_EXPORT void usermetricsinput_metricupdate_add_null(UserMetricsInputMetricUpdate metricUpdate)
Add unknown data to an update.
void * UserMetricsInputMetricParameters
Parameters for constructing a metric.
Definition usermetricsinput.h:52
USERMETRICSINPUT_EXPORT void usermetricsinput_metric_increment(UserMetricsInputMetric metric, double amount, const char *username)
Increment the "today" value for a simple user metric.
USERMETRICSINPUT_EXPORT void usermetricsinput_metricparameters_set_type(UserMetricsInputMetricParameters metricParameter, USERMETRICSINPUT_METRICTYPE metricType)
Set the type of metric this is (user owned or system owned)
USERMETRICSINPUT_EXPORT UserMetricsInputMetricUpdate usermetricsinput_metric_update(UserMetricsInputMetric metric, const char *username)
Create an update to a particular metric.
USERMETRICSINPUT_EXPORT void usermetricsinput_metricparameters_set_minimum(UserMetricsInputMetricParameters metricParameter, double minimum)
Set the minimum display value for this metric.
USERMETRICSINPUT_EXPORT void usermetricsinput_metricparameters_set_maximum(UserMetricsInputMetricParameters metricParameter, double maximum)
Set the maximum display value for this metric.
USERMETRICSINPUT_EXPORT void usermetricsinput_metricmanager_delete(UserMetricsInputMetricManager metricManager)
Free a UserMetricsInputMetricManager.
void * UserMetricsInputMetricManager
A central place for registering user metrics.
Definition usermetricsinput.h:47
USERMETRICSINPUT_EXPORT void usermetricsinput_metricupdate_add_data(UserMetricsInputMetricUpdate metricUpdate, double data)
Add data to a UserMetricsInputMetricUpdate.
USERMETRICSINPUT_METRICTYPE
Definition usermetricsinput.h:40
@ METRIC_TYPE_USER
Definition usermetricsinput.h:41
@ METRIC_TYPE_SYSTEM
Definition usermetricsinput.h:41
void * UserMetricsInputMetricUpdate
A update to a user metric for a particular user.
Definition usermetricsinput.h:62
USERMETRICSINPUT_EXPORT void usermetricsinput_metricupdate_delete(UserMetricsInputMetricUpdate metricUpdate)
Free a UserMetricsInputMetric.
USERMETRICSINPUT_EXPORT void usermetricsinput_metric_update_today(UserMetricsInputMetric metric, double value, const char *username)
Update the "today" value for a simple user metric.
USERMETRICSINPUT_EXPORT void usermetricsinput_metricparameters_set_text_domain(UserMetricsInputMetricParameters metricParameter, const char *textDomain)
Set the translation domain.
USERMETRICSINPUT_EXPORT void usermetricsinput_metricparameters_set_empty_data_string(UserMetricsInputMetricParameters metricParameter, const char *emptyDataString)
set the string to print in the case of no data, e.g. "No messages received today"
USERMETRICSINPUT_EXPORT UserMetricsInputMetricParameters usermetricsinput_metricparameters_new(const char *dataSourceId)
Construct a new UserMetricsInputMetricParameters.
USERMETRICSINPUT_EXPORT UserMetricsInputMetricManager usermetricsinput_metricmanager_new()
Construct a new UserMetricsInputMetricManager.