![]() |
This class implements a smart pointer which handles pointer-style access to a reference-counted structure and destructing the latter after use. More...
#include <countedref.h>
Public Types | |
| enum | { nondestructive = Nondestructive, never_null = NeverNull } |
| typedef PtrType | ptr_type |
| typedef CountType | count_type |
Public Member Functions | |
| CountedRefPtr () | |
| Default constructor. More... | |
| CountedRefPtr (ptr_type ptr) | |
| Convert from pointer. More... | |
| template<bool Never> | |
| CountedRefPtr (const CountedRefPtr< ptr_type, !nondestructive, Never, count_type > &rhs) | |
| Convert from compatible smart pointer. More... | |
| CountedRefPtr (const self &rhs) | |
| Construct refernce copy. More... | |
| ~CountedRefPtr () | |
| Unlink one reference. More... | |
| self & | operator= (const self &rhs) |
| self & | operator= (ptr_type ptr) |
| bool | operator== (const self &rhs) const |
| Checking equality. More... | |
| bool | operator== (ptr_type ptr) const |
| operator bool () const | |
| operator const ptr_type () const | |
| operator ptr_type () | |
| const ptr_type | operator-> () const |
| ptr_type | operator-> () |
Reference count interface | |
| count_type | count () const |
| void | reclaim () |
| void | release () |
Private Types | |
| typedef CountedRefPtr | self |
Private Attributes | |
| ptr_type | m_ptr |
| Store actual pointer. More... | |
This class implements a smart pointer which handles pointer-style access to a reference-counted structure and destructing the latter after use.
The template arguments, include the pointer type PtrType, and two integral (bool) properties: use Nondestructive to disallow destruction and NeverNull to assume, that PtrType cannot be NULL. Finally, CountType allows you to select a typ to represent the internal reference count.
PtrType must have an accessible integral attribute ref. For convenience use RefCounter as public base. In addition you must overload void CountedRefPtr_kill(PtrType) accordingly. Definition at line 43 of file countedref.h.
| typedef CountType CountedRefPtr< PtrType, Nondestructive, NeverNull, CountType >::count_type |
Definition at line 49 of file countedref.h.
| typedef PtrType CountedRefPtr< PtrType, Nondestructive, NeverNull, CountType >::ptr_type |
Definition at line 48 of file countedref.h.
|
private |
Definition at line 44 of file countedref.h.
| anonymous enum |
| Enumerator | |
|---|---|
| nondestructive | |
| never_null | |
Definition at line 50 of file countedref.h.
|
inline |
Default constructor.
NeverNull is false Definition at line 54 of file countedref.h.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 95 of file countedref.h.
|
inline |
Definition at line 86 of file countedref.h.
|
inline |
Definition at line 87 of file countedref.h.
|
inline |
Definition at line 88 of file countedref.h.
|
inline |
Definition at line 89 of file countedref.h.
|
inline |
Definition at line 90 of file countedref.h.
|
inline |
Definition at line 72 of file countedref.h.
|
inline |
Definition at line 73 of file countedref.h.
|
inline |
|
inline |
Definition at line 85 of file countedref.h.
|
inline |
Definition at line 96 of file countedref.h.
|
inline |
Definition at line 97 of file countedref.h.
|
private |
Store actual pointer.
Definition at line 105 of file countedref.h.