[#BloombergLP-balm-Collector]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balm.adoc[balm]::Collector
:relfileprefix: ../../
:mrdocs:

This class provides a mechanism for collecting and aggregating the value of a metric over a period of time&period; The collector contains a `MetricRecord` object that holds the identity of the metric being collected, the number of times an event occurred, and the total, minimum, and maximum aggregates of the associated measurement value&period; The default value for the count is 0, the default value for the total is 0&period;0, the default minimum value is `MetricRecord&colon;&colon;k&lowbar;DEFAULT&lowbar;MIN`, and the default maximum value is `MetricRecord&colon;&colon;k&lowbar;DEFAULT&lowbar;MAX`&period;

== Synopsis

Declared in `&lt;balm&lowbar;collector&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class Collector;
----

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/balm/Collector/2constructor.adoc[`Collector`]         [.small]#[constructor]#
| Create a collector for a metric having the specified `metricId`, and having an initial count of 0, total of 0&period;0, min of `MetricRecord&colon;&colon;k&lowbar;DEFAULT&lowbar;MIN`, and max of `MetricRecord&colon;&colon;k&lowbar;DEFAULT&lowbar;MAX`&period;
| xref:BloombergLP/balm/Collector/2destructor.adoc[`&#126;Collector`] [.small]#[destructor]#
| Destroy this object&period;
| xref:BloombergLP/balm/Collector/accumulateCountTotalMinMax.adoc[`accumulateCountTotalMinMax`] 
| Increment the event count by the specified `count`, add the specified `total` to the accumulated total, if specified `min` is less than the minimum value, set `min` to be the minimum value, and if specified `max` is greater than the maximum value, set `max` to be the maximum value&period;
| xref:BloombergLP/balm/Collector/load.adoc[`load`] 
| Load into the specified `record` the id of the metric being collected, as well as the current count, total, minimum, and maximum aggregated values for the metric&period;
| xref:BloombergLP/balm/Collector/loadAndReset.adoc[`loadAndReset`] 
| Load into the specified `record` the id of the metric being collected as well as the current count, total, minimum, and maximum aggregated values for that metric&semi; then reset the count, total, minimum, and maximum values to their default states&period; After this operation, the count and total values will be 0, the minimum value will be `MetricRecord&colon;&colon;k&lowbar;DEFAULT&lowbar;MIN`, and the maximum value will be `MetricRecord&colon;&colon;k&lowbar;DEFAULT&lowbar;MAX`&period; Note that this operation is logically equivalent to calling the `load` and then the `reset` methods except that it is performed as a single atomic operation&period;
| xref:BloombergLP/balm/Collector/metricId.adoc[`metricId`] 
| Return a reference to the non&hyphen;modifiable `MetricId` object identifying the metric for which this object collects values&period;
| xref:BloombergLP/balm/Collector/reset.adoc[`reset`] 
| Reset the count, total, minimum, and maximum values of the metric being collected to their default states&period; After this operation, the count and total values will be 0, the minimum value will be `MetricRecord&colon;&colon;k&lowbar;DEFAULT&lowbar;MIN`, and the maximum value will be `MetricRecord&colon;&colon;k&lowbar;DEFAULT&lowbar;MAX`&period;
| xref:BloombergLP/balm/Collector/setCountTotalMinMax.adoc[`setCountTotalMinMax`] 
| Set the event count to the specified `count`, the total aggregate to the specified `total`, the minimum aggregate to the specified `min` and the maximum aggregate to the specified `max`&period;
| xref:BloombergLP/balm/Collector/update.adoc[`update`] 
| Increment the event count by 1, add the specified `value` to the total, if `value` is less than the minimum value, set `value` to be the minimum value, and if `value` is greater than the maximum value, set `value` to be the maximum value&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
