4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 // Stefan Bund <stefan.bund@fokus.fraunhofer.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief intrusive_refcount public header */
26 #ifndef HH_intrusive_refcount_
27 #define HH_intrusive_refcount_ 1
30 #include <boost/utility.hpp>
32 //#include "intrusive_refcount.mpp"
33 ///////////////////////////////hh.p////////////////////////////////////////
37 /** \brief Reference count mixin for intrusive_ptr
39 This class provides a simple internally managed refcount and supplies the <a
40 href="http://www.boost.org/libs/smart_ptr/intrusive_ptr.html">boost::intrusive_ptr</a>
41 required interface. To make a class compatible with \c boost::intrusive_ptr, just derive
42 publicly from intrusive_refcount.
44 Two additional benefits of using intrusive_refcount are
45 \li The object can access it's own refcount
46 \li It is valid and safe to convert a plain object pointer to an intrusive_ptr at any time
49 class intrusive_refcount
50 : public boost::noncopyable
53 typedef unsigned refcount_t; ///< reference count type
55 virtual ~intrusive_refcount();
57 refcount_t refcount(); ///< current refcount
58 bool is_shared(); ///< return \c true if refcount() > 1
69 friend void senf::intrusive_ptr_add_ref(intrusive_refcount* p);
70 friend void senf::intrusive_ptr_release(intrusive_refcount* p);
73 void intrusive_ptr_add_ref(intrusive_refcount* p);
74 void intrusive_ptr_release(intrusive_refcount* p);
77 ///////////////////////////////hh.e////////////////////////////////////////
78 #include "intrusive_refcount.cci"
79 //#include "intrusive_refcount.ct"
80 //#include "intrusive_refcount.cti"
87 // c-file-style: "senf"
88 // indent-tabs-mode: nil
89 // ispell-local-dictionary: "american"