aegis_shared_ptr< T > Class Template Reference
#include <aegis.h>
Detailed Description
template<class T>
class aegis_shared_ptr< T >
The
aegis_shared_ptr class is used to represent a smart pointer with reference counted copy semantics. The object pointed to is deleted when the last
aegis_shared_ptr pointing to it is destroyed or reset.
This class is only used of std::tr1::shared_ptr and boost::shared_ptr are both unavailable. It only implements as much of a shared_ptr as the Aegis code actually uses.
Definition at line 36 of file aegis.h.
Constructor & Destructor Documentation
The destructor.
This destructor is not virtual. Thou shalt not derive from this class.
Definition at line 85 of file aegis.h.
The default constructor.
Definition at line 134 of file aegis.h.
template<class T>
template<class Y>
The constructor. It permits initialization from any compatable pointer. Y must be a complete type.
- Parameters:
-
| rhs | The object pointed to, the object to be managed. |
Definition at line 149 of file aegis.h.
The copy constructor.
- Parameters:
-
| rhs | The smart pointer to be copied. |
Definition at line 168 of file aegis.h.
template<class T>
template<class Y>
The compatible copy constructor.
- Parameters:
-
| rhs | The compatable smart pointer to be copied. |
Definition at line 192 of file aegis.h.
Member Function Documentation
The valid method is used to establish the correctness of the internal state. Think of it as the contract.
Definition at line 65 of file aegis.h.
Swap the contents of two aegis_shared_ptr<T> objects. This method swaps the internal pointers to T. This can be done safely without involving a reference / unreference cycle and is therefore highly efficient.
Definition at line 108 of file aegis.h.
The reset method is used to drop the reference, if there is one.
Definition at line 124 of file aegis.h.
The assignment operator.
- Parameters:
-
| rhs | The right hand side of the assigment, the pointer to copy. |
Definition at line 214 of file aegis.h.
template<class T>
template<class Y>
The assignment operator.
- Parameters:
-
| rhs | The right hand side of the assigment, the pointer to copy. |
Definition at line 264 of file aegis.h.
The dereference operator. Return a reference to the object, not to the smart pointer.
This is part of why it's called a "smart pointer" when it's actually neither - it *acts* like a pointer.
Definition at line 330 of file aegis.h.
The "pointing at" operator. Return a pointer to the object, not to the smart pointer.
This is part of why it's called a "smart pointer" when it's actually neither - it *acts* like a pointer.
Definition at line 345 of file aegis.h.
The get method is used to obtain the pointer to the object.
Definition at line 356 of file aegis.h.
The bool operator, for implicit conversion to bool. Test of the pointers not NULL.
Definition at line 366 of file aegis.h.
The logical not operator. Test if the pointer is NULL.
Definition at line 377 of file aegis.h.
template<class T>
template<class U>
template<class T>
template<class U>
template<class T>
template<class U>
Friends And Related Function Documentation
Field Documentation
The reference_count instance variable is used to remember the location of the reference count. By having the reference count separate from the subject, we can cope with compatible pointers, not just exact pointers.
This is not ideal because it allocates huge numbers of small objects. Some heap implementations go slowly when faced with many small allocations. Some heap implementations waste a lot of memory when faced with many small allocations.
Definition at line 50 of file aegis.h.
The subject instance variable is used to remember the location of the object being reference counted. By having it separate from the reference count, we can skip one indirection.
Definition at line 57 of file aegis.h.
The documentation for this class was generated from the following file: