50#ifndef ZOLTAN2_BASEMETRICVALUES_HPP
51#define ZOLTAN2_BASEMETRICVALUES_HPP
55#define UNKNOWN_METRICS_TYPE_NAME "UnknownMetricClass"
56#define METRICS_UNSET_STRING "unset"
61template <
typename scalar_t>
66void resetValues(
int memCount ){
67 scalar_t *tmp =
new scalar_t [memCount];
68 memset(tmp, 0,
sizeof(scalar_t) * memCount);
69 values_ = arcp(tmp, 0, memCount,
true);
73std::string metricName_;
78ArrayRCP<scalar_t> values_;
83scalar_t
getValue(
int enumIndex)
const {
return values_[enumIndex]; }
86void setValue(
int enumIndex, scalar_t value) { values_[enumIndex] = value; }
97 metricName_(mname), values_() {
98 resetValues(memCount);
104 resetValues(memCount);
126const std::string &
getName()
const {
return metricName_; }
129void setName(std::string name) { metricName_ = name;}
142 return values_[metricIndex];
150 values_[metricIndex] = value;
156 const std::vector<std::string> & metricNames =
getMetrics();
157 size_t metricIndex = std::find(metricNames.begin(), metricNames.end(),
158 metric_name) - metricNames.begin();
183template <
typename scalar_t>
190template <
typename scalar_t>
#define METRICS_UNSET_STRING
#define UNKNOWN_METRICS_TYPE_NAME
Gathering definitions used in software development.
virtual ~BaseClassMetrics()
void setMetricValue(const std::string &metric_name, scalar_t value) const
bool hasMetricValue(const std::string &metric_name) const
virtual const std::vector< std::string > & getMetrics() const
virtual void printLine(std::ostream &os) const
BaseClassMetrics(int memCount)
Constructor.
static std::vector< std::string > static_allMetricNames_
void setName(std::string name)
Set or reset the name.
void setValue(int enumIndex, scalar_t value)
size_t convertMetricNameToIndex(const std::string &metric_name) const
BaseClassMetrics(int memCount, std::string mname)
Constructor.
scalar_t getValue(int enumIndex) const
virtual const std::string & getMetricType() const
Get the class type of the metric.
scalar_t getMetricValue(const std::string &metric_name) const
static std::vector< std::string > static_metricNames_
BaseClassMetrics()
Constructor - for compiling but not used.
static std::string static_unknown_metricTypeName_
const std::string & getName() const
Get the name of the item measured.
Created by mbenlioglu on Aug 31, 2020.