14 #ifndef ZOLTAN2_BASEMETRICVALUES_HPP
15 #define ZOLTAN2_BASEMETRICVALUES_HPP
19 #define UNKNOWN_METRICS_TYPE_NAME "UnknownMetricClass" // Unknown would be error
20 #define METRICS_UNSET_STRING "unset"
25 template <
typename scalar_t>
30 void resetValues(
int memCount ){
31 scalar_t *tmp =
new scalar_t [memCount];
32 memset(tmp, 0,
sizeof(scalar_t) * memCount);
33 values_ = arcp(tmp, 0, memCount,
true);
37 std::string metricName_;
42 ArrayRCP<scalar_t> values_;
47 scalar_t
getValue(
int enumIndex)
const {
return values_[enumIndex]; }
50 void setValue(
int enumIndex, scalar_t value) { values_[enumIndex] = value; }
61 metricName_(mname), values_() {
62 resetValues(memCount);
68 resetValues(memCount);
82 virtual const std::vector<std::string> &
getMetrics()
const
90 const std::string &
getName()
const {
return metricName_; }
93 void setName(std::string name) { metricName_ = name;}
106 return values_[metricIndex];
114 values_[metricIndex] = value;
120 const std::vector<std::string> & metricNames =
getMetrics();
121 size_t metricIndex = std::find(metricNames.begin(), metricNames.end(),
122 metric_name) - metricNames.begin();
147 template <
typename scalar_t>
154 template <
typename scalar_t>
virtual const std::string & getMetricType() const
Get the class type of the metric.
static std::vector< std::string > static_metricNames_
virtual void printLine(std::ostream &os) const
static std::string static_unknown_metricTypeName_
size_t convertMetricNameToIndex(const std::string &metric_name) const
BaseClassMetrics(int memCount, std::string mname)
Constructor.
void setName(std::string name)
Set or reset the name.
scalar_t getMetricValue(const std::string &metric_name) const
virtual const std::vector< std::string > & getMetrics() const
void setMetricValue(const std::string &metric_name, scalar_t value) const
void setValue(int enumIndex, scalar_t value)
BaseClassMetrics()
Constructor - for compiling but not used.
scalar_t getValue(int enumIndex) const
static std::vector< std::string > static_allMetricNames_
#define UNKNOWN_METRICS_TYPE_NAME
bool hasMetricValue(const std::string &metric_name) const
virtual ~BaseClassMetrics()
Gathering definitions used in software development.
const std::string & getName() const
Get the name of the item measured.
BaseClassMetrics(int memCount)
Constructor.
#define METRICS_UNSET_STRING