|
Krita Source Code Documentation
|
#include <kis_shared_ptr.h>
Public Types | |
| using | element_type = T |
Public Member Functions | |
| const T * | constData () const |
| T * | data () |
| const T * | data () const |
| bool | isNull () const |
| bool | isValid () const |
| KisWeakSharedPtr () | |
| KisWeakSharedPtr (const KisSharedPtr< T > &o) | |
| KisWeakSharedPtr (const KisWeakSharedPtr< T > &o) | |
| KisWeakSharedPtr (T *p) | |
| operator const T * () const | |
| template<class T2 > | |
| operator KisWeakSharedPtr< T2 > () const | |
| bool | operator!= (const KisWeakSharedPtr &o) const |
| bool | operator!= (const T *p) const |
| T & | operator* () |
| const T & | operator* () const |
| T * | operator-> () |
| const T * | operator-> () const |
| KisWeakSharedPtr & | operator= (const KisWeakSharedPtr &o) |
| KisWeakSharedPtr< T > & | operator= (T *p) |
| bool | operator== (const KisWeakSharedPtr &o) const |
| bool | operator== (const T *p) const |
| KisSharedPtr< T > | toStrongRef () const |
| toStrongRef returns a KisSharedPtr which may be dereferenced. | |
| ~KisWeakSharedPtr () | |
Private Member Functions | |
| void | attach (const KisWeakSharedPtr &o) |
| void | attach (T *newValue) |
| void | detach () |
| bool | isConsistent () const |
| void | load (T *newValue) |
Static Private Member Functions | |
| static bool | isOdd (const qint32 &x) |
Private Attributes | |
| T * | d |
| QAtomicInt * | weakReference |
Static Private Attributes | |
| static const qint32 | WEAK_REF = 2 |
Friends | |
| class | KisSharedPtr< T > |
A weak shared ptr is an ordinary shared ptr, with two differences: it doesn't delete the contained pointer if the refcount drops to zero and it doesn't prevent the contained pointer from being deleted if the last strong shared pointer goes out of scope.
Definition at line 237 of file kis_shared_ptr.h.
| using KisWeakSharedPtr< T >::element_type = T |
Definition at line 241 of file kis_shared_ptr.h.
|
inline |
|
inline |
Creates a new pointer.
| p | the pointer |
Definition at line 253 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::load(), and p.
|
inline |
Definition at line 257 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::load().
|
inline |
Copies a pointer.
| o | the pointer to copy |
Definition at line 265 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::d, KisWeakSharedPtr< T >::load(), and KisWeakSharedPtr< T >::weakReference.
|
inline |
Definition at line 275 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::detach().
|
inlineprivate |
Definition at line 452 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::d, KisWeakSharedPtr< T >::detach(), KisWeakSharedPtr< T >::load(), and KisWeakSharedPtr< T >::weakReference.
|
inlineprivate |
Definition at line 447 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::detach(), and KisWeakSharedPtr< T >::load().
|
inline |
Definition at line 336 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::d, KisWeakSharedPtr< T >::isConsistent(), kisBacktrace(), and warnKrita.
|
inline |
Note that if you use this function, the pointer might be destroyed if KisSharedPtr pointing to this pointer are deleted, resulting in a segmentation fault. Use with care.
Definition at line 312 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::d, KisWeakSharedPtr< T >::isConsistent(), kisBacktrace(), and warnKrita.
|
inline |
Definition at line 324 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::d, KisWeakSharedPtr< T >::isConsistent(), kisBacktrace(), and warnKrita.
|
inlineprivate |
Definition at line 464 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::d, KisWeakSharedPtr< T >::WEAK_REF, and KisWeakSharedPtr< T >::weakReference.
|
inlineprivate |
Definition at line 428 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::d, isOdd, and KisWeakSharedPtr< T >::weakReference.
|
inline |
Definition at line 396 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::d.
|
inlinestaticprivate |
Definition at line 424 of file kis_shared_ptr.h.
|
inline |
Definition at line 404 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::d, isOdd, and KisWeakSharedPtr< T >::weakReference.
|
inlineprivate |
Definition at line 434 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::d, KisWeakSharedPtr< T >::WEAK_REF, and KisWeakSharedPtr< T >::weakReference.
|
inline |
This operator is used in boolean expressions where we check for pointer consistency, so return 0 instead of asserting.
Definition at line 348 of file kis_shared_ptr.h.
|
inline |
Definition at line 302 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::d.
|
inline |
Definition at line 293 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::d.
|
inline |
Definition at line 287 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::d, and p.
|
inline |
Definition at line 366 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::d, KisWeakSharedPtr< T >::isValid(), kisBacktrace(), and warnKrita.
|
inline |
Definition at line 357 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::d, KisWeakSharedPtr< T >::isValid(), kisBacktrace(), and warnKrita.
|
inline |
Definition at line 384 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::d, KisWeakSharedPtr< T >::isValid(), kisBacktrace(), and warnKrita.
|
inline |
Definition at line 375 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::d, KisWeakSharedPtr< T >::isValid(), kisBacktrace(), and warnKrita.
|
inline |
Definition at line 279 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::attach().
|
inline |
Definition at line 297 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::attach(), and p.
|
inline |
Definition at line 290 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::d.
|
inline |
Definition at line 284 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::d, and p.
|
inline |
toStrongRef returns a KisSharedPtr which may be dereferenced.
Weak pointers should only be used to track ownership but never be used as pointers. This has historically not been the case, but in new API this function should be used instead of directly using a weak pointer as pointer.
Definition at line 418 of file kis_shared_ptr.h.
References KisWeakSharedPtr< T >::KisSharedPtr< T >.
|
friend |
Definition at line 227 of file kis_shared_ptr.h.
|
mutableprivate |
Definition at line 478 of file kis_shared_ptr.h.
|
staticprivate |
Definition at line 423 of file kis_shared_ptr.h.
|
private |
Definition at line 479 of file kis_shared_ptr.h.