50 #ifndef ZOLTAN2_BASEMETRICVALUES_HPP
51 #define ZOLTAN2_BASEMETRICVALUES_HPP
55 #define UNKNOWN_METRICS_TYPE_NAME "UnknownMetricClass" // Unknown would be error
56 #define METRICS_UNSET_STRING "unset"
61 template <
typename scalar_t>
66 void 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);
73 std::string metricName_;
78 ArrayRCP<scalar_t> values_;
83 scalar_t
getValue(
int enumIndex)
const {
return values_[enumIndex]; }
86 void setValue(
int enumIndex, scalar_t value) { values_[enumIndex] = value; }
97 metricName_(mname), values_() {
98 resetValues(memCount);
104 resetValues(memCount);
126 const std::string &
getName()
const {
return metricName_; }
129 void 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();
183 template <
typename scalar_t>
190 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