本文整理汇总了C++中EventType::isReal方法的典型用法代码示例。如果您正苦于以下问题:C++ EventType::isReal方法的具体用法?C++ EventType::isReal怎么用?C++ EventType::isReal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventType
的用法示例。
在下文中一共展示了EventType::isReal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addKnownDerivedTypes
int EventTypeSet::addKnownDerivedTypes()
{
int addCount = 0;
int addDiff, i;
int knownCount = EventType::knownTypeCount();
while (1) {
addDiff = 0;
for (i=0; i<knownCount; i++) {
EventType* t = EventType::knownType(i);
if (t->isReal()) continue;
if (index(t->name()) != ProfileCostArray::InvalidIndex) continue;
t->setEventTypeSet(this);
if (t->parseFormula()) {
addDiff++;
add(new EventType(t->name(), t->longName(), t->formula()));
}
t->setEventTypeSet(0);
}
if (addDiff == 0) break;
addCount += addDiff;
}
return addCount;
}
示例2: parseFormula
// checks for existing types and sets coefficients
bool EventType::parseFormula()
{
if (_parsed) return true;
if (_inParsing) {
qDebug("TraceEventType::parseFormula: Recursion detected.");
return false;
}
if (!_set) {
qDebug("TraceEventType::parseFormula: Container of this event type unknown!");
return false;
}
_inParsing = true;
for (int i=0; i<ProfileCostArray::MaxRealIndex;i++)
_coefficient[i] = 0;
QRegExp rx( "((?:\\+|\\-)?)\\s*(\\d*)\\s*\\*?\\s*(\\w+)" );
int factor, pos;
QString costName;
EventType* eventType;
pos = 0;
while (1) {
pos = rx.search(_formula, pos);
if (pos<0) break;
pos += rx.matchedLength();
if (rx.cap(0).isEmpty()) break;
//qDebug("parseFormula: matched '%s','%s','%s'",
// qPrintable(rx.cap(1)), qPrintable(rx.cap(2)), qPrintable(rx.cap(3)));
costName = rx.cap(3);
eventType = _set->type(costName);
if (!eventType) {
// qDebug("Cost type '%s': In formula cost '%s' unknown.",
// qPrintable(_name), qPrintable(costName));
_inParsing = false;
return false;
}
factor = (rx.cap(2).isEmpty()) ? 1 : rx.cap(2).toInt();
if (rx.cap(1) == "-") factor = -factor;
if (eventType->isReal())
_coefficient[eventType->realIndex()] += factor;
else {
eventType->parseFormula();
for (int i=0; i<ProfileCostArray::MaxRealIndex;i++)
_coefficient[i] += factor * eventType->_coefficient[i];
}
}
_inParsing = false;
_parsed = true;
return true;
}