本文整理汇总了C++中EventData::setTimescale方法的典型用法代码示例。如果您正苦于以下问题:C++ EventData::setTimescale方法的具体用法?C++ EventData::setTimescale怎么用?C++ EventData::setTimescale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventData
的用法示例。
在下文中一共展示了EventData::setTimescale方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: expand
void Transform::expand( CycleData& cyData, EventData& evData,
map< string, WaveformTable>& wftMap,
vector<string> pinList, double timescale) {
assert( timescale >= 0.0);
assert( timescale <= 1.0);
if(timescale == 0.0) {
//
// Calculate timescale
//
vector<double> res;
map<string, WaveformTable>::iterator iter;
for(iter = wftMap.begin(); iter != wftMap.end(); iter++) {
res.push_back( iter->second.getEventResolution());
}
double minRes = *(min_element( res.begin(), res.end()));
double exponent = ceil( log10(1/minRes));
timescale = pow( 10.0, -exponent);
//applog.debug << "Calculating timescale : " << timescale << endl;
//applog.debug << "minRes = " << minRes << " exponent = " << exponent << endl;
assert( timescale >= 0.0);
assert( timescale <= 1.0);
}
//if(debug)
//cyData.print( applog.debug);
SignalHeader signalHeader = cyData.getSignalHeader();
vector<string> pinNames;
for(unsigned int i=0; i < signalHeader.size(); i++) {
pinNames.push_back( signalHeader[i].name);
}
evData.setSignalHeader( signalHeader);
unsigned long numVectors = cyData.getNumVectors();
unsigned long long periodBeginTimestamp = 0;
unsigned long loopSum = 0;
for(unsigned long vecNum=0; vecNum < numVectors; vecNum++) {
CycleData::PeriodData periodData;
cyData.getPeriodData( periodData, vecNum);
// periodData.print( applog.debug);
WaveformTable wft = wftMap[periodData.wftRef];
double period = wft.period.value;
// Need my_round due to fractional error
unsigned long long periodTimestamp = (unsigned long long) my_round(period/timescale);
EventData periodEventData;
getEventData( periodData, wft, periodEventData, pinNames, timescale);
// periodEventData.print( applog.debug);
for(unsigned int i=0; i <= periodData.loopCount; i++) {
// append event data
//applog.debug << "Adding events at timestamp " << periodBeginTimestamp << endl;
evData.add( periodEventData, periodBeginTimestamp);
// periodBeginTimestamp = (unsigned long long) (((vecNum + 1 + loopSum + i)*period)/timescale);
periodBeginTimestamp = (unsigned long long) ((vecNum + 1 + loopSum + i)*periodTimestamp);
}
loopSum += periodData.loopCount;
}
evData.setTimescale( timescale);
}