reSIProcate/rutil  9694
Public Member Functions | Private Member Functions | Private Attributes
resip::sp_counted_base Class Reference

#include <SharedCount.hxx>

Inheritance diagram for resip::sp_counted_base:
Inheritance graph
[legend]
Collaboration diagram for resip::sp_counted_base:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 sp_counted_base ()
virtual ~sp_counted_base ()
virtual void dispose ()=0
virtual void destruct ()
virtual void * get_deleter (std::type_info const &ti)=0
void add_ref_copy ()
void add_ref_lock ()
void release ()
void weak_add_ref ()
void weak_release ()
long use_count () const

Private Member Functions

 sp_counted_base (sp_counted_base const &)
sp_counted_baseoperator= (sp_counted_base const &)

Private Attributes

long use_count_
long weak_count_
Mutex mMutex

Detailed Description

Definition at line 75 of file SharedCount.hxx.


Constructor & Destructor Documentation

resip::sp_counted_base::sp_counted_base ( ) [inline]

Definition at line 81 of file SharedCount.hxx.

                    : use_count_(1), weak_count_(1)
   {
   }
virtual resip::sp_counted_base::~sp_counted_base ( ) [inline, virtual]

Definition at line 85 of file SharedCount.hxx.

   {
   }
resip::sp_counted_base::sp_counted_base ( sp_counted_base const &  ) [private]

Member Function Documentation

void resip::sp_counted_base::add_ref_copy ( ) [inline]

Definition at line 101 of file SharedCount.hxx.

References mMutex, and use_count_.

Referenced by resip::shared_count::operator=(), and resip::shared_count::shared_count().

   {
      Lock lock(mMutex); (void)lock;
      ++use_count_;
      //GenericLog(Subsystem::SIP, resip::Log::Info, << "********* SharedCount::add_ref_copy: " << use_count_);
   }
void resip::sp_counted_base::add_ref_lock ( ) [inline]

Definition at line 108 of file SharedCount.hxx.

References mMutex, and use_count_.

   {
      Lock lock(mMutex); (void)lock;
      // if(use_count_ == 0) throw(resip::bad_weak_ptr());
      if (use_count_ == 0) throw resip::bad_weak_ptr();
      ++use_count_;
      //GenericLog(Subsystem::SIP, resip::Log::Info, << "********* SharedCount::add_ref_lock: " << use_count_);
   }
virtual void resip::sp_counted_base::destruct ( ) [inline, virtual]

Definition at line 94 of file SharedCount.hxx.

Referenced by weak_release().

   {
       delete this;
   }
virtual void resip::sp_counted_base::dispose ( ) [pure virtual]

Implemented in resip::sp_counted_base_impl< P, D >.

Referenced by release().

virtual void* resip::sp_counted_base::get_deleter ( std::type_info const &  ti) [pure virtual]
sp_counted_base& resip::sp_counted_base::operator= ( sp_counted_base const &  ) [private]
void resip::sp_counted_base::release ( ) [inline]

Definition at line 117 of file SharedCount.hxx.

References dispose(), mMutex, use_count_, and weak_release().

Referenced by resip::shared_count::operator=(), resip::shared_count::shared_count(), and resip::shared_count::~shared_count().

   {
      {
         Lock lock(mMutex); (void)lock;
         long new_use_count = --use_count_;
         //GenericLog(Subsystem::SIP, resip::Log::Info, << "********* SharedCount::release: " << use_count_);

         if(new_use_count != 0) return;
      }

      dispose();
      weak_release();
   }

Here is the call graph for this function:

long resip::sp_counted_base::use_count ( ) const [inline]

Definition at line 152 of file SharedCount.hxx.

References mMutex, and use_count_.

Referenced by resip::shared_count::use_count().

   {
      Lock lock(mMutex); (void)lock;
      return use_count_;
   }
void resip::sp_counted_base::weak_add_ref ( ) [inline]

Definition at line 131 of file SharedCount.hxx.

References mMutex, and weak_count_.

   {
      Lock lock(mMutex); (void)lock;
      ++weak_count_;
   }
void resip::sp_counted_base::weak_release ( ) [inline]

Definition at line 137 of file SharedCount.hxx.

References destruct(), mMutex, and weak_count_.

Referenced by release().

   {
      long new_weak_count;

      {
         Lock lock(mMutex); (void)lock;
         new_weak_count = --weak_count_;
      }

      if(new_weak_count == 0)
      {
          destruct();
      }
   }

Here is the call graph for this function:


Member Data Documentation

Definition at line 163 of file SharedCount.hxx.

Referenced by add_ref_copy(), add_ref_lock(), release(), and use_count().

Definition at line 164 of file SharedCount.hxx.

Referenced by weak_add_ref(), and weak_release().


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