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

 


OSSet

Inherits from:
Declared In:

Overview

A collection class for storing OSMetaClassBase-derived objects.

Discussion

Instances of OSSet store unique OSMetaClassBase-derived objects in a non-ordered manner.



Functions

containsObject

Queries the set for the presence of the specified object.

ensureCapacity

Grows the size of the set.

flushCollection

Removes and releases all objects within the set.

free

Releases all resources created or used by the OSSet instance.

getAnyObject

Returns an arbitrary object from the set.

getCapacity

Returns the storage capacity of the set.

getCapacityIncrement

Returns the growth factor of the set.

getCount

Returns the number of objects currently in the set.

initWithArray

Initializes a new instance of OSSet and populates it with the contents of the OSArray object provided.

initWithCapacity

Initializes an instance of OSSet with the specified capacity.

initWithObjects

Initializes an instance of OSSet with the specified capacity and populates the set with the objects provided.

initWithSet

Initializes a new instance of OSSet and populates it with the contents of the OSSet object provided.

isEqualTo(const OSMetaClassBase *)

Tests the equality between the receiver and an unknown object.

isEqualTo(const OSSet *)

Tests the equality between the receiver and the specified OSSet object.

member

Queries the set for the presence of the specified object.

merge(const OSArray *)

Merges the contents of the specified OSArray object with the set.

merge(const OSSet *)

Merges the contents of the specified OSSet object with receiver.

removeObject

Removes objects from the set.

serialize

Archives the receiver.

setCapacityIncrement

Sets the growth factor of the set.

setObject

Places objects into the set.

withArray

Creates and initializes an instance of OSSet and populates it with the objects from the specified OSSArray object.

withCapacity

Creates and initializes an instance of OSSet with the specified capacity.

withObjects

Creates and initializes an instance of OSSet and populates it with the objects provided.

withSet

Creates an instance of OSSet and populates it with the objects from the specified OSSet object.


containsObject


Queries the set for the presence of the specified object.

public

virtual bool containsObject( const OSMetaClassBase *anObject) const;
Parameters
anObject

The OSMetaClassBase-derived object to be queried for in the set.

Return Value

Returns true if the object is present within the set, false otherwise.


ensureCapacity


Grows the size of the set.

public

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

The new capacity for the set to expand to.

Return Value

Returns the new capacity of the set or the previous capacity upon error.


flushCollection


Removes and releases all objects within the set.

public

virtual void flushCollection();


free


Releases all resources created or used by the OSSet instance.

public

virtual void free();
Discussion

This function should not be called directly, use release() instead.


getAnyObject


Returns an arbitrary object from the set.

public

virtual OSObject *getAnyObject() const;
Return Value

Returns an object if one exists within the set.


getCapacity


Returns the storage capacity of the set.

public

virtual unsigned int getCapacity() const;
Return Value

Returns the storage size of the set.


getCapacityIncrement


Returns the growth factor of the set.

public

virtual unsigned int getCapacityIncrement() const;
Return Value

Returns the size by which the set will grow.


getCount


Returns the number of objects currently in the set.

public

virtual unsigned int getCount() const;
Return Value

Returns the number of objects in the set.


initWithArray


Initializes a new instance of OSSet and populates it with the contents of the OSArray object provided.

public

virtual bool initWithArray( const OSArray *array, unsigned int capacity = 0);
Parameters
array

The OSArray object containing OSMetaClassBase-derived objects used to populate the new OSSet object.

capacity

The initial storage capacity of the set. This value must be equal to or larger than the number of objects provided by the OSArray object passed as the first parameter.

Return Value

Returns true if initialization is successful or false on failure.


initWithCapacity


Initializes an instance of OSSet with the specified capacity.

public

virtual bool initWithCapacity( unsigned int capacity);
Parameters
capacity

The initial storage size of the set.

Return Value

Returns true if initialization is successful or false on failure.


initWithObjects


Initializes an instance of OSSet with the specified capacity and populates the set with the objects provided.

public

virtual bool initWithObjects( const OSObject *objects[], unsigned int count, unsigned int capacity = 0);
Parameters
objects

A static array containing OSMetaClassBase-derived objects used to populate the set.

count

The number of objects provided.

capacity

The initial storage size of the set. This value must be equal to or larger than the 'count' parameter.

Return Value

Returns true if initialization is successful or false on failure.


initWithSet


Initializes a new instance of OSSet and populates it with the contents of the OSSet object provided.

public

