X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2Fintrusive_refcount.hh;h=a0c36e0ffae9fbf001568f5bdea146fc754e653a;hb=9a988902090d28007578e93bffd809f6bd913155;hp=60a60e69bc70e3687a01ba9e05d3eb817074da2b;hpb=ac6a813d9d99f7add4e13aff7a4bcd314d5604a6;p=senf.git diff --git a/Utils/intrusive_refcount.hh b/Utils/intrusive_refcount.hh index 60a60e6..a0c36e0 100644 --- a/Utils/intrusive_refcount.hh +++ b/Utils/intrusive_refcount.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2006 +// Copyright (C) 2006 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) // Kompetenzzentrum fuer Satelitenkommunikation (SatCom) // Stefan Bund @@ -20,6 +20,9 @@ // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +/** \file + \brief intrusive_refcount public header */ + #ifndef HH_intrusive_refcount_ #define HH_intrusive_refcount_ 1 @@ -31,23 +34,32 @@ namespace senf { + /** \brief Reference count mixin for intrusive_ptr + + This class provides a simple internally managed refcount and supplies the boost::intrusive_ptr + required interface. To make a class compatible with \c boost::intrusive_ptr, just derive + publicly from intrusive_refcount. - /** \brief + Two additional benefits of using intrusive_refcount are + \li The object can access it's own refcount + \li It is valid and safe to convert a plain object pointer to an intrusive_ptr at any time + (not only after new) */ class intrusive_refcount : public boost::noncopyable { public: - typedef unsigned refcount_t; + typedef unsigned refcount_t; ///< reference count type virtual ~intrusive_refcount(); - refcount_t refcount(); - bool is_shared(); + refcount_t refcount(); ///< current refcount + bool is_shared(); ///< return \c true if refcount() > 1 protected: intrusive_refcount(); - + private: void add_ref(); bool release(); @@ -60,7 +72,6 @@ namespace senf { void intrusive_ptr_add_ref(intrusive_refcount* p); void intrusive_ptr_release(intrusive_refcount* p); - } ///////////////////////////////hh.e//////////////////////////////////////// @@ -72,5 +83,8 @@ namespace senf { // Local Variables: // mode: c++ +// fill-column: 100 // c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" // End: