Utils: Fixed intrusive_refcount_t access implementation to conform to documentation
g0dil [Wed, 19 Mar 2008 15:34:10 +0000 (15:34 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@746 270642c3-0616-0410-b53a-bc976706d245

Packets/PacketInterpreter.hh
Utils/intrusive_refcount.cti
Utils/intrusive_refcount.hh

index 80bb016..b42cb19 100644 (file)
@@ -211,7 +211,7 @@ namespace senf {
         void releaseImpl();
 
         friend class detail::PacketImpl;
-        friend class intrusive_refcount_t<PacketInterpreterBase>;
+        friend class intrusive_refcount_base;
         template <class PacketType> friend class PacketInterpreter;
         friend class detail::packet::test::TestDriver;
         friend class PacketParserBase;
index a8ba41e..3e729e0 100644 (file)
 #define prefix_ inline
 ///////////////////////////////cti.p///////////////////////////////////////
 
-template <class Self>
-prefix_ void senf::intrusive_refcount_t<Self>::intrusive_ptr_add_ref()
+template <class S>
+prefix_ void senf::intrusive_refcount_base::intrusive_ptr_add_ref()
 {
-    static_cast<Self*>(this)->add_ref();
+    static_cast<S*>(this)->add_ref();
 }
 
-template <class Self>
-prefix_ void senf::intrusive_refcount_t<Self>::intrusive_ptr_release()
+template <class S>
+prefix_ void senf::intrusive_refcount_base::intrusive_ptr_release()
 {
-    if (static_cast<Self*>(this)->release()) delete this;
+    if (static_cast<S*>(this)->release()) delete this;
 }
 
 template <class Self>
 prefix_ void senf::intrusive_ptr_add_ref(intrusive_refcount_t<Self>* p)
 {
-    p->intrusive_ptr_add_ref();
+    p->intrusive_ptr_add_ref<Self>();
 }
 
 template <class Self>
 prefix_ void senf::intrusive_ptr_release(intrusive_refcount_t<Self>* p)
 {
-    p->intrusive_ptr_release();
+    p->intrusive_ptr_release<Self>();
 }
 
 template <class Self>
index 8ce5785..7fb8f18 100644 (file)
@@ -61,6 +61,13 @@ namespace senf {
     private:
         refcount_t refcount_;
         
+        template <class S> void intrusive_ptr_add_ref();
+        template <class S> void intrusive_ptr_release();
+        
+        template <class S>
+        friend void senf::intrusive_ptr_add_ref(intrusive_refcount_t<S> * p);
+        template <class S>
+        friend void senf::intrusive_ptr_release(intrusive_refcount_t<S> * p);
     };
 
     /** \brief Customizable reference count mixin for intrusive_ptr
@@ -115,15 +122,6 @@ namespace senf {
     {
     protected:
         intrusive_refcount_t();
-
-    private:
-        void intrusive_ptr_add_ref();
-        void intrusive_ptr_release();
-
-        template <class S>
-        friend void senf::intrusive_ptr_add_ref(intrusive_refcount_t<S> * p);
-        template <class S>
-        friend void senf::intrusive_ptr_release(intrusive_refcount_t<S> * p);
     };
 
     /** \brief Reference count mixin for intrusive_ptr