Contents

OSArray

A container for an ordered, random-access collection of objects.

Declaration

class OSArray;

Overview

OSArray is a collection class for objects derived from OSObject. Storage and access are by array index.

You must generally cast retrieved objects from OSObject to the desired class using the OSDynamicCast macro. This macro returns the object cast to the desired class, or NULL if the object isn’t derived from that class.

As with all DriverKit collection classes, OSArray retains objects added to it, and releases objects removed from it (or replaced). An OSArray also grows as necessary to accommodate new objects.

OSArray provides no concurrency protection; it’s up to the usage context to provide any protection necessary.

Topics

Creating an Array

Accessing Elements

Getting and Setting Values

Inspecting an Array

Modifying the Array Contents

Comparing Arrays

See Also

Registry data types