本文整理汇总了C++中Sequence::addFallingEdge方法的典型用法代码示例。如果您正苦于以下问题:C++ Sequence::addFallingEdge方法的具体用法?C++ Sequence::addFallingEdge怎么用?C++ Sequence::addFallingEdge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sequence
的用法示例。
在下文中一共展示了Sequence::addFallingEdge方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Sequence::Sequence(const Sequence &other,int round)
{
Sequence sq;
rounding = round;
int resolution = rounding;
if (verbose) std::cout << "Creating new Sequence with coarsness of " << resolution << " samples" << std::endl;
int current_edge_count = (int) other.edges.size();
int new_total = 0, total = 0;
for (std::map<double,int>::const_iterator it=other.edges.begin();it!=other.edges.end();it++)
{
total = new_total;
if (verbose) std::cout << (*it).first << " : " << (*it).second << " new_total = " << new_total << std::endl;
new_total = total + (*it).second;
if (( new_total > 0 ) && ( total <= 0 )) sq.addRisingEdge( round_down((*it).first,resolution) );
if (( new_total <= 0 ) && ( total > 0 )) sq.addFallingEdge( round_up((*it).first,resolution) );
}
edges.swap(sq.edges);
if (verbose) std::cout << "flatten() changed from " << current_edge_count << " to " << edges.size() << " edges." << std::endl;
}
示例2: flatten
void Sequence::flatten()
{
Sequence sq;
int current_edge_count = (int) edges.size();
int new_total = 0, total = 0;
for (std::map<double,int>::iterator it=edges.begin();it!=edges.end();it++)
{
total = new_total;
if (verbose) std::cout << (*it).first << " : " << (*it).second << " new_total = " << new_total << std::endl;
new_total = total + (*it).second;
if (( new_total > 0 ) && ( total <= 0 )) { if (verbose) { std::cout << "Rise" << std::endl; } sq.addRisingEdge((*it).first); continue; }
if (( new_total <= 0 ) && ( total > 0 )) { if (verbose) { std::cout << "Fall" << std::endl; } sq.addFallingEdge((*it).first); continue; }
}
edges.swap(sq.edges);
if (verbose) std::cout << "flatten() changed from " << current_edge_count << " to " << edges.size() << " edges." << std::endl;
}