libusermetrics
UserMetricsInput::MetricManager Class Referenceabstract

Central place for registering and updating user metrics. More...

#include <libusermetricsinput/MetricManager.h>

+ Inheritance diagram for UserMetricsInput::MetricManager:

Public Member Functions

 MetricManager (QObject *parent=0)
 You cannot use this constructor. This is a pure-virtual class.
 
virtual ~MetricManager ()
 Destructs the metric manager and associated Metric instances.
 
virtual MetricPtr add (const QString &dataSourceId, const QString &formatString, const QString &emptyDataString="", const QString &textDomain="")=0
 Register a new Metric.
 
virtual MetricPtr add (const MetricParameters &parameters)=0
 Register a new Metric.
 

Static Public Member Functions

static MetricManagergetInstance ()
 Gets a new instance of the MetricManager.
 

Detailed Description

Central place for registering and updating user metrics.

This is a long-lived class that can exist for the whole application lifecycle.

Constructor & Destructor Documentation

◆ MetricManager()

UserMetricsInput::MetricManager::MetricManager ( QObject *  parent = 0)
explicit

You cannot use this constructor. This is a pure-virtual class.

◆ ~MetricManager()

virtual UserMetricsInput::MetricManager::~MetricManager ( )
virtual

Destructs the metric manager and associated Metric instances.

Member Function Documentation

◆ add() [1/2]

virtual MetricPtr UserMetricsInput::MetricManager::add ( const MetricParameters parameters)
pure virtual

Register a new Metric.

Parameters
parametersThe parameters of the Metric to register

This will register a new user Metric with the above parameters. It is acceptable to call this method more than once. The same Metric instance will be returned.

◆ add() [2/2]

virtual MetricPtr UserMetricsInput::MetricManager::add ( const QString &  dataSourceId,
const QString &  formatString,
const QString &  emptyDataString = "",
const QString &  textDomain = "" 
)
pure virtual

Register a new Metric.

Parameters
dataSourceIdThe unique ID of the data source, e.g. "facebook"
formatStringThe string to print in the output API, e.g. "<b>%1</b> messages received today"
emptyDataStringThe string to print in the case of no data, e.g. "No messages received today"
textDomainThe translation domain

This will register a new user Metric with the above parameters. It is acceptable to call this method more than once. The same Metric instance will be returned.

◆ getInstance()

static MetricManager * UserMetricsInput::MetricManager::getInstance ( )
static

Gets a new instance of the MetricManager.

If you want a singleton instance then hold onto this.


The documentation for this class was generated from the following file: