51 m_regex =
"^L inf\\w* error\\s*(?:\\(variable "
52 "(\\w+)\\))?\\s*:\\s*([+-]?\\d.+\\d|-?\\d|[+-]?nan|[+-]?inf).*";
55 TiXmlElement *value = metric->FirstChildElement(
"value");
63 ASSERTL0(value->Attribute(
"tolerance"),
64 "Missing tolerance in L2 metric");
68 if (value->Attribute(
"variable"))
70 var.
m_value = value->Attribute(
"variable");
76 val.
m_tolerance = atof(value->Attribute(
"tolerance"));
80 std::vector<MetricRegexFieldValue> tmp(2);
90 value = value->NextSiblingElement(
"value");
105 for (
int i = 0; i <
m_matches.size(); ++i)
108 "Wrong number of matches for regular expression.");
112 TiXmlElement *value =
new TiXmlElement(
"value");
116 std::map<std::string, std::string>::iterator it =
127 value->SetAttribute(
"variable",
m_matches[i][0].m_value);
129 if (
m_matches[i][0].m_value ==
"p" && !tolSet)
138 value->SetAttribute(
"tolerance", tol);
139 value->LinkEndChild(
new TiXmlText(
m_matches[i][1].m_value));
#define ASSERTL0(condition, msg)
std::string RegisterCreatorFunction(std::string key, CreatorFunction func)
TiXmlElement * m_metric
Pointer to XML structure containing metric definition.
bool m_generate
Determines whether to generate this metric or not.
static std::string defaultTolerance
void v_Generate(std::istream &pStdout, std::istream &pStderr) override
Virtual function to generate the metric. Should be redefined in derived classes.
MetricLInf(TiXmlElement *metric, bool generate)
static MetricSharedPtr create(TiXmlElement *metric, bool generate)
std::map< std::string, std::string > m_varTolerance
void v_Generate(std::istream &pStdout, std::istream &pStderr) override
Test output against a regex expression and set of matches.
std::vector< std::vector< MetricRegexFieldValue > > m_matches
Stores the multiple matches defined in each <MATCH> tag.
std::regex m_regex
Storage for the boost regex.
bool EmptyString(const char *s)
Check to see whether the given string s is empty (or null).
MetricFactory & GetMetricFactory()
Data structure for a Regex value to match.