Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <e32base.h>
Link against: euser.lib

Class CObjectIx

class CObjectIx : public CBase;

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

Members

Defined in CObjectIx:

Inherited from CBase:


Construction and destruction


NewL()

IMPORT_C static CObjectIx* NewL();

Description

Creates a new object index.

Return value

CObjectIx *

A pointer to the newly created object index.


~CObjectIx()

IMPORT_C ~CObjectIx();

Description

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:


CObjectIx()

protected: IMPORT_C CObjectIx();

Description

Default constructor.

[Top]


Member functions


AddL(CObject *)

IMPORT_C 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(TInt)

IMPORT_C 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.

Panic codes

E32USER-CBase

37 if aHandle does not represent an object known to this object index.


At(TInt,TInt)

IMPORT_C 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(TInt)

IMPORT_C 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.


AtL(TInt,TInt)

IMPORT_C CObject* AtL(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.

Leave codes

KErrBadHandle

if there is no matching object.


AtL(TInt)

IMPORT_C CObject* AtL(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.

Leave codes

KErrBadHandle

if there is no matching object.


At(const CObject *)const

IMPORT_C 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.


Count(CObject *)const

IMPORT_C 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.


operator[](TInt)

IMPORT_C 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.

Return value

CObject *

A pointer to the reference counting object.

Panic codes

E32USER-CBase

21 if the value of anIndex is negative or is greater than or equal to the total number of objects held by the index.


Count()const

inline TInt Count() const;

Description

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

Return value

TInt

The number greater then the last used slot.

See also:


ActiveCount()const

inline TInt ActiveCount() const;

Description

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

Return value

TInt

The current number.

[Top]


Member enumerations


Enum anonymous

n/a

Description

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.