virtual bool initWithSet( const OSSet *set, unsigned int capacity = 0);
Parameters
set

The OSSet object containing OSMetaClassBase derived objects used to populate the new OSSet object.

capacity

The initial storage capacity of the set. This value must be equal to or larger than the number of objects provided by the OSSet object passed as the first parameter.

Return Value

Returns true if initialization is successful or false on failure.


isEqualTo(const OSMetaClassBase *)


Tests the equality between the receiver and an unknown object.

public

virtual bool isEqualTo( const OSMetaClassBase *anObject) const;
Parameters
anObject

An object to be compared against the receiver.

Return Value

Returns true if the objects are equal.


isEqualTo(const OSSet *)


Tests the equality between the receiver and the specified OSSet object.

public

virtual bool isEqualTo( const OSSet *aSet) const;
Parameters
aSet

An OSSet object to be compared against the receiver.

Return Value

Returns true if the objects are equivalent.


member


Queries the set for the presence of the specified object.

public

virtual bool member( const OSMetaClassBase *anObject) const;
Parameters
anObject

The OSMetaClassBase-derived object to be queried for in the set.

Return Value

Returns true if the object is present within the set, false otherwise.


merge(const OSArray *)


Merges the contents of the specified OSArray object with the set.

public

virtual bool merge( const OSArray *array);
Parameters
array

The OSArray object that contains the objects to be merged.

Return Value

Returns true if the contents of the OSArray were successfully merged into the receiver.


merge(const OSSet *)


Merges the contents of the specified OSSet object with receiver.

public

virtual bool merge( const OSSet *set);
Parameters
set

The OSSet object that contains the objects to be merged.

Return Value

Returns true if the contents of the OSSet were successfully merged into the receiver.


removeObject


Removes objects from the set.

public

virtual void removeObject( const OSMetaClassBase * anObject);
Parameters
anObject

The OSMetaClassBase-derived object to be removed from the set.

Discussion

Note that the object removed from the set is automatically released.


serialize


Archives the receiver.

public

virtual bool serialize( OSSerialize *s) const;
Parameters
s

The OSSerialize object.

Return Value

Returns true if serialization was successful, false if not.


setCapacityIncrement


Sets the growth factor of the set.

public

virtual unsigned int setCapacityIncrement( unsigned increment);
Parameters
increment

The magnitude of the growth factor.

Return Value

Returns the new increment.


setObject


Places objects into the set.

public

virtual bool setObject( const OSMetaClassBase *anObject);
Parameters
anObject

The OSMetaClassBase-derived object to be placed into the set.

Return Value

Returns true if the object was successfully placed into the set, false otherwise.

Discussion

Note that the object added to the set is automatically retained.


withArray


Creates and initializes an instance of OSSet and populates it with the objects from the specified OSSArray object.

public

static OSSet *withArray( const OSArray *array, unsigned int capacity = 0);
Parameters
array

An OSArray object containing a list of OSMetaClassBase-derived objects which are used to initially populate the OSSet object.

capacity

The initial storage size of the set. This value must be equal to or larger than the number of objects provided by the OSArray object passed as the first parameter.

Return Value

Returns an instance of OSSet or 0 on failure.


withCapacity


Creates and initializes an instance of OSSet with the specified capacity.

public

static OSSet *withCapacity( unsigned int capacity);
Parameters
capacity

The initial capacity of the set. The capacity is the total number of objects that can be stored in the set.

Return Value

Returns an instance of OSSet or 0 on failure.


withObjects


Creates and initializes an instance of OSSet and populates it with the objects provided.

public

static OSSet *withObjects( const OSObject *objects[], unsigned int count, unsigned int capacity = 0);
Parameters
objects

A static array of OSMetaClassBase-derived objects which are used to populate the set.

count

The number of objects passed to the set.

capacity

The initial storage size of the set. The capacity is the total number of objects that can be stored in the set. This value must be equal to or larger than the count parameter.

Return Value

Returns an instance of OSSet or 0 on failure.


withSet


Creates an instance of OSSet and populates it with the objects from the specified OSSet object.

public

static OSSet *withSet( const OSSet *set, unsigned int capacity = 0);
Parameters
set

An OSSet object containing OSMetaClassBase-derived objects which are used to initially populate the new OSSet object.

capacity

The initial storage size of the set. This value must be equal to or larger than the number of objects provided by the OSSet object passed as the first parameter.

Return Value

Returns an instance of OSSet or 0 on failure.

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