本文整理汇总了C++中Ports::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Ports::begin方法的具体用法?C++ Ports::begin怎么用?C++ Ports::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ports
的用法示例。
在下文中一共展示了Ports::begin方法的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;
}
示例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;
}
示例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);
}
}