本文整理汇总了C++中Port::connections方法的典型用法代码示例。如果您正苦于以下问题:C++ Port::connections方法的具体用法?C++ Port::connections怎么用?C++ Port::connections使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Port
的用法示例。
在下文中一共展示了Port::connections方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeConnections
//! remove all connections to and from ports to a module
void PortManager::removeConnections(const int moduleID) {
typedef std::map<std::string, Port *> PortMap;
typedef std::map<int, PortMap *> ModulePortMap;
ModulePortMap::const_iterator mports = m_ports.find(moduleID);
if (mports == m_ports.end())
return;
const PortMap &portmap = *mports->second;
for(PortMap::const_iterator it = portmap.begin();
it != portmap.end();
++it) {
Port *port = it->second;
const Port::PortSet &cl = port->connections();
while (!cl.empty()) {
size_t oldsize = cl.size();
const Port *other = *cl.begin();
removeConnection(port, other);
removeConnection(other, port);
message::Disconnect d1(port->getModuleID(), port->getName(), other->getModuleID(), other->getName());
m_clusterManager->sendAll(d1);
m_clusterManager->sendUi(d1);
message::Disconnect d2(other->getModuleID(), other->getName(), port->getModuleID(), port->getName());
m_clusterManager->sendAll(d2);
m_clusterManager->sendUi(d2);
if (cl.size() == oldsize) {
std::cerr << "failed to remove all connections for module " << moduleID << ", still left: " << cl.size() << std::endl;
for (size_t i=0; i<cl.size(); ++i) {
std::cerr << " " << port->getModuleID() << ":" << port->getName() << " <--> " << other->getModuleID() << ":" << other->getName() << std::endl;
}
break;
}
}
}
}