template
class
Pointer<class>
(Return to index)
Reference-counted pointer.
This template class implements a pointer with reference counting in
collaboration with the class RCObject. It is modelled after the class
RCPtr described in:
{center}
Scott Meyers, More Effective C++, Addison Wesley, 1996, pg. 195.
{/center}
When the pointer goes out of scope, the pointee's reference count is
decremented, and, if it becomes zero, the pointee is deleted.
When a Pointer is assigned, the pointee's reference count is incremented.
Type: |
Instantiable |
Include file: |
./MemoryManagement/Pointer.hh |
Synopsis (including inherited members):
Documentation:
- Public members:
-
Pointer
()
;
- Default constructor.
Set the pointer to NULL.
-
Pointer
(const Pointer&)
;
- Copy constructor.
Increment reference count of pointee.
-
Pointer
(Object*)
;
- Constructor.
Grab an object just created by "new" and set its reference count to one.
-
bool isValid
()const
;
- Test for validity.
Return true, if the pointer is not NULL.
-
bool operator!=
(const Pointer&)const
;
- Pointer inequality.
-
Object& operator*
()const
;
- Dereferencing operator.
Return a reference to the object.
-
Object* operator->
()const
;
- Delegation operator.
Return a C-type pointer to the object.
-
Pointer& operator=
(const Pointer&)
;
- Assign.
Increment reference count of pointee.
-
Pointer& operator=
(Object*)
;
- Assign.
Grab an object just created by "new" and set its reference count to one.
-
bool operator==
(const Pointer&)const
;
- Pointer equality.
-
void unique
()
;
- Force unique.
Copy the object and make *this point to it.
-
~Pointer
()
;
- Destructor.
Decrement reference count and delete object if it reaches zero.
Documentation generated by fci on Mon Feb 7 11:41:48 2000