Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]


The object container

All reference counting objects must be held in an object container. An object container acts as a home for a set of related reference counting objects.

An object container is an instance of a CObjectCon class.

After construction, a reference counting object must be added to an object container. Only one instance of a reference counting object can be held by an object container, i.e. each object within an object container must be distinct.

The main characteristics of an object container can be summarized as follows:

Object containers are constructed by an object container index, a CObjectConIx type. The maximum number of object containers which may be constructed and held in an object container index is 6,383 (0x3fff).

An object container is implemented as a simple array, where each element of the array is a pointer to a contained reference counting object. Adding a reference counting object to the object container is simply a matter of adding the reference counting object's pointer into the array. The following diagram shows a simple situation where two object containers hold a number of reference counting objects.


The CObjectCon::AddL() function adds a reference counting object to the object container.

The CObjectCon::Remove() function removes a reference counting object from its object container and also destroys that reference counting object. Conversely, if the reference counting object is destroyed (typically, as a result of successive calls to Close()), it is removed from its object container.

See also: