c++-gtk-utils
Public Member Functions | List of all members
Cgu::IntrusiveCounter Class Reference

This is a counter class providing the ref() and unref() functions required by IntrusivePtr. More...

#include <c++-gtk-utils/intrusive_ptr.h>

Public Member Functions

 IntrusiveCounter (const IntrusiveCounter &)=delete
 
IntrusiveCounteroperator= (const IntrusiveCounter &)=delete
 
void ref () noexcept
 
void unref ()
 
 IntrusiveCounter () noexcept
 
virtual ~IntrusiveCounter ()
 

Detailed Description

This is a counter class providing the ref() and unref() functions required by IntrusivePtr.

See also
IntrusiveLockCounter.

This is a counter class providing the ref() and unref() functions required by IntrusivePtr. It is intended to be inherited from by classes which are to be managed by such a smart pointer.

Constructor & Destructor Documentation

◆ IntrusiveCounter() [1/2]

Cgu::IntrusiveCounter::IntrusiveCounter ( const IntrusiveCounter )
delete

This class cannot be copied. The copy constructor is deleted.

◆ IntrusiveCounter() [2/2]

Cgu::IntrusiveCounter::IntrusiveCounter ( )
inlinenoexcept

The constructor does not throw.

◆ ~IntrusiveCounter()

virtual Cgu::IntrusiveCounter::~IntrusiveCounter ( )
inlinevirtual

This destructor does not throw, unless the destructor of a derived class throws - that should never happen.

Member Function Documentation

◆ operator=()

IntrusiveCounter& Cgu::IntrusiveCounter::operator= ( const IntrusiveCounter )
delete

This class cannot be copied. The assignment operator is deleted.

◆ ref()

void Cgu::IntrusiveCounter::ref ( )
inlinenoexcept

Increments the reference count. This method does not throw.

◆ unref()

void Cgu::IntrusiveCounter::unref ( )
inline

Decrements the reference count, and if the count reaches 0 deletes itself (ie the managed object). This method does not throw unless the destructor of a derived class throws - that should never happen.


The documentation for this class was generated from the following file: