Go to the documentation of this file.
39 #ifndef CGU_INTRUSIVE_PTR_H
40 #define CGU_INTRUSIVE_PTR_H
51 #ifdef CGU_INTRUSIVE_LOCK_COUNTER_USE_MUTEX
111 if (obj_p) obj_p->unref();
115 if (obj_p) obj_p->ref();
140 obj_p = intr_ptr.obj_p;
157 obj_p = intr_ptr.obj_p;
193 T*
get()
const {
return obj_p;}
270 if (count == 0)
delete this;
318 #ifdef CGU_INTRUSIVE_LOCK_COUNTER_USE_MUTEX
340 #ifdef CGU_INTRUSIVE_LOCK_COUNTER_USE_MUTEX
344 g_atomic_int_inc(&count);
355 #ifdef CGU_INTRUSIVE_LOCK_COUNTER_USE_MUTEX
364 if (g_atomic_int_dec_and_test(&count)) {
391 #if defined(CGU_USE_SMART_PTR_COMPARISON) || defined(DOXYGEN_PARSING)
408 return (s1.
get() == s2.
get());
447 return std::less<T*>()(s1.
get(), s2.
get());
450 #endif // CGU_USE_SMART_PTR_COMPARISON
T & operator*() const
Definition: intrusive_ptr.h:199
Definition: application.h:45
virtual ~IntrusiveLockCounter()
Definition: intrusive_ptr.h:388
This is a counter class providing the ref() and unref() functions required by IntrusivePtr.
Definition: intrusive_ptr.h:243
bool operator!=(const GobjHandle< T > &h1, const GobjHandle< T > &h2)
Definition: gobj_handle.h:618
This is a smart pointer for managing objects allocated on freestore which maintain their own referenc...
Definition: intrusive_ptr.h:106
void ref()
Definition: intrusive_ptr.h:260
void unref()
Definition: intrusive_ptr.h:354
T * operator->() const
Definition: intrusive_ptr.h:206
bool operator<(const GobjHandle< T > &h1, const GobjHandle< T > &h2)
Definition: gobj_handle.h:641
void ref()
Definition: intrusive_ptr.h:339
void swap(Cgu::AsyncQueue< T, Container > &q1, Cgu::AsyncQueue< T, Container > &q2)
Definition: async_queue.h:784
IntrusivePtr(T *ptr=0)
Definition: intrusive_ptr.h:127
IntrusivePtr(const IntrusivePtr &intr_ptr)
Definition: intrusive_ptr.h:139
IntrusiveCounter()
Definition: intrusive_ptr.h:276
IntrusivePtr & operator=(IntrusivePtr intr_ptr)
Definition: intrusive_ptr.h:170
IntrusivePtr(const IntrusivePtr< U > &intr_ptr)
Definition: intrusive_ptr.h:156
IntrusivePtr & operator=(const IntrusivePtr< U > &intr_ptr)
Definition: intrusive_ptr.h:184
T * get() const
Definition: intrusive_ptr.h:193
int lock()
Definition: mutex.h:132
A scoped locking class for exception safe Mutex locking.
Definition: mutex.h:192
friend class IntrusivePtr
Definition: intrusive_ptr.h:144
virtual ~IntrusiveCounter()
Definition: intrusive_ptr.h:282
This is a counter class providing the ref() and unref() functions required by IntrusivePtr,...
Definition: intrusive_ptr.h:317
Provides wrapper classes for pthread mutexes and condition variables, and scoped locking classes for ...
bool operator==(const GobjHandle< T > &h1, const GobjHandle< T > &h2)
Definition: gobj_handle.h:602
void unref()
Definition: intrusive_ptr.h:268
int unlock()
Definition: mutex.h:155
~IntrusivePtr()
Definition: intrusive_ptr.h:228
A wrapper class for pthread mutexes.
Definition: mutex.h:109
IntrusiveLockCounter()
Definition: intrusive_ptr.h:382
void reset(T *ptr=0)
Definition: intrusive_ptr.h:219