|
| RefPtr () |
| Default constructor. More...
|
|
| ~RefPtr () |
| Destructor - decrements reference count. More...
|
|
| RefPtr (T_CppObject *cpp_object) |
| Constructor that takes ownership. More...
|
|
| RefPtr (const RefPtr< T_CppObject > &src) |
| Copy constructor This increments the shared reference count. More...
|
|
template<class T_CastFrom > |
| RefPtr (const RefPtr< T_CastFrom > &src) |
| Copy constructor (from different, but castable type). More...
|
|
void | swap (RefPtr< T_CppObject > &other) |
| Swap the contents of two RefPtr<>. More...
|
|
RefPtr< T_CppObject > & | operator= (const RefPtr< T_CppObject > &src) |
| Copy from another RefPtr. More...
|
|
template<class T_CastFrom > |
RefPtr< T_CppObject > & | operator= (const RefPtr< T_CastFrom > &src) |
| Copy from different, but castable type). More...
|
|
RefPtr< T_CppObject > & | operator= (T_CppObject *ptr) |
| Assign object and claim ownership. More...
|
|
bool | operator== (const RefPtr< T_CppObject > &src) const |
| Tests whether the RefPtr<> point to the same underlying instance. More...
|
|
bool | operator!= (const RefPtr< T_CppObject > &src) const |
| Tests whether the RefPtr<> do not point to the same underlying instance. More...
|
|
T_CppObject * | operator-> () const |
| Dereferencing. More...
|
|
T_CppObject * | operator* () const |
| Get underlying pointer. More...
|
|
| operator bool () const |
| Test whether the RefPtr<> points to any underlying instance. More...
|
|
void | clear () |
| Set underlying instance to 0, decrementing reference count of existing instance appropriately. More...
|
|
void | reset () |
| Reset pointer. More...
|
|
| RefPtr (T_CppObject *cpp_object, int *refcount, Mutex *refmutex) |
| For use only in the internal implementation of sharedptr. More...
|
|
int * | refcount_ptr () const |
| For use only in the internal implementation of sharedptr. More...
|
|
int | use_count () const |
| Get current reference count. More...
|
|
Mutex * | refmutex_ptr () const |
| For use only in the internal implementation of sharedptr. More...
|
|
template<class T_CastFrom > |
RefPtr< T_CppObject > | cast_dynamic (const RefPtr< T_CastFrom > &src) |
|
template<class T_CastFrom > |
RefPtr< T_CppObject > | cast_static (const RefPtr< T_CastFrom > &src) |
|
template<class T_CastFrom > |
RefPtr< T_CppObject > | cast_const (const RefPtr< T_CastFrom > &src) |
|
template<class T_CppObject>
class fawkes::RefPtr< T_CppObject >
RefPtr<> is a reference-counting shared smartpointer.
Reference counting means that a shared reference count is incremented each time a RefPtr is copied, and decremented each time a RefPtr is destroyed, for instance when it leaves its scope. When the reference count reaches zero, the contained object is deleted
Fawkes uses RefPtr so that you don't need to remember to delete the object explicitly, or know when a method expects you to delete the object that it returns.
Note that RefPtr is thread-safe.
Definition at line 49 of file refptr.h.
template<class T_CppObject>
Constructor that takes ownership.
This takes ownership of cpp_object, so it will be deleted when the last RefPtr is deleted, for instance when it goes out of scope.
- Parameters
-
cpp_object | C++ object to take ownership of |
Definition at line 281 of file refptr.h.
template<class T_CppObject >
template<class T_CastFrom >
template<class T_CppObject >
template<class T_CastFrom >
Copy from different, but castable type).
Increments the reference count.
- Parameters
-
- Returns
- reference to this instance
Definition at line 411 of file refptr.h.