当前位置: 首页>>代码示例>>C++>>正文


C++ Sequence::addRisingEdge方法代码示例

本文整理汇总了C++中Sequence::addRisingEdge方法的典型用法代码示例。如果您正苦于以下问题:C++ Sequence::addRisingEdge方法的具体用法?C++ Sequence::addRisingEdge怎么用?C++ Sequence::addRisingEdge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sequence的用法示例。


在下文中一共展示了Sequence::addRisingEdge方法的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;
}
开发者ID:rgeorge1,项目名称:PulseProgrammer,代码行数:29,代码来源:Sequence.cpp

示例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;
}
开发者ID:rgeorge1,项目名称:PulseProgrammer,代码行数:23,代码来源:Sequence.cpp


注:本文中的Sequence::addRisingEdge方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。