Class Collector

Inheritance Relationships

Base Type

Derived Type

Class Documentation

class Collector : public libstatistics_collector::collector::MetricDetailsInterface

Simple class in order to collect observed data and generate statistics for the given observations.

Subclassed by libstatistics_collector::topic_statistics_collector::TopicStatisticsCollector< T >

Public Functions

Collector() = default
virtual ~Collector() = default
virtual void AcceptData(const double measurement)

Add an observed measurement. This aggregates the measurement and calculates statistics via the moving_average class.

Parameters

measurement – the measurement observed

virtual moving_average_statistics::StatisticData GetStatisticsResults() const

Return the statistics for all of the observed data.

Returns

the StatisticData for all the observed measurements

virtual void ClearCurrentMeasurements()

Clear / reset all current measurements.

bool IsStarted() const

Return true is start has been called, false otherwise.

Returns

the started state of this collector

virtual std::string GetStatusString() const

Return a pretty printed status representation of this class

Returns

a string detailing the current status

virtual bool Start()

Start collecting data. Meant to be called after construction. Note: this locks the recursive mutex class member ‘mutex’. This method is public in order for the caller to manually manage starting and stopping this collector.

Returns

true if started, false if an error occurred

virtual bool Stop()

Stop collecting data. Meant to be a teardown method (before destruction, but should place the class in a restartable state, i.e., start can be called to be able to resume collection. This method is public in order for the caller to manually manage starting and stopping this collector.

This calls ClearCurrentMeasurements.

Returns

true if stopped, false if an error occurred