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
34 
37 extern "C" {
38 #endif
39 
42 };
43 
48 
53 
57 typedef void* UserMetricsInputMetric;
58 
63 
69 USERMETRICSINPUT_EXPORT
70 UserMetricsInputMetricManager usermetricsinput_metricmanager_new();
71 USERMETRICSINPUT_EXPORT
78  UserMetricsInputMetricManager metricManager);
86 USERMETRICSINPUT_EXPORT
87 UserMetricsInputMetricParameters usermetricsinput_metricparameters_new(
88  const char *dataSourceId);
89 
96 USERMETRICSINPUT_EXPORT
98  UserMetricsInputMetricParameters metricParameter,
99  const char *formatString);
100 
107 USERMETRICSINPUT_EXPORT
109  UserMetricsInputMetricParameters metricParameter,
110  const char *emptyDataString);
111 
118 USERMETRICSINPUT_EXPORT
120  UserMetricsInputMetricParameters metricParameter,
121  const char *textDomain);
122 
129 USERMETRICSINPUT_EXPORT
131  UserMetricsInputMetricParameters metricParameter, double minimum);
132 
139 USERMETRICSINPUT_EXPORT
141  UserMetricsInputMetricParameters metricParameter, double maximum);
142 
149 USERMETRICSINPUT_EXPORT
151  UserMetricsInputMetricParameters metricParameter,
152  USERMETRICSINPUT_METRICTYPE metricType);
153 
159 USERMETRICSINPUT_EXPORT
161  UserMetricsInputMetricParameters metricParameters);
162 
171 USERMETRICSINPUT_EXPORT
172 UserMetricsInputMetric usermetricsinput_metricmanager_add(
173  UserMetricsInputMetricManager metricManager,
174  UserMetricsInputMetricParameters metricParameters);
175 
183 USERMETRICSINPUT_EXPORT
184 void usermetricsinput_metric_increment(UserMetricsInputMetric metric,
185  double amount, const char *username);
186 
194 USERMETRICSINPUT_EXPORT
195 void usermetricsinput_metric_update_today(UserMetricsInputMetric metric,
196  double value, const char *username);
206 USERMETRICSINPUT_EXPORT
207 UserMetricsInputMetricUpdate usermetricsinput_metric_update(
208  UserMetricsInputMetric metric, const char *username);
209 
217 USERMETRICSINPUT_EXPORT
219  UserMetricsInputMetricUpdate metricUpdate);
220 
231 USERMETRICSINPUT_EXPORT
233  UserMetricsInputMetricUpdate metricUpdate, double data);
234 
242 USERMETRICSINPUT_EXPORT
244  UserMetricsInputMetricUpdate metricUpdate);
245 
269 #ifdef __cplusplus
270 }
274 #endif
275 
276 #endif