本文整理汇总了C++中Mapping::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Mapping::clear方法的具体用法?C++ Mapping::clear怎么用?C++ Mapping::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mapping
的用法示例。
在下文中一共展示了Mapping::clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CBLOGERR
/**
take in a configuration xml document and a system
context and initialize the transport
*/
int
RpcHttpTransport::init(
const DOMNode* config,
RefCountedPtr<SysContext>& ctx,
iRpcServer* masterServer)
{
int res = -1;
ASSERT_D(status() == keRpcNoState);
REFCOUNTED_CAST(iSysComponent, StdLogger, ctx->getComponent( StdLogger::getRegistryName()), _logger);
RefCountedPtr<ThdPool> pool;
REFCOUNTED_CAST(iSysComponent, ThdPool, ctx->getComponent( ThdPool::getRegistryName()), pool);
ASSERT_D(pool != NULL);
// inititalize socket environment
if (( config != NULL ) && ( config->getNodeType() == DOMNode::ELEMENT_NODE ))
{
const DOMElement* configElem = (const DOMElement*)config;
String val;
Mapping attrs;
// first configure the server attributes
DOMNodeList* nodes = DomUtils::getNodeList( configElem, RPC_LISTEN_PORT );
if ( DomUtils::getNodeValue( (const DOMElement*)nodes->item( 0 ), &val, &attrs ) )
{
Mapping::const_iterator it = attrs.find( RPC_BACKLOG_ATTR );
if( it != attrs.end() )
{
_port = StringUtils::toInt( val );
_backlog = StringUtils::toInt( (*it).second );
}
else
{
CBLOGERR(_logger,
NTEXT("RpcHttpClientTransport::init: can't find attributes to server listener, using defaults"));
}
}
// now configure the client attributes
attrs.clear();
nodes = DomUtils::getNodeList( configElem, RPC_PROXY_NAME );
if ( DomUtils::getNodeValue( (const DOMElement*)nodes->item( 0 ), &val, &attrs ) )
{
Mapping::const_iterator it = attrs.find( RPC_PROXY_PORTATTR );
if( it != attrs.end() )
{
_proxy = val;
_proxyPort = StringUtils::toInt( (*it).second );
}
else
{
CBLOGERR(_logger,
NTEXT("RpcHttpClientTransport::init: can't find attributes to configure Proxy Port"));
}
}
attrs.clear();
nodes = DomUtils::getNodeList( configElem, RPC_CLIENT_RETRIES );
if ( DomUtils::getNodeValue( (const DOMElement*)nodes->item( 0 ), &val, &attrs ) )
{
Mapping::const_iterator it = attrs.find( RPC_CLIENT_TOATTR );
if( it != attrs.end() )
{
_retries = StringUtils::toInt( val );
_sleepInterval = StringUtils::toInt( (*it).second );
}
else
{
CBLOGERR(_logger,
NTEXT("RpcHttpClientTransport::init: can't find attributes to configure client communications parameters"));
}
}
// setup the rpc address for this server
String address;
address = Net::getHostName();
address += COLON;
address += StringUtils::toString( _port );
_transportAddress.setTransport( RPC_HTTP_NAME );
_transportAddress.setAddress( address );
// all is well set the initial state
res = 0;
_state = keRpcInitted;
}
if ( res == 0 )
{
RefCountedPtr<MyThdFn> wfn(new MyThdFn( *this, &RpcHttpTransport::myWorkerFunction ));
pool->add( 1, (RefCountedPtr<iRunnable> &)wfn );
//.........这里部分代码省略.........