Ref objects provide a convinient method for managing Referenced objects.
A Ref object holds a reference to a Referenced object. The object is "grabbed" (by calling the grab method), when the reference is associated with that object, and the object is "unrefed" (by calling the unref method) when the Ref is destroyed, or when it gets associated to another object.
| T* |
Returns a pointer to associated object. | |||
| bool |
Tells whether the Ref is associated with any object. | |||
Converts Ref to a pointer to associated object. | ||||
| T* |
Allows to use the Ref object as a pointer to
associated object. | |||
| T& |
Dereferences Ref, providing a C++ reference
to associated object. | |||
| Ref& |
Makes an object associated with ref
being associated this Ref also. | |||
| Ref& |
Associates object obj with this Ref. | |||
| Ref& |
Associates object obj with this Ref. | |||
Makes a copy of ref. | ||||
Creates a Ref, and associates it with obj. | ||||
Creates a Ref, and associates it with obj. | ||||
Creates a null Ref. |
Returns a pointer to associated object.
If the Ref is not (yet) assinged to any object, then NULL is returned.
T* ptr () const
Tells whether the Ref is associated with any object.
Returns true, if this Ref is associated with an object, otherwise returns false.
bool isNull ()
Converts Ref to a pointer to associated object.
Returns NULL, if there is no object associated with this Ref.
operator T* () const
Allows to use the Ref object as a pointer to associated object.
Generally, one should not use this operator, if there is no associated object for this Ref.
T* operator -> () const
Dereferences Ref, providing a C++ reference to associated object.
One must not use this operation, if there is no associated object fot this Ref.
T& operator * () const
Associates object obj with this Ref.
If obj is NULL, then this Ref becomes a null reference.
Ref& operator = (T *obj)
Associates object obj with this Ref.
Ref& operator = (T &obj)
Makes a copy of ref.
After completion, the object associated with ref is also associated with the returned Ref.
Ref (const Ref &ref)
Creates a Ref, and associates it with obj.
Ref (T *obj)
Creates a Ref, and associates it with obj.
Ref (T &obj)
Creates a null Ref.
Ref ()