|
Original Symbian headers
Selected EUSER, Window Server, networking, graphics and device declarations
|
Implements reference counting to track concurrent references to itself. More...
#include <e32base.h>
Public Member Functions | |
| IMPORT_C | CObject () |
| Constructs the object and initializes the reference count to one. | |
| IMPORT_C | ~CObject () |
| Destructor. | |
| virtual IMPORT_C TInt | Open () |
| Opens this reference counting object. | |
| virtual IMPORT_C void | Close () |
| Closes this reference counting object. | |
| virtual IMPORT_C TName | Name () const |
| Gets the name of this reference counting object. | |
| virtual IMPORT_C TFullName | FullName () const |
| Gets the full name of this reference counting object. | |
| IMPORT_C TInt | SetName (const TDesC *aName) |
| Sets or clears this reference counting object's name. | |
| IMPORT_C void | SetNameL (const TDesC *aName) |
| Sets or clears this reference counting object's name, and leaves on error. | |
| CObject * | Owner () const |
| Gets a pointer to the reference counting object which owns this reference counting object. | |
| void | SetOwner (CObject *anOwner) |
| Sets the owner of this reference counting object. | |
| TInt | AccessCount () const |
| Gets the number of open references to this reference counting object. | |
Public Member Functions inherited from CBase | |
| CBase () | |
| Default constructor. | |
| virtual IMPORT_C | ~CBase () |
| Virtual destructor. | |
| TAny * | operator new (TUint aSize, TAny *aBase) __NO_THROW |
| Initialises the object to binary zeroes. | |
| TAny * | operator new (TUint aSize) __NO_THROW |
| Allocates the object from the heap and then initialises its contents to binary zeroes. | |
| TAny * | operator new (TUint aSize, TLeave) |
| Allocates the object from the heap and then initialises its contents to binary zeroes. | |
| TAny * | operator new (TUint aSize, TUint aExtraSize) __NO_THROW |
| Allocates the object from the heap and then initialises its contents to binary zeroes. | |
| TAny * | operator new (TUint aSize, TLeave, TUint aExtraSize) |
| Allocates the object from the heap and then initialises its contents to binary zeroes. | |
Protected Member Functions | |
| virtual IMPORT_C TInt | Extension_ (TUint aExtensionId, TAny *&a0, TAny *a1) |
| Extension function. | |
| TInt | UniqueID () const |
| Gets this reference counting object's unique ID. | |
| void | Inc () |
| Adds one to the reference count. | |
| void | Dec () |
| Subtracts one from the reference count. | |
Friends | |
| class | CObjectCon |
| class | CObjectIx |
Additional Inherited Members | |
Static Public Member Functions inherited from CBase | |
| static IMPORT_C void | Delete (CBase *aPtr) |
| Deletes the specified object. | |
Implements reference counting to track concurrent references to itself.
An object of this type arranges automatic destruction of itself when the final reference is removed.
A reference counting object is any object which has CObject as its base class. Constructing a CObject derived type or calling its Open() member function adds a reference to that object by adding one to the reference count; calling its Close() member function removes a reference by subtracting one from the reference count; when the last user of the object calls Close(), the reference count becomes zero and the object is automatically destroyed.
| IMPORT_C CObject::CObject | ( | ) |
Constructs the object and initializes the reference count to one.
Once constructed, a reference counting object cannot be deleted until its reference count is reduced to zero.
(generated from Symbian Developer Library)
| IMPORT_C CObject::~CObject | ( | ) |
Destructor.
It removes this reference counting object from its object container, a CObjectCon type.
Panic condition: E32USER-CBase 33 if the reference count is not zero when the destructor is called.
(generated from Symbian Developer Library)
|
inline |
Gets the number of open references to this reference counting object.
(generated from Symbian Developer Library)
|
virtual |
Closes this reference counting object.
The default behaviour decrements the reference count by one. If this becomes zero, then the function deletes this reference counting object.
Where a derived class implements its own version of this function, it can use the protected member function Dec() to decrement the reference count or make a base call to this function.
Panic condition: E32USER-CBase 34 if the reference count is negative when this function is called.
(generated from Symbian Developer Library)
|
inlineprotected |
Subtracts one from the reference count.
This function is called by the default implementation of the Close() member function of this class.
(generated from Symbian Developer Library)
|
protectedvirtual |
|
virtual |
Gets the full name of this reference counting object.
By default, the full name is a concatenation of this reference counting object's name with the full name of its owning reference counting object.
(generated from Symbian Developer Library)
|
inlineprotected |
Adds one to the reference count.
This function is called by the default implementation of the Open() member function of this class.
(generated from Symbian Developer Library)
|
virtual |
Gets the name of this reference counting object.
The default behaviour provided by this function depends on whether a name has been explicitly set into the object:
if a name has previously been set, then the function returns that name.
if a name has not been set, then the function builds a default name. This is fourteen characters and has the format: LOCAL-nnnnnnnn where nnnnnnnn is the hexadecimal character representation of this reference counting object's address. This default name is, therefore, guaranteed to be unique within the current process.
(generated from Symbian Developer Library)
|
virtual |
Opens this reference counting object.
The default behaviour increments the reference count by one and returns KErrNone. Where a derived class implements its own version of this function, it must either use the protected member function Inc() to increment the reference count or make a base call to this function.
(generated from Symbian Developer Library)
|
inline |
Gets a pointer to the reference counting object which owns this reference counting object.
(generated from Symbian Developer Library)
| IMPORT_C TInt CObject::SetName | ( | const TDesC * | aName | ) |
Sets or clears this reference counting object's name.
To set the name, the specified descriptor must contain the name to be set. Once the name has been successfully set, then the specified source descriptor can be discarded.
To clear an existing name, specify a NULL argument.
| aName | A pointer to the descriptor containing the name to be set, or NULL if an existing name is to be cleared. |
Panic condition: USER 11 if the length of aName is greater than KMaxName for a 16-bit descriptor.
Panic condition: USER 23 if the length of aName is greater than KMaxName for an 8-bit descriptor.
(generated from Symbian Developer Library)
| IMPORT_C void CObject::SetNameL | ( | const TDesC * | aName | ) |
Sets or clears this reference counting object's name, and leaves on error.
To set the name, the specified descriptor must contain the name to be set. Once the name has been successfully set, then the specified source descriptor can be discarded.
To clear an existing name, specify a NULL argument.
The function leaves if there is insufficient memory.
| aName | A pointer to the descriptor containing the name to be set, or NULL if an existing name is to be cleared. |
Panic condition: USER 11 if the length of aName is greater than KMaxName for a 16-bit descriptor.
Panic condition: USER 23 if the length of aName is greater than KMaxName for an 8-bit descriptor.
(generated from Symbian Developer Library)
|
inline |
Sets the owner of this reference counting object.
If this reference counting object already has an owner, then all knowledge of that owner is lost.
| anOwner | A pointer to the reference counting object which is to be the new owner of this reference counting object. |
(generated from Symbian Developer Library)
|
inlineprotected |
Gets this reference counting object's unique ID.
The unique ID is an integer which is a property of the object container. It forms part of the identity of all reference counting objects and is the same value for all reference counting objects held within the same object container.
(generated from Symbian Developer Library)
|
friend |