usermetricsinput.h
Go to the documentation of this file.
/*
* Copyright (C) 2013 Canonical, Ltd.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of version 3 of the GNU Lesser General Public License as published
* by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Pete Woods <pete.woods@canonical.com>
*/
/*
* This file defines the C API of libusermetricsinput. If you can, it is strongly
* recommended to use the C++ API, MetricManager.h instead.
*/
#ifndef USERMETRICSINPUT_H_
#define USERMETRICSINPUT_H_
#ifdef USERMETRICSINPUT_METRICUPDATE_H_
#error "Mixing C and C++ public header includes. You can only use one or the other."
#endif
#include <libusermetricsinput/UserMetricsInputExport.h>
#ifdef __cplusplus
extern "C" {
#endif
enum USERMETRICSINPUT_METRICTYPE {
METRIC_TYPE_USER, METRIC_TYPE_SYSTEM
};
typedef void* UserMetricsInputMetricManager;
typedef void* UserMetricsInputMetricParameters;
typedef void* UserMetricsInputMetric;
typedef void* UserMetricsInputMetricUpdate;
USERMETRICSINPUT_EXPORT
UserMetricsInputMetricManager usermetricsinput_metricmanager_new();
USERMETRICSINPUT_EXPORT
void usermetricsinput_metricmanager_delete(
UserMetricsInputMetricManager metricManager);
USERMETRICSINPUT_EXPORT
UserMetricsInputMetricParameters usermetricsinput_metricparameters_new(
const char *dataSourceId);
USERMETRICSINPUT_EXPORT
void usermetricsinput_metricparameters_set_format_string(
UserMetricsInputMetricParameters metricParameter,
const char *formatString);
USERMETRICSINPUT_EXPORT
void usermetricsinput_metricparameters_set_empty_data_string(
UserMetricsInputMetricParameters metricParameter,
const char *emptyDataString);
USERMETRICSINPUT_EXPORT
void usermetricsinput_metricparameters_set_text_domain(
UserMetricsInputMetricParameters metricParameter,
const char *textDomain);
USERMETRICSINPUT_EXPORT
void usermetricsinput_metricparameters_set_minimum(
UserMetricsInputMetricParameters metricParameter, double minimum);
USERMETRICSINPUT_EXPORT
void usermetricsinput_metricparameters_set_maximum(
UserMetricsInputMetricParameters metricParameter, double maximum);
USERMETRICSINPUT_EXPORT
void usermetricsinput_metricparameters_set_type(
UserMetricsInputMetricParameters metricParameter,
USERMETRICSINPUT_METRICTYPE metricType);
USERMETRICSINPUT_EXPORT
void usermetricsinput_metricparameters_delete(
UserMetricsInputMetricParameters metricParameters);
USERMETRICSINPUT_EXPORT
UserMetricsInputMetric usermetricsinput_metricmanager_add(
UserMetricsInputMetricManager metricManager,
UserMetricsInputMetricParameters metricParameters);
USERMETRICSINPUT_EXPORT
void usermetricsinput_metric_increment(UserMetricsInputMetric metric,
double amount, const char *username);
USERMETRICSINPUT_EXPORT
void usermetricsinput_metric_update_today(UserMetricsInputMetric metric,
double value, const char *username);
USERMETRICSINPUT_EXPORT
UserMetricsInputMetricUpdate usermetricsinput_metric_update(
UserMetricsInputMetric metric, const char *username);
USERMETRICSINPUT_EXPORT
void usermetricsinput_metricupdate_delete(
UserMetricsInputMetricUpdate metricUpdate);
USERMETRICSINPUT_EXPORT
void usermetricsinput_metricupdate_add_data(
UserMetricsInputMetricUpdate metricUpdate, double data);
USERMETRICSINPUT_EXPORT
void usermetricsinput_metricupdate_add_null(
UserMetricsInputMetricUpdate metricUpdate);
#ifdef __cplusplus
}
#endif
#endif
usermetricsinput_metricparameters_set_minimum
USERMETRICSINPUT_EXPORT void usermetricsinput_metricparameters_set_minimum(UserMetricsInputMetricParameters metricParameter, double minimum)
Set the minimum display value for this metric.
usermetricsinput_metricparameters_delete
USERMETRICSINPUT_EXPORT void usermetricsinput_metricparameters_delete(UserMetricsInputMetricParameters metricParameters)
Free a UserMetricsInputMetricParameters.
usermetricsinput_metric_update
USERMETRICSINPUT_EXPORT UserMetricsInputMetricUpdate usermetricsinput_metric_update(UserMetricsInputMetric metric, const char *username)
Create an update to a particular metric.
usermetricsinput_metric_increment
USERMETRICSINPUT_EXPORT void usermetricsinput_metric_increment(UserMetricsInputMetric metric, double amount, const char *username)
Increment the "today" value for a simple user metric.
UserMetricsInputMetricManager
void * UserMetricsInputMetricManager
A central place for registering user metrics.
Definition: usermetricsinput.h:47
usermetricsinput_metricmanager_delete
USERMETRICSINPUT_EXPORT void usermetricsinput_metricmanager_delete(UserMetricsInputMetricManager metricManager)
Free a UserMetricsInputMetricManager.
usermetricsinput_metricparameters_new
USERMETRICSINPUT_EXPORT UserMetricsInputMetricParameters usermetricsinput_metricparameters_new(const char *dataSourceId)
Construct a new UserMetricsInputMetricParameters.
usermetricsinput_metricupdate_add_null
USERMETRICSINPUT_EXPORT void usermetricsinput_metricupdate_add_null(UserMetricsInputMetricUpdate metricUpdate)
Add unknown data to an update.
USERMETRICSINPUT_METRICTYPE
USERMETRICSINPUT_METRICTYPE
Definition: usermetricsinput.h:40
UserMetricsInputMetric
void * UserMetricsInputMetric
A single user metric, e.g. "number of e-mails today" or "photos taken today".
Definition: usermetricsinput.h:57
usermetricsinput_metricupdate_delete
USERMETRICSINPUT_EXPORT void usermetricsinput_metricupdate_delete(UserMetricsInputMetricUpdate metricUpdate)
Free a UserMetricsInputMetric.
usermetricsinput_metricparameters_set_text_domain
USERMETRICSINPUT_EXPORT void usermetricsinput_metricparameters_set_text_domain(UserMetricsInputMetricParameters metricParameter, const char *textDomain)
Set the translation domain.
usermetricsinput_metricupdate_add_data
USERMETRICSINPUT_EXPORT void usermetricsinput_metricupdate_add_data(UserMetricsInputMetricUpdate metricUpdate, double data)
Add data to a UserMetricsInputMetricUpdate.
UserMetricsInputMetricParameters
void * UserMetricsInputMetricParameters
Parameters for constructing a metric.
Definition: usermetricsinput.h:52
usermetricsinput_metricparameters_set_format_string
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_metricparameters_set_empty_data_string
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" ...
UserMetricsInputMetricUpdate
void * UserMetricsInputMetricUpdate
A update to a user metric for a particular user.
Definition: usermetricsinput.h:62
METRIC_TYPE_SYSTEM
Definition: usermetricsinput.h:41
usermetricsinput_metricparameters_set_type
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_metricmanager_new
USERMETRICSINPUT_EXPORT UserMetricsInputMetricManager usermetricsinput_metricmanager_new()
Construct a new UserMetricsInputMetricManager.
usermetricsinput_metric_update_today
USERMETRICSINPUT_EXPORT void usermetricsinput_metric_update_today(UserMetricsInputMetric metric, double value, const char *username)
Update the "today" value for a simple user metric.
usermetricsinput_metricmanager_add
USERMETRICSINPUT_EXPORT UserMetricsInputMetric usermetricsinput_metricmanager_add(UserMetricsInputMetricManager metricManager, UserMetricsInputMetricParameters metricParameters)
Register a new UserMetricsInputMetric.
METRIC_TYPE_USER
Definition: usermetricsinput.h:41
usermetricsinput_metricparameters_set_maximum
USERMETRICSINPUT_EXPORT void usermetricsinput_metricparameters_set_maximum(UserMetricsInputMetricParameters metricParameter, double maximum)
Set the maximum display value for this metric.