本文整理汇总了C++中OSCollectionIterator::release方法的典型用法代码示例。如果您正苦于以下问题:C++ OSCollectionIterator::release方法的具体用法?C++ OSCollectionIterator::release怎么用?C++ OSCollectionIterator::release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSCollectionIterator
的用法示例。
在下文中一共展示了OSCollectionIterator::release方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: merge
// Returns true on success, false on an error condition.
bool OSDictionary::merge(const OSDictionary *srcDict)
{
const OSSymbol * sym;
OSCollectionIterator * iter;
if ( !OSDynamicCast(OSDictionary, srcDict) )
return false;
iter = OSCollectionIterator::withCollection(const_cast<OSDictionary *>(srcDict));
if ( !iter )
return false;
while ( (sym = (const OSSymbol *)iter->getNextObject()) ) {
const OSMetaClassBase * obj;
obj = srcDict->getObject(sym);
if ( !setObject(sym, obj) ) {
iter->release();
return false;
}
}
iter->release();
return true;
}
示例2: publishBelow
void ARMIO::publishBelow( IORegistryEntry * root )
{
OSCollectionIterator * kids;
IORegistryEntry * next;
IOService * nub;
// infanticide
kids = IODTFindMatchingEntries( root, kIODTRecursive, deleteList() );
if( kids) {
while( (next = (IORegistryEntry *)kids->getNextObject())) {
next->detachAll( gIODTPlane);
}
kids->release();
}
// publish everything below, minus excludeList
kids = IODTFindMatchingEntries( root, kIODTRecursive | kIODTExclusive,
excludeList());
if( kids) {
while( (next = (IORegistryEntry *)kids->getNextObject())) {
if( 0 == (nub = createNub( next )))
continue;
nub->attach( this );
processNub(nub);
nub->registerService();
}
kids->release();
}
}
示例3: removeElement
void IOHIDEventQueue::removeElement( IOHIDElementPrivate * element )
{
OSCollectionIterator * iterator;
IOHIDElementPrivate * temp;
UInt32 size = 0;
UInt32 maxSize = DEFAULT_HID_ENTRY_SIZE;
if ( !element || !_elementSet || !_elementSet->containsObject( element ))
return;
_elementSet->removeObject( element );
if ( NULL != (iterator = OSCollectionIterator::withCollection(_elementSet)) )
{
while ( NULL != (temp = (IOHIDElementPrivate *)iterator->getNextObject()) )
{
size = temp->getElementValueSize() + sizeof(void *);
if ( maxSize < size )
maxSize = size;
}
iterator->release();
}
_maxEntrySize = maxSize;
}
示例4: IOLockLock
/* static */
void
OSMetaClass::printInstanceCounts()
{
OSCollectionIterator * classes;
OSSymbol * className;
OSMetaClass * meta;
IOLockLock(sAllClassesLock);
classes = OSCollectionIterator::withCollection(sAllClassesDict);
assert(classes);
while( (className = (OSSymbol *)classes->getNextObject())) {
meta = (OSMetaClass *)sAllClassesDict->getObject(className);
assert(meta);
printf("%24s count: %03d x 0x%03x = 0x%06x\n",
className->getCStringNoCopy(),
meta->getInstanceCount(),
meta->getClassSize(),
meta->getInstanceCount() * meta->getClassSize() );
}
printf("\n");
classes->release();
IOLockUnlock(sAllClassesLock);
return;
}
示例5: valueExists
bool IOAudioSelectorControl::valueExists(SInt32 selectionValue)
{
bool found = false;
OSCollectionIterator *iterator;
assert(availableSelections);
iterator = OSCollectionIterator::withCollection(availableSelections);
if (iterator) {
OSDictionary *selection;
while ( (selection = (OSDictionary *)iterator->getNextObject()) ) {
OSNumber *sValue;
sValue = (OSNumber *)selection->getObject(kIOAudioSelectorControlSelectionValueKey);
if (sValue && ((SInt32)sValue->unsigned32BitValue() == selectionValue)) {
found = true;
break;
}
}
iterator->release();
}
return found;
}
示例6: reportModInstances
void OSMetaClass::reportModInstances(const char *kmodName)
{
OSSet *kmodClasses;
OSCollectionIterator *iter;
OSMetaClass *checkClass;
kmodClasses = OSDynamicCast(OSSet,
sKModClassesDict->getObject(kmodName));
if (!kmodClasses)
return;
iter = OSCollectionIterator::withCollection(kmodClasses);
if (!iter)
return;
while ( (checkClass = (OSMetaClass *) iter->getNextObject()) )
if (checkClass->getInstanceCount()) {
printf("%s: %s has %d instance(s)\n",
kmodName,
checkClass->getClassName(),
checkClass->getInstanceCount());
}
iter->release();
}
示例7: deactivateAudioControls
void IOAudioPort::deactivateAudioControls()
{
OSCollectionIterator *iterator;
if (!audioControls) {
return;
}
iterator = OSCollectionIterator::withCollection(audioControls);
if (iterator) {
IOAudioControl *control;
while ( (control = (IOAudioControl *)iterator->getNextObject()) ) {
// Should we check to see if we're the provider?
if (!isInactive()) {
control->terminate();
}
}
iterator->release();
}
audioControls->flushCollection();
}
示例8: OSDynamicCast
void
IOFireWireUserClientIniter::mergeProperties( IORegistryEntry * dest, OSDictionary * src )
{
//IOLog( "IOFireWireUserClientIniter<0x%08lx>::mergeProperties - dest = 0x%08lx, src = 0x%08lx\n", this, dest, src );
if( !dest || !src )
return;
OSCollectionIterator* srcIterator = OSCollectionIterator::withCollection( src );
OSSymbol* keyObject = NULL;
OSObject* destObject = NULL;
OSObject* srcObject = NULL;
while( NULL != (keyObject = OSDynamicCast(OSSymbol, srcIterator->getNextObject())) )
{
srcObject = src->getObject(keyObject);
destObject = dest->getProperty(keyObject);
OSDictionary * destDictionary = OSDynamicCast( OSDictionary, destObject );
OSDictionary * srcDictionary = OSDynamicCast( OSDictionary, srcObject );
if( destDictionary && srcDictionary )
{
// if there's already already a property defined in the destination
// and the source and destination are dictionaries, we need to do
// a recursive merge
// shallow copy the destination directory
destDictionary = OSDictionary::withDictionary( destDictionary );
// recurse
mergeDictionaries( destDictionary, srcDictionary );
// set the property
dest->setProperty( keyObject, destDictionary );
destDictionary->release();
}
else
{
// if the property is not already in destination dictionary
// or both source a destination are not dictionaries
// then we can set the property without merging
// any dictionaries in the source should already
// have been deep copied before we began merging
dest->setProperty( keyObject, srcObject );
}
}
// have to release this, or we'll leak.
srcIterator->release();
//IOLog( "IOFireWireUserClientIniter<0x%08lx>::mergeProperties - return\n", this );
}
示例9: IORWLockWrite
/*********************************************************************
* Remove drivers from the catalog which match the
* properties in the matching dictionary.
*********************************************************************/
bool
IOCatalogue::removeDrivers(
OSDictionary * matching,
bool doNubMatching)
{
OSOrderedSet * set;
OSCollectionIterator * iter;
OSDictionary * dict;
OSArray * array;
const OSSymbol * key;
unsigned int idx;
if ( !matching )
return false;
set = OSOrderedSet::withCapacity(10,
IOServiceOrdering,
(void *)gIOProbeScoreKey);
if ( !set )
return false;
iter = OSCollectionIterator::withCollection(personalities);
if (!iter)
{
set->release();
return (false);
}
IORWLockWrite(lock);
while ((key = (const OSSymbol *) iter->getNextObject()))
{
array = (OSArray *) personalities->getObject(key);
if (array) for (idx = 0; (dict = (OSDictionary *) array->getObject(idx)); idx++)
{
/* This comparison must be done with only the keys in the
* "matching" dict to enable general searches.
*/
if ( dict->isEqualTo(matching, matching) ) {
set->setObject(dict);
array->removeObject(idx);
idx--;
}
}
// Start device matching.
if ( doNubMatching && (set->getCount() > 0) ) {
IOService::catalogNewDrivers(set);
generation++;
}
}
IORWLockUnlock(lock);
set->release();
iter->release();
return true;
}
示例10: OSDynamicCast
void
PAEngine::sendNotification(UInt32 notificationType, UInt32 value)
{
OSCollectionIterator *iter = OSCollectionIterator::withCollection(virtualDeviceArray);
PAVirtualDevice *dev;
while ((dev = OSDynamicCast(PAVirtualDevice, iter->getNextObject())))
dev->sendNotification(notificationType, value);
iter->release();
}
示例11:
OSCollectionIterator *
OSCollectionIterator::withCollection(const OSCollection *inColl)
{
OSCollectionIterator *me = new OSCollectionIterator;
if (me && !me->initWithCollection(inColl)) {
me->release();
return 0;
}
return me;
}
示例12: mergeDictionaryIntoDictionary
bool IOHIDUserClientIniter::mergeDictionaryIntoDictionary(OSDictionary * parentSourceDictionary, OSDictionary * parentTargetDictionary)
{
OSCollectionIterator* srcIterator = NULL;
OSSymbol* keyObject = NULL;
bool result = false;
if (!parentSourceDictionary || !parentTargetDictionary)
return false ;
// Get our source dictionary
//
srcIterator = OSCollectionIterator::withCollection(parentSourceDictionary);
while (NULL != (keyObject = OSDynamicCast(OSSymbol, srcIterator->getNextObject()))) {
OSDictionary * childSourceDictionary = NULL;
OSDictionary * childTargetDictionary = NULL;
OSObject * childTargetObject = NULL;
// Check to see if our destination already has the same entry.
//
childTargetObject = parentTargetDictionary->getObject(keyObject);
if ( childTargetObject )
childTargetDictionary = OSDynamicCast(OSDictionary, childTargetObject);
// See if our source entry is also a dictionary
//
childSourceDictionary = OSDynamicCast(OSDictionary, parentSourceDictionary->getObject(keyObject));
if ( childTargetDictionary && childSourceDictionary) {
// Our destination dictionary already has the entry for this same object AND our
// source is also a dcitionary, so we need to recursively add it.
//
result = mergeDictionaryIntoDictionary(childSourceDictionary, childTargetDictionary) ;
if ( !result )
break;
} else {
// We have a property that we need to merge into our parent dictionary.
//
result = parentTargetDictionary->setObject(keyObject, parentSourceDictionary->getObject(keyObject)) ;
if ( !result )
break;
}
}
srcIterator->release();
return result;
}
示例13: replaceAvailableSelection
IOReturn IOAudioSelectorControl::replaceAvailableSelection(SInt32 selectionValue, OSString *selectionDescription)
{
OSCollectionIterator *iterator;
OSArray *newSelections;
OSArray *oldAvailableSelections;
IOReturn result = kIOReturnSuccess;
assert(availableSelections);
oldAvailableSelections = availableSelections;
newSelections = OSArray::withArray(availableSelections);
if (!newSelections)
return kIOReturnNoMemory;
iterator = OSCollectionIterator::withCollection(newSelections);
if (iterator) {
OSDictionary * selection;
UInt32 index;
index = 0;
while ( (selection = (OSDictionary *)iterator->getNextObject() )) {
OSNumber * sValue;
sValue = (OSNumber *)selection->getObject(kIOAudioSelectorControlSelectionValueKey);
if (sValue && ((SInt32)sValue->unsigned32BitValue() == selectionValue)) {
// Replace the selected dictionary in the array
newSelections->replaceObject(index, selectionDescription);
result = kIOReturnSuccess;
break;
}
index++;
}
availableSelections = newSelections;
setProperty(kIOAudioSelectorControlAvailableSelectionsKey, availableSelections);
oldAvailableSelections->release();
iterator->release();
}
if (kIOReturnSuccess == result) {
sendChangeNotification(kIOAudioControlRangeChangeNotification);
}
return result;
}
示例14: IORWLockRead
/*********************************************************************
* Is personality already in the catalog?
*********************************************************************/
OSOrderedSet *
IOCatalogue::findDrivers(
OSDictionary * matching,
SInt32 * generationCount)
{
OSCollectionIterator * iter;
OSDictionary * dict;
OSOrderedSet * set;
OSArray * array;
const OSSymbol * key;
unsigned int idx;
OSKext::uniquePersonalityProperties(matching);
set = OSOrderedSet::withCapacity( 1, IOServiceOrdering,
(void *)gIOProbeScoreKey );
if (!set) return (0);
iter = OSCollectionIterator::withCollection(personalities);
if (!iter)
{
set->release();
return (0);
}
IORWLockRead(lock);
while ((key = (const OSSymbol *) iter->getNextObject()))
{
array = (OSArray *) personalities->getObject(key);
if (array) for (idx = 0; (dict = (OSDictionary *) array->getObject(idx)); idx++)
{
/* This comparison must be done with only the keys in the
* "matching" dict to enable general searches.
*/
if ( dict->isEqualTo(matching, matching) )
set->setObject(dict);
}
}
*generationCount = getGenerationCount();
IORWLockUnlock(lock);
iter->release();
return set;
}
示例15: mergeProperties
bool CLASS::mergeProperties( OSDictionary * dict )
{
bool success = true;
OSCollectionIterator * iter = OSCollectionIterator::withCollection(dict);
if ( iter )
{
const OSSymbol * key;
while ((key = (const OSSymbol *) iter->getNextObject()))
{
if (setProperty(key, dict->getObject(key)) == false)
{
success = false;
break;
}
}
iter->release();
}
return success;
}