InspIRCd  3.0
Public Member Functions | Static Public Member Functions | List of all members
refcountbase Class Reference

#include <base.h>

Inheritance diagram for refcountbase:
ConfigTag ConnectClass OperInfo

Public Member Functions

unsigned int GetReferenceCount () const
void refcount_inc () const
bool refcount_dec () const

Static Public Member Functions

static void * operator new (size_t, void *m)
static void * operator new (size_t)
static void operator delete (void *)

Detailed Description

The base class for inspircd classes that support reference counting. Any objects that do not have a well-defined lifetime should inherit from this, and should be assigned to a reference<type> object to establish their lifetime.

Reference objects should not hold circular references back to themselves, even indirectly; this will cause a memory leak because the count will never drop to zero.

Using a normal pointer for the object is recommended if you can assure that at least one reference<> will remain as long as that pointer is used; this will avoid the slight overhead of changing the reference count.

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