gmon.out bla bla

This commit is contained in:
Janik Schlemminger
2014-04-07 20:09:38 +02:00
4 changed files with 97 additions and 2 deletions

View File

@@ -3,6 +3,7 @@
#include <tlm.h>
using namespace std;
using namespace tinyxml2;
void reportFatal(std::string sender, std::string message)
{
@@ -17,3 +18,75 @@ std::string phaseNameToString(tlm::tlm_phase phase)
std::string str = oss.str();
return str;
}
unsigned int queryIntParameter(XMLElement* node, string name) {
int result;
XMLElement* element;
for (element = node->FirstChildElement("parameter"); element != NULL;
element = element->NextSiblingElement("parameter"))
{
if (element->Attribute("id") == name)
{
assert(!strcmp(element->Attribute("type"), "uint"));
XMLError error = element->QueryIntAttribute("value", &result);
assert(!error);
return result;
}
}
std::cout << "error: " + name + " element not found" << endl;
return 0;
}
double queryDoubleParameter(XMLElement* node, string name) {
double result;
XMLElement* element;
for (element = node->FirstChildElement("parameter"); element != NULL;
element = element->NextSiblingElement("parameter"))
{
if (element->Attribute("id") == name)
{
assert(!strcmp(element->Attribute("type"), "double"));
XMLError error = element->QueryDoubleAttribute("value", &result);
assert(!error);
return result;
}
}
std::cout << "error: " + name + " element not found" << endl;
return 0;
}
bool queryBoolParameter(XMLElement* node, string name) {
bool result;
XMLElement* element;
for (element = node->FirstChildElement("parameter"); element != NULL;
element = element->NextSiblingElement("parameter"))
{
if (element->Attribute("id") == name)
{
assert(!strcmp(element->Attribute("type"), "double"));
XMLError error = element->QueryBoolAttribute("value", &result);
assert(!error);
return result;
}
}
std::cout << "error: " + name + " element not found" << endl;
return 0;
}
string queryStringParameter(XMLElement* node, string name) {
XMLElement* element;
for (element = node->FirstChildElement("parameter"); element != NULL;
element = element->NextSiblingElement("parameter"))
{
if (element->Attribute("id") == name)
{
return element->Attribute("value");
}
}
std::cout << "error: element not found" << endl;
return 0;
}