本文整理汇总了C++中jccl::ConfigElementPtr::getChildElements方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigElementPtr::getChildElements方法的具体用法?C++ ConfigElementPtr::getChildElements怎么用?C++ ConfigElementPtr::getChildElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jccl::ConfigElementPtr
的用法示例。
在下文中一共展示了ConfigElementPtr::getChildElements方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: configAdd
bool AbstractNetworkManager::configAdd(jccl::ConfigElementPtr element)
{
if (recognizeClusterMachineConfig(element))
{
// -If local machine element
// -Add machine specific ConfigElements to the pending list.
// -Start Listening thread
// -Else
// -Add Node to AbstractNetworkManager
if (isLocalHost( element->getProperty<std::string>( "host_name" ) ))
{
// XXX: Hack to ensure that we don't start listening for connections until
// we have fully configured all other nodes.
ElementPred pred(getClusterNodeElementType());
jccl::ConfigManager* cfg_mgr = jccl::ConfigManager::instance();
unsigned int num_pending_nodes =
std::count_if(cfg_mgr->getPendingBegin(), cfg_mgr->getPendingEnd(), pred);
if (num_pending_nodes > 1)
{
vprDEBUG( gadgetDBG_NET_MGR, vprDBG_CONFIG_LVL ) << clrSetBOLD(clrRED)
<< clrOutBOLD( clrMAGENTA,"[AbstractNetworkManager]" )
<< " Some nodes not configured yet: " << num_pending_nodes
<< clrRESET << std::endl << vprDEBUG_FLUSH;
return false;
}
// NOTE: Add all machine dependent ConfigElementPtr's here
vprASSERT( element->getNum("display_system") == 1
&& "A Cluster System element must have exactly 1 display_system element" );
std::vector<jccl::ConfigElementPtr> cluster_node_elements =
element->getChildElements();
for (std::vector<jccl::ConfigElementPtr>::iterator i = cluster_node_elements.begin();
i != cluster_node_elements.end();
++i)
{
jccl::ConfigManager::instance()->addConfigElement(*i, jccl::ConfigManager::PendingElement::ADD);
vprDEBUG( gadgetDBG_NET_MGR, vprDBG_CONFIG_LVL ) << clrSetBOLD(clrCYAN)
<< clrOutBOLD( clrMAGENTA,"[AbstractNetworkManager]" )
<< " Adding Machine specific ConfigElement: "
<< (*i)->getName() << clrRESET << std::endl << vprDEBUG_FLUSH;
}
const int listen_port = element->getProperty<int>( "listen_port" );
startListening( listen_port, false );
}
else
{
vprDEBUG( gadgetDBG_NET_MGR, vprDBG_CONFIG_LVL )
<< clrOutBOLD( clrMAGENTA, "[AbstractNetworkManager]" )
<< " Adding Node: " << element->getName()
<< " to the Cluster Network\n" << vprDEBUG_FLUSH;
std::string name = element->getName();
std::string host_name = element->getProperty<std::string>( "host_name" );
vpr::Uint16 listen_port = element->getProperty<int>( "listen_port" );
addNode(name, host_name, listen_port);
}
return true;
}
return false;
}