Store a guarded pointer, synchronizing other copies of this pointer. More...
#include <klfutil.h>
Public Types | |
typedef T * | Pointer |
Public Member Functions | |
KLFSyncGuardPtr () | |
~KLFSyncGuardPtr () | |
KLFSyncGuardPtr (const KLFSyncGuardPtr ©) | |
KLFSyncGuardPtr (T *obj) | |
Pointer | ptr () |
operator T* () | |
operator const T * () | |
T * | operator() () |
const T * | operator() () const |
T & | operator* () |
const T & | operator* () const |
T * | operator-> () |
const T * | operator-> () const |
Pointer | operator= (Pointer p) |
const KLFSyncGuardPtr & | operator= (const KLFSyncGuardPtr ©) |
void | invalidate () |
void | reset () |
Store a guarded pointer, synchronizing other copies of this pointer.
Stores a pointer to any object. Copies may be made of the KLFSyncGuardPtr<T> pointer and used normally. Once you destroy the pointed object using one of these pointers, then set that pointer to NULL and automatically all copies of that pointer will be set to NULL too.
Minimal example:
Note that if you assign another KLFSyncGuardPtr-guarded pointed object to a KLFSyncGuardPtr which is already tracking a pointer, then a warning is emitted. This is to avoid design flaws where in that case, the assignment will cause the current KLFSyncGuardPtr to become a copy of the new KLFSyncGuardPtr and all copies of the original pointer will become independant and unaffected. Example:
Use reset() to detach from other copies and start fresh again.
typedef T* KLFSyncGuardPtr< T >::Pointer |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 908 of file klfutil.h.
References KLFPointerGuard::ptr.
Referenced by KLFSyncGuardPtr< T >::operator=().
|
inline |
Definition at line 866 of file klfutil.h.
References KLFSyncGuardPtr< T >::ptr().
|
inline |
|
inline |
|
inline |
Definition at line 871 of file klfutil.h.
References KLFSyncGuardPtr< T >::ptr().
|
inline |
|
inline |
Definition at line 876 of file klfutil.h.
References KLFSyncGuardPtr< T >::ptr().
|
inline |
|
inline |
Definition at line 881 of file klfutil.h.
References KLFSyncGuardPtr< T >::ptr().
|
inline |
Definition at line 900 of file klfutil.h.
References KLF_ASSERT_CONDITION, and KLFPointerGuard::ptr.
|
inline |
Definition at line 885 of file klfutil.h.
References KLFSyncGuardPtr< T >::invalidate(), klfWarning, and KLFPointerGuard::ptr.
|
inline |
Definition at line 857 of file klfutil.h.
References KLFPointerGuard::ptr.
Referenced by KLFSyncGuardPtr< T >::operator const T *(), KLFSyncGuardPtr< T >::operator()(), KLFSyncGuardPtr< T >::operator*(), and KLFSyncGuardPtr< T >::operator->().
|
inline |
Definition at line 914 of file klfutil.h.
References KLFRefPtr< T >::setNull().