/** Everything is stocked in a vector * \param *imgInt : l'image intégrale * \param *lPC : la liste de points clefs à passer en adresse */ listDescriptor* getDescriptor(imageIntegral* imgInt,listKeyPoints* lPC) { listDescriptor* lD=new listDescriptor(); for(int i=0;i<lPC->size();i++) lD->push_back(makeDescriptor(imgInt, (*lPC)[i])); delete imgInt; return lD; }
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; } } } }
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); } } } } }