ADC Home > Reference Library > Reference > Darwin > Kernel Framework Reference

 


OSCollection

Inherits from:
Declared In:

Overview

Abstract super class for all collections.

Discussion

OSCollection is the abstract super class for all OSObject-derived collections and provides the necessary interfaces for managing storage space and iteration through a collection.



Functions

ensureCapacity
flushCollection
getCapacity

Returns the storage space in the collection subclass.

getCapacityIncrement

Returns the growth factor of the collection subclass.

getCount

Returns the number of objects in the collection subclass.

getNextObjectForIterator

Returns the next member of a collection.

haveUpdated

Tracks all updates to the collection.

init

Initializes the OSCollection object.

initIterator

Allocates and initializes the iterator context data.

iteratorSize

Returns the size of the iterator context.

setCapacityIncrement

Sets the growth factor of the collection subclass.


ensureCapacity


public

virtual unsigned int ensureCapacity( unsigned int newCapacity) = 0;
Parameters
newCapacity


flushCollection


public

virtual void flushCollection() = 0;


getCapacity


Returns the storage space in the collection subclass.

public

virtual unsigned int getCapacity() const = 0;
Return Value

Returns the number objects in a collection.


getCapacityIncrement


Returns the growth factor of the collection subclass.

public

virtual unsigned int getCapacityIncrement() const = 0;
Return Value

Returns the size by which the collection subclass should grow.


getCount


Returns the number of objects in the collection subclass.

public

virtual unsigned int getCount() const = 0;
Return Value

Returns the number objects in a collection.


getNextObjectForIterator


Returns the next member of a collection.

protected

virtual bool getNextObjectForIterator( void *iterator, OSObject **ret) const = 0;
Parameters
iterator

The iterator context.

ret

The object returned to the caller.

Return Value

Returns true if an object was found, false otherwise.

Discussion

This is the entry point used by an OSCollectionIterator object to advance to the next object in the collection. The iterator context is passed to the receiver to allow it to find the location of the current object and then advance the iterator context to the next object.


haveUpdated


Tracks all updates to the collection.

public

void haveUpdated();


init


Initializes the OSCollection object.

protected

virtual bool init();
Return Value

Returns true if an object was initialized successfully, false otherwise.

Discussion

This function is used to initialize state within a newly created OSCollection object.


initIterator


Allocates and initializes the iterator context data.

protected

virtual bool initIterator( void *iterator) const = 0;
Parameters
iterator

The iterator context.

Return Value

Returns true if initialization was successful, false otherwise.


iteratorSize


Returns the size of the iterator context.

protected

virtual unsigned int iteratorSize() const = 0;
Return Value

Returns an integer size for the storage space required to contain context necessary for iterating through a collection.

Discussion

This member function is called by an OSCollectionIterator object to allow it to allocate enough storage space for the iterator context. This context contains the data necessary to iterate through the collection when getNextObjectForIterator is called.


setCapacityIncrement


Sets the growth factor of the collection subclass.

public

virtual unsigned int setCapacityIncrement( unsigned increment) = 0;
Parameters
increment

The new size by which the capacity of the collection should grow.

Return Value

Returns the new capacity increment.

Member Data


reserved


protected

ExpansionData *reserved;
Discussion

Reserved for future use. (Internal use only)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.

 

Last Updated: 2008-12-19