Fix 'compiled' check in SConstruct
[senf.git] / Utils / intrusive_refcount.hh
1 // $Id$
2 //
3 // Copyright (C) 2006 
4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 //     Stefan Bund <stefan.bund@fokus.fraunhofer.de>
7 //
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.
12 //
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.
17 //
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.
22
23 #ifndef HH_intrusive_refcount_
24 #define HH_intrusive_refcount_ 1
25
26 // Custom includes
27 #include <boost/utility.hpp>
28
29 //#include "intrusive_refcount.mpp"
30 ///////////////////////////////hh.p////////////////////////////////////////
31
32 namespace senf {
33
34
35     /** \brief
36      */
37     class intrusive_refcount
38         : public boost::noncopyable
39     {
40     public:
41         typedef unsigned refcount_t;
42
43         virtual ~intrusive_refcount();
44
45         refcount_t refcount();
46         bool is_shared();
47
48     protected:
49         intrusive_refcount();
50         
51     private:
52         void add_ref();
53         bool release();
54
55         refcount_t refcount_;
56
57         friend void senf::intrusive_ptr_add_ref(intrusive_refcount* p);
58         friend void senf::intrusive_ptr_release(intrusive_refcount* p);
59     };
60
61     void intrusive_ptr_add_ref(intrusive_refcount* p);
62     void intrusive_ptr_release(intrusive_refcount* p);
63 }
64
65 ///////////////////////////////hh.e////////////////////////////////////////
66 #include "intrusive_refcount.cci"
67 //#include "intrusive_refcount.ct"
68 //#include "intrusive_refcount.cti"
69 #endif
70
71 \f
72 // Local Variables:
73 // mode: c++
74 // c-file-style: "senf"
75 // End: