Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: e32base.h
Link against: euser.lib

Class CObjectIx

CObjectIx

Support

Supported from 5.0

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.

Derivation

CBaseBase class for all classes to be instantiated on the heap
CObjectIxGenerates handle numbers for reference counting objects

Defined in CObjectIx:
ActiveCount(), AddL(), Anonymous, At(), AtL(), Count(), ELocalHandle, ENoClose, NewL(), Remove(), operator[](), ~CObjectIx()

Inherited from CBase:
operator new()

See also:


Allocation and construction


NewL()

static CObjectIx* NewL();

Description

Creates a new object index.

Return value

CObjectIx*

A pointer to the newly created object index.

[Top]


Destruction


~CObjectIx()

~CObjectIx();

Description

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:

[Top]


Adding and removing reference counting objects


AddL()

TInt AddL(CObject* anObj);

Description

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

Parameters

CObject* anObj

The reference counting object to be added to this object index.

Return value

TInt

The handle number.


Remove()

void Remove(TInt aHandle);

Description

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

TInt aHandle

The handle number of the reference counting object to be removed and closed. If this number does not represent an object known to this object index, then the function raises an E32USER-CBase 37 panic.

[Top]


Accessing reference counting objects


At()

CObject* At(TInt aHandle,TInt aUniqueID);

Description

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

Parameters

TInt aHandle

The handle number of the reference counting object.

TInt aUniqueID

The unique ID.

Return value

CObject*

A pointer to the reference counting object. If there is no matching object, then this is NULL.


At()

CObject* At(TInt aHandle);

Description

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

Parameters

TInt aHandle

The handle number of the reference counting object.

Return value

CObject*

A pointer to the reference counting object. If there is no matching object, then this is NULL.


At()

TInt At(const CObject* anObject) const;

Description

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

Parameters

const CObject* anObject

The reference counting object.

Return value

TInt

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


AtL()

CObject* AtL(TInt aHandle,TInt aUniqueID);

Description

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

If there is no matching object, then the function leaves with KErrBadHandle.

Parameters

TInt aHandle

The handle number of the reference counting object.

TInt aUniqueID

The unique ID.

Return value

CObject*

A pointer to the reference counting object.


AtL()

CObject* AtL(TInt aHandle);

Description

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

If there is no matching object, then the function leaves with KErrBadHandle.

Parameters

TInt aHandle

The handle number of the reference counting object.

Return value

CObject*

A pointer to the reference counting object.


operator[]()

CObject* operator[](TInt anIndex);

Description

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

Parameters

TInt anIndex

The offset of the reference counting object within the object index. Offset is relative to zero. This value must be greater than or equal to zero and it must be less than the total number of objects held by the index, otherwise the operator raises an E32USER-CBase 21 panic.

Return value

CObject*

A pointer to the reference counting object.

[Top]


Information


ActiveCount()

TInt ActiveCount() const;

Support

Supported from 6.0

Description

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

Return value

TInt

The current number.


Count()

TInt Count(CObject* anObject) const;

Description

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

CObject* anObject

The reference counting object.

Return value

TInt

The number of occurrences.


Count()

TInt Count() const;

Description

Gets the maximum number of reference counting objects that this object index can hold before internal buffers need to be expanded.

Note that the current number of objects as returned by ActiveCount() is always less than the value returned by this function and can, in some circumstances, be considerably less.

Return value

TInt

The maximum number of reference counting objects.

[Top]


Enumerations


Enum Anonymous

Description

Miscellaneous constants.

ENoClose

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

ELocalHandle

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