本文整理汇总了C++中DeviceDescriptor::fuzzyCompareType方法的典型用法代码示例。如果您正苦于以下问题:C++ DeviceDescriptor::fuzzyCompareType方法的具体用法?C++ DeviceDescriptor::fuzzyCompareType怎么用?C++ DeviceDescriptor::fuzzyCompareType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeviceDescriptor
的用法示例。
在下文中一共展示了DeviceDescriptor::fuzzyCompareType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: devicePlugged
void Manager::devicePlugged( DeviceDescriptor * physicalDevice )
{
bool matchedExisting = false;
Index * existing = findIndexWithPhysicalDevice(physicalDevice);
if( existing ) return;
//look for matching deviceless index
for( tIndices::iterator i = mIndices.begin(); i != mIndices.end() ; i++ )
{
Index * index = * i;
if( !index->getPhysicalDevice() )
{
DeviceDescriptor * dd = index->recallDevice();
if( dd && dd->fuzzyCompareType( physicalDevice ) )
{
index->setPhysicalDevice( physicalDevice );
index->forgetDevice();
matchedExisting = true;
BOOST_LOG_TRIVIAL(trace) << "Reconnected physical device (" << physicalDevice->getVendorProductCombo() << ") to Player [" << index->getPlayer() << "] with existing index \"" << index->getName() << "\"" << std::endl;
}
}
}
if( !matchedExisting )
{
//build look for matching index delcaration and create an index
for( ast::hidCollapseList::iterator d = indexDefinitions.begin();
d != indexDefinitions.end() ;
d++ )
{
//build a comparable device descriptor ot compare with the ones
//generated by the operating system specific code
DeviceDescriptor declaredDevice = boost::apply_visitor( makeDescriptor() , d->device );
if( declaredDevice.fuzzyCompareType( physicalDevice ) > DeviceDescriptor::MATCH_THRESHOLD )
{
//build an index for this device
//element mapping occurrs at an OS-aware level
//so let the implementaiton of createIndex and createElements handle that
Index * newIndex = new Index( this, d->entries , d->index );
newIndex->setPhysicalDevice( physicalDevice );
mIndices.push_back( newIndex );
putInNextAvailablePlayerSlot( newIndex );
return;
}
}
}
}
示例2: buildIndices
void Manager::buildIndices()
{
/*
BOOST_LOG_TRIVIAL(trace) << "Initially available physical devices: " << std::endl;
if( mPhysicalDevices.size() == 0 )
BOOST_LOG_TRIVIAL(trace) << "\t No physical devices." << std::endl;
for( tPhysicalDevices::iterator i= mPhysicalDevices.begin() ;
i!= mPhysicalDevices.end() ;
i++ )
{
DeviceDescriptor * dd = *i;
BOOST_LOG_TRIVIAL(trace) << "\t" << dd->getVendorProductCombo() << std::endl;
}
*/
for( ast::hidCollapseList::iterator d = indexDefinitions.begin();
d != indexDefinitions.end() ;
d++ )
{
//build a comparable device descriptor ot compare with the ones
//generated by the operating system specific code
DeviceDescriptor declaredDevice = boost::apply_visitor( makeDescriptor() , d->device );
for( tPhysicalDevices::iterator i= mPhysicalDevices.begin() ;
i!= mPhysicalDevices.end() ;
i++ )
{
DeviceDescriptor * physicalDevice = *i;
Index * existing = findIndexWithPhysicalDevice( physicalDevice );
if( !existing )
{
if( declaredDevice.fuzzyCompareType( physicalDevice ) > DeviceDescriptor::MATCH_THRESHOLD )
{
//build an index for this device
//element mapping occurrs at an OS-aware level
//so let the implementaiton of createIndex and createElements handle that
Index * newIndex = new Index( this, d->entries , d->index );
newIndex->setPhysicalDevice( physicalDevice );
mIndices.push_back( newIndex );
putInNextAvailablePlayerSlot(newIndex);
}
}
}
}
}