SharedObject allows to work with combined reference counting pointers and weak (Observer) pointers.
More...
#include <cartobase/smart/sharedptr.h>
SharedObject allows to work with combined reference counting pointers and weak (Observer) pointers.
- See also
- weak_shared_ptr, rc_ptr, weak_ptr
Definition at line 47 of file sharedptr.h.
◆ SharedObject() [1/2]
carto::SharedObject::SharedObject |
( |
| ) |
|
◆ SharedObject() [2/2]
◆ ~SharedObject()
virtual carto::SharedObject::~SharedObject |
( |
| ) |
|
|
virtual |
◆ disableRefCount()
void carto::SharedObject::disableRefCount |
( |
| ) |
|
|
protected |
called by destructors to avoid double deletion.
Sets the reference counter to -1, so any additional existing smart pointer will not delete the SharedObject another time.
◆ operator=()
◆ testDeletable()
bool carto::SharedObject::testDeletable |
( |
| ) |
|
tests if the shared object can be deleted (no strong pointers to it).
The test also returns false if no smart pointer at all points to the object (counters are 0), because it may mean the SharedObject has been allocated on the heap and must not be deleted by the C++ delete operator.
◆ tryDelete()
bool carto::SharedObject::tryDelete |
( |
| ) |
|
tests if the shared object can be deleted.
If possible, it is actually deleted (suicide is committed and the object is not valid any more after this call)
◆ rc_ptr_trick
◆ shared_ptr
◆ weak_shared_ptr
The documentation for this class was generated from the following file: