本文整理汇总了C++中Mapping::find方法的典型用法代码示例。如果您正苦于以下问题:C++ Mapping::find方法的具体用法?C++ Mapping::find怎么用?C++ Mapping::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mapping
的用法示例。
在下文中一共展示了Mapping::find方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CBLOGERR
/**
take in a configuration xml document and a system
context and initialize the transport
*/
int
RpcHttpClientTransport::init(
const DOMNode* config,
RefCountedPtr<SysContext>& ctx )
{
REFCOUNTED_CAST(iSysComponent, StdLogger, ctx->getComponent( StdLogger::getRegistryName()), _logger);
ASSERT_D(_logger != NULL);
// parsing for proxy server
if ( config->getNodeType() == DOMNode::ELEMENT_NODE )
{
const DOMElement* configElem = (const DOMElement*)config;
// look for the listening port setting
String val;
Mapping attrs;
DOMNodeList* 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"));
}
}
}
return 0;
}
示例2: restoreProperties
void EditableSceneBodyImpl::restoreProperties(const Archive& archive)
{
Listing& states = *archive["editableSceneBodies"].toListing();
for(int i=0; i < states.size(); ++i){
Mapping* state = states[i].toMapping();
BodyItem* bodyItem = archive.findItem<BodyItem>(state->find("bodyItem"));
if(bodyItem){
EditableSceneBodyImpl* impl = bodyItem->sceneBody()->impl;
impl->showCenterOfMass(state->get("showCenterOfMass", impl->isCmVisible));
impl->showZmp(state->get("showZmp", impl->isZmpVisible));
}
}
}
示例3: maxPosition
bool NVMeshMender::MungeD3DX( const NVMeshMender::VAVector& input,
NVMeshMender::VAVector& output,
const float bSmoothCreaseAngleRadians,
const float* pTextureMatrix,
const Option _FixTangents,
const Option _FixCylindricalTexGen,
const Option _WeightNormalsByFaceSize )
{
typedef std::map< std::string, unsigned int > Mapping;
typedef std::set< Edge > EdgeSet;
typedef std::vector< std::set< unsigned int > > IdenticalVertices;
IdenticalVertices IdenticalVertices_;
Mapping inmap;
Mapping outmap;
for ( unsigned int a = 0; a < input.size(); ++a )
{
inmap[ input[ a ].Name_ ] = a;
}
for ( unsigned int b = 0; b < output.size(); ++b )
{
output[ b ].intVector_.clear();
output[ b ].floatVector_.clear();
outmap[ output[ b ].Name_ ] = b;
}
for ( unsigned int c = 0; c < output.size(); ++c )
{
// for every output that has a match in the input, just copy it over
Mapping::iterator in = inmap.find( output[ c ].Name_ );
if ( in != inmap.end() )
{
// copy over existing indices, position, or whatever
output[ c ] = input[ (*in).second ];
}
}
Mapping::iterator want = outmap.find( "indices" );
Mapping::iterator have = inmap.find( "indices" );
if ( have == inmap.end() )
{
SetLastError( "Missing indices from input" );
return false;
}
if ( want == outmap.end() )
{
SetLastError( "Missing indices from output" );
return false;
}
// Go through all required outputs & generate as necessary
want = outmap.find( "position" );
have = inmap.find( "position" );
if ( have == inmap.end() )
{
SetLastError( "Missing position from input" );
return false;
}
if ( want == outmap.end() )
{
SetLastError( "Missing position from output" );
return false;
}
Mapping::iterator pos = outmap.find( "position" );
VertexAttribute::FloatVector& positions = output[ (*pos).second ].floatVector_;
D3DXVECTOR3* pPositions = (D3DXVECTOR3*)( &( positions[ 0 ] ) );
std::set< unsigned int > EmptySet;
for ( unsigned int i = 0; i < positions.size(); i += 3 )
{
IdenticalVertices_.push_back( EmptySet );
}
// initialize all attributes
for ( unsigned int att = 0; att < output.size(); ++att )
{
if ( output[ att ].Name_ != "indices" )
{
if ( output[ att ].floatVector_.size() == 0 )
{
output[ att ].floatVector_ = positions;
}
}
}
Mapping::iterator ind = outmap.find( "indices" );
VertexAttribute::IntVector& indices = output[ (*ind).second ].intVector_;
int* pIndices = (int*)( &( indices[ 0 ] ) );
D3DXVECTOR3* pNormals = 0;
D3DXVECTOR3* pBiNormals = 0;
D3DXVECTOR3* pTangents = 0;
D3DXVECTOR3* pTex0 = 0;
//.........这里部分代码省略.........
示例4: 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 );
//.........这里部分代码省略.........