CObjectIx Class Reference

#include <e32base.h>

class CObjectIx : public CBase

Inherits from

Detailed Description

Generates handle numbers for reference counting objects.

This is referred to as an object index.

Adding a reference counting object to an object index is the way in which a unique handle number can be generated for that object. A handle number is the way in which an object, which is owned or managed by another thread or process can be identified.

See also: CObject

Member Enumeration Documentation

Enum anonymous

EnumeratorValueDescription
ENoCloseKHandleNoClose

When ORd into the handle number, indicates that the reference counting object cannot be closed.

ELocalHandleKHandleFlagLocal

When ORed into the handle number, indicates that the handle is a local handle.

Constructor & Destructor Documentation

CObjectIx ( )

IMPORT_CCObjectIx()[protected]

Default constructor.

~CObjectIx ( )

IMPORT_C~CObjectIx()

Destructor.

Frees all resources owned by the object index, prior to its destruction. In particular, it calls Close() on all reference counting objects in the index.

See also: CObject::Close

Member Function Documentation

ActiveCount ( )

TInt ActiveCount()const [inline]

Gets the current number of reference counting objects held by this object index.

Return Value
The current number.

AddL ( CObject * )

IMPORT_C TIntAddL(CObject *anObj)

Adds the specified reference counting object into this object index and returns the handle number that represents it.

Parameters
anObjThe reference counting object to be added to this object index.
Return Value
The handle number.

At ( TInt, TInt )

IMPORT_C CObject *At(TIntaHandle,
TIntaUniqueID
)

Gets a pointer to the reference counting object with the specified handle number and matching unique ID.

Parameters
aHandleThe handle number of the reference counting object.
aUniqueIDThe unique ID.
Return Value
A pointer to the reference counting object. If there is no matching object, then this is NULL.

At ( TInt )

IMPORT_C CObject *At(TIntaHandle)

Gets a pointer to the reference counting object with the specified handle number.

Parameters
aHandleThe handle number of the reference counting object.
Return Value
A pointer to the reference counting object. If there is no matching object, then this is NULL.

At ( const CObject * )

IMPORT_C TIntAt(const CObject *anObject)const

Constructs and returns the handle number representing the specified reference counting object within this object index.

Parameters
anObjectThe reference counting object.
Return Value
The handle number representing the reference counting object; KErrNotFound, if the reference counting object could not be found within the object index.

AtL ( TInt, TInt )

IMPORT_C CObject *AtL(TIntaHandle,
TIntaUniqueID
)

Gets a pointer to the reference counting object with the specified handle number and matching unique ID.

Parameters
aHandleThe handle number of the reference counting object.
aUniqueIDThe unique ID.
Return Value
A pointer to the reference counting object.
Leave Codes
KErrBadHandleif there is no matching object.

AtL ( TInt )

IMPORT_C CObject *AtL(TIntaHandle)

Gets a pointer to the reference counting object with the specified handle number.

Parameters
aHandleThe handle number of the reference counting object.
Return Value
A pointer to the reference counting object.
Leave Codes
KErrBadHandleif there is no matching object.

Count ( CObject * )

IMPORT_C TIntCount(CObject *anObject)const

Gets the number of occurrences of the specified reference counting object within this object index.

Note that the same reference counting object can be added to an object index more than once.

Parameters
anObjectThe reference counting object.
Return Value
The number of occurrences.

Count ( )

TInt Count()const [inline]

Gets the number greater then the last slot number used to hold valid CObject pointer. The input argument of CObject* CObjectIx::operator[]() must be less then the number returned by this method.

See also: CObjectIx::ActiveCount CObjectIx::operator[]

Return Value
The number greater then the last used slot.

NewL ( )

IMPORT_C CObjectIx *NewL()[static]

Creates a new object index.

Return Value
A pointer to the newly created object index.

Remove ( TInt )

IMPORT_C voidRemove(TIntaHandle)

Removes the reference counting object identified by handle number from this object index and closes it.

If the reference counting object cannot be closed, because CObjectIx::ENoClose is ORed into the handle number, then it is neither removed from the object index nor closed.

Parameters
aHandleThe handle number of the reference counting object to be removed and closed.
Panic Codes
E32USER-CBase37 if aHandle does not represent an object known to this object index.

operator[] ( TInt )

IMPORT_C CObject *operator[](TIntanIndex)

Gets a pointer to a reference counting object located at the specified offset within the object index.

Parameters
anIndexThe offset of the reference counting object within the object index. Offset is relative to zero.
Return Value
A pointer to the reference counting object.
Panic Codes
E32USER-CBase21 if the value of anIndex is negative or is greater than or equal to the total number of objects held by the index.