12#ifndef SST_CORE_STATAPI_STATUNIQUECOUNT_H
13#define SST_CORE_STATAPI_STATUNIQUECOUNT_H
15#include "sst/core/sst_types.h"
16#include "sst/core/statapi/statbase.h"
17#include "sst/core/warnmacros.h"
35 SST_ELI_DECLARE_STATISTIC_TEMPLATE(
38 "UniqueCountStatistic",
39 SST_ELI_ELEMENT_VERSION(1, 0, 0),
40 "Track unique occurrences of statistic",
44 BaseComponent* comp,
const std::string& statName,
const std::string& statSubId,
Params& statParams) :
61 void clearStatisticData()
override { uniqueSet.clear(); }
63 void registerOutputFields(StatisticFieldsOutput* statOutput)
override
65 uniqueCountField = statOutput->registerField<uint64_t>(
"UniqueItems");
68 void outputStatisticFields(StatisticFieldsOutput* statOutput,
bool UNUSED(EndOfSimFlag))
override
70 statOutput->outputField(uniqueCountField, (uint64_t)uniqueSet.size());
74 std::set<T> uniqueSet;
75 StatisticOutput::fieldHandle_t uniqueCountField;
Main component object for the simulation.
Definition: baseComponent.h:51
Parameter store.
Definition: params.h:56
void setStatisticTypeName(const char *typeName)
Set an optional Statistic Type Name.
Definition: statbase.h:213
Forms the template defined base class for statistics gathering within SST.
Definition: statbase.h:361
Creates a Statistic which counts unique values provided to it.
Definition: statuniquecount.h:33
void addData_impl(T data) override
Present a new value to the Statistic to be included in the unique set.
Definition: statuniquecount.h:58