本文整理汇总了C++中OSArray::merge方法的典型用法代码示例。如果您正苦于以下问题:C++ OSArray::merge方法的具体用法?C++ OSArray::merge怎么用?C++ OSArray::merge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSArray
的用法示例。
在下文中一共展示了OSArray::merge方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _removeDrivers
static IOReturn _removeDrivers( OSArray * array, OSDictionary * matching )
{
OSCollectionIterator * tables;
OSDictionary * dict;
OSArray * arrayCopy;
IOReturn ret = kIOReturnSuccess;
// remove configs from catalog.
arrayCopy = OSArray::withCapacity(100);
if ( !arrayCopy )
return kIOReturnNoMemory;
tables = OSCollectionIterator::withCollection(arrayCopy);
arrayCopy->release();
if ( !tables )
return kIOReturnNoMemory;
arrayCopy->merge(array);
array->flushCollection();
tables->reset();
while ( (dict = (OSDictionary *)tables->getNextObject()) ) {
/* Remove from the catalogue's array any personalities
* that match the matching dictionary.
* This comparison must be done with only the keys in the
* "matching" dict to enable general matching.
*/
if ( dict->isEqualTo(matching, matching) )
continue;
array->setObject(dict);
}
tables->release();
return ret;
}
示例2: UniqueProperties
/*********************************************************************
* Remove drivers from the catalog which match the
* properties in the matching dictionary.
*********************************************************************/
bool
IOCatalogue::removeDrivers(
OSDictionary * matching,
bool doNubMatching)
{
OSCollectionIterator * tables;
OSDictionary * dict;
OSOrderedSet * set;
OSArray * arrayCopy;
if ( !matching )
return false;
set = OSOrderedSet::withCapacity(10,
IOServiceOrdering,
(void *)gIOProbeScoreKey);
if ( !set )
return false;
arrayCopy = OSArray::withCapacity(100);
if ( !arrayCopy ) {
set->release();
return false;
}
tables = OSCollectionIterator::withCollection(arrayCopy);
arrayCopy->release();
if ( !tables ) {
set->release();
return false;
}
UniqueProperties( matching );
IOLockLock(lock);
kernelTables->reset();
arrayCopy->merge(array);
array->flushCollection();
tables->reset();
while ( (dict = (OSDictionary *)tables->getNextObject()) ) {
/* This comparison must be done with only the keys in the
* "matching" dict to enable general searches.
*/
if ( dict->isEqualTo(matching, matching) ) {
AddNewImports( set, dict );
continue;
}
array->setObject(dict);
}
// Start device matching.
if ( doNubMatching && (set->getCount() > 0) ) {
IOService::catalogNewDrivers(set);
generation++;
}
IOLockUnlock(lock);
set->release();
tables->release();
return true;
}