![]() |
The Simons
|
#include <ObjectID.h>
Inheritance diagram for ObjectID:
ObjectID is a strongly typed, reference counting pointer that refers to an Object. ObjectID variables may be initialised to Object* objects and all subtypes. ObjectID variables may alias objects held by other ObjectID variables, or any subtype. When an ObjectID acquires an object, it increments the object's reference count. When an ObjectID releases an object, it decrements the object's reference count. If the reference count reaches zero, the object is automatically deleted.
ObjectID is the root of the pointer hierarchy. It defines in one place all the basic behaviour of reference counted memory management. All other typed pointers inherit from ObjectID, providing trivial inlined methods which call ObjectID methods. The pointer types are provided by subclassing, rather than by a template class, so that automatic type upcasting may promote a pointer type up to a pointer supertype. Type downcasting is achieved through toType() and tryType(). These both convert their pointer-argument to a more specific type, provided the dynamic type of the contained object is at least as specific. Upon failure, toType() raises an exception, while tryType() returns a null pointer.
Public Member Functions | |
ObjectID () | |
Declare an ObjectID. | |
~ObjectID () | |
Release an ObjectID. | |
ObjectID (const Null *) | |
Initialise an ObjectID explicitly to null. | |
ObjectID (const Object *) | |
Initialise an ObjectID to refer to an object. | |
ObjectID (const ObjectID &) | |
Initialise an ObjectID to alias another ObjectID. | |
ObjectID & | operator= (const Object *) |
Reassign this ObjectID to refer to an Object. | |
ObjectID & | operator= (const ObjectID &) |
Reassign this ObjectID to alias another ObjectID. | |
Object * | operator-> () const |
Invoke a method on this ObjectID variable. | |
const Object * | pointer () const |
Return the encapsulated pointer. | |
Protected Member Functions | |
Void | assign (const Object *) |
Reassign this ObjectID to refer to an object. | |
Void | assign (const ObjectID &) |
Reassign this ObjectID to alias another ObjectID. | |
Void | nullPointer (ObjectID) const |
Report a failed pointer dereference. | |
Void | typeFailure (ObjectID) const |
Report a failed type conversion attempt. | |
Protected Attributes | |
Object * | basicPointer |
The encapsulated primitive pointer. | |
Friends | |
bool | operator== (const ObjectID &, const ObjectID &) |
Compare two ObjectIDs for identity of reference. | |
bool | operator!= (const ObjectID &, const ObjectID &) |
Compare two ObjectIDs for non-identity of reference. | |
template<class T> T * | toType (const ObjectID &) |
Perform a guaranteed dynamic type conversion. | |
template<class T> T * | tryType (const ObjectID &) |
Perform a tentative dynamic type conversion. |
|
Declare an ObjectID.
|
|
Release an ObjectID.
|
|
Initialise an ObjectID explicitly to null.
|
|
Initialise an ObjectID to refer to an object.
|
|
Initialise an ObjectID to alias another ObjectID.
|
|
Reassign this ObjectID to alias another ObjectID.
|
|
Reassign this ObjectID to refer to an object.
|
|
Report a failed pointer dereference. Raise a NullPointer exception, using the exemplar Object as an indicator of the expected Type. |
|
Invoke a method on this ObjectID variable.
Reimplemented in BagID, CGIReaderID, CollectionID, DataErrorID, DeviceBusyID, DeviceErrorID, EntryID, ExceptionID, FileStreamID, FormatStreamID, InputID, ListID, MapID, MethodErrorID, NoElementsID, NoResponseID, NotFoundID, NullPointerID, ObjectErrorID, OutOfRangeID, OutputID, ReaderID, ReadFailureID, RelationID, SequenceID, SetID, StreamID, StringID, TextInputID, TextOutputID, TypeFailureID, TypeID, UndefinedID, UnorderedID, ValueID, VectorID, WebOutputID, WriteFailureID, WriterID, XMLReaderID, and XMLWriterID. |
|
Reassign this ObjectID to alias another ObjectID.
|
|
Reassign this ObjectID to refer to an Object.
|
|
Return the encapsulated pointer.
|
|
Report a failed type conversion attempt. Raise a TypeFailure exception, using the exemplar Object as an indicator of the expected Type. |
|
Compare two ObjectIDs for non-identity of reference.
|
|
Compare two ObjectIDs for identity of reference.
|
|
Perform a guaranteed dynamic type conversion.
|
|
Perform a tentative dynamic type conversion.
|
|
The encapsulated primitive pointer.
|