swh:1:snp:5c81b35c32cd128e955f4da753d99c09557a4451
Tip revision: 7e149916f56918f135b5259c3fb0b3f7119f8d07 authored by Lonca Emmanuel on 24 March 2021, 14:04:19 UTC
bumped version number to 3.0.3-dev
bumped version number to 3.0.3-dev
Tip revision: 7e14991
DefaultStatMap.cc
#include "DefaultStatMap.h"
using namespace CoQuiAAS;
DefaultStatMap::DefaultStatMap(){}
void DefaultStatMap::setStat(std::string name, std::string value) {
stats[name] = value;
}
void DefaultStatMap::setStat(std::string name, int value) {
std::ostringstream converter;
converter << value;
stats[name] = converter.str();
}
void DefaultStatMap::setStat(std::string name, double value) {
std::ostringstream converter;
converter << value;
stats[name] = converter.str();
}
void DefaultStatMap::incCounterStat(std::string name, int value) {
std::ostringstream converter;
int newValue = value + (stats.find(name) == stats.end()) ? (0) : (atoi(stats[name].c_str()));
converter << newValue;
stats[name] = converter.str();
}
void DefaultStatMap::printStats(FILE *outputFile) {
std::map<std::string,std::string>::iterator it;
for(it = stats.begin(); it != stats.end(); ++it) {
fprintf(outputFile, "c %s: %s\n", it->first.c_str(), it->second.c_str());
}
}
DefaultStatMap::~DefaultStatMap() {}