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


C++ Ports::end方法代码示例

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


在下文中一共展示了Ports::end方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: unreportComponent

bool Logger::unreportComponent( const std::string& component ) {
    TaskContext* comp = this->getPeer(component);
    if (!comp)
    {
        log(Error) << "no such component " << component << endlog();
        return false;
    }

    Ports ports   = comp->ports()->getPorts();
    for (Ports::iterator it = ports.begin(); it != ports.end() ; ++it) {
        this->unreportPort(component, (*it)->getName());
    }
    return true;
}
开发者ID:goldhoorn,项目名称:tools-logger,代码行数:14,代码来源:Logger.cpp

示例2: reportComponent

bool Logger::reportComponent( const std::string& component ) {
    // Users may add own data sources, so avoid duplicates
    //std::vector<std::string> sources                = comp->data()->getNames();
    TaskContext* comp = this->getPeer(component);
    if ( !comp )
    {
        log(Error) << "no such component " << component << endlog();
        return false;
    }

    Ports ports   = comp->ports()->getPorts();
    for (Ports::iterator it = ports.begin(); it != ports.end() ; ++it)
        this->reportPort( component, (*it)->getName() );
    return true;
}
开发者ID:goldhoorn,项目名称:tools-logger,代码行数:15,代码来源:Logger.cpp

示例3: door

// Updates our Door list based on settings.
void
ServerImpl::on_update ()
{
    /*
    if (! m_strand.running_in_this_thread())
        io_service_.dispatch (m_strand.wrap (std::bind (
            &ServerImpl::update, this)));
    */

    if (! stopping())
    {
        // Make a local copy to shorten the lock
        //
        Ports ports;
        {
            std::lock_guard <std::mutex> lock (mutex_);
            ports = state_.ports;
        }

        std::sort (ports.begin(), ports.end());

        // Walk the Door list and the Port list simultaneously and
        // build a replacement Door vector which we will then swap in.
        //
        Doors doors;
        Doors::iterator door (m_doors.begin());
        for (Ports::const_iterator port (ports.begin());
            port != ports.end(); ++port)
        {
            int comp = 0;

            while (door != m_doors.end() &&
                    ((comp = compare (*port, (*door)->port())) > 0))
            {
                (*door)->cancel();
                ++door;
            }

            if (door != m_doors.end())
            {
                if (comp < 0)
                {
                    doors.push_back (std::make_shared <Door> (
                        io_service_, *this, *port));
                    doors.back()->listen();
                }
                else
                {
                    // old Port and new Port are the same
                    doors.push_back (*door);
                    ++door;
                }
            }
            else
            {
                doors.push_back (std::make_shared <Door> (
                    io_service_, *this, *port));
                doors.back()->listen();
            }
        }

        // Any remaining Door objects are not in the new set, so cancel them.
        //
        for (;door != m_doors.end();)
            (*door)->cancel();

        m_doors.swap (doors);
    }
    else
    {
        // Cancel pending I/O on all doors.
        //
        for (Doors::iterator iter (m_doors.begin());
            iter != m_doors.end(); ++iter)
        {
            (*iter)->cancel();
        }

        // Remove our references to the old doors.
        //
        m_doors.resize (0);
    }
}
开发者ID:619213152,项目名称:vpal20,代码行数:84,代码来源:ServerImpl.cpp


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