src/core/callback.h
changeset 5505 c0ac392289c3
parent 4205 751691462d36
child 6273 8d70de29d514
     1.1 --- a/src/core/callback.h	Sun Feb 22 17:28:45 2009 +0100
     1.2 +++ b/src/core/callback.h	Thu Nov 12 13:01:01 2009 +0100
     1.3 @@ -27,6 +27,7 @@
     1.4  #include "type-traits.h"
     1.5  #include "attribute.h"
     1.6  #include "attribute-helper.h"
     1.7 +#include "simple-ref-count.h"
     1.8  #include <typeinfo>
     1.9  
    1.10  namespace ns3 {
    1.11 @@ -72,25 +73,11 @@
    1.12    }
    1.13  };
    1.14  
    1.15 -class CallbackImplBase
    1.16 +class CallbackImplBase : public SimpleRefCount<CallbackImplBase>
    1.17  {
    1.18  public:
    1.19 -  CallbackImplBase ()
    1.20 -    : m_count (1) {}
    1.21    virtual ~CallbackImplBase () {}
    1.22 -  void Ref (void) const {
    1.23 -    m_count++;
    1.24 -  }
    1.25 -  void Unref (void) const {
    1.26 -    m_count--;
    1.27 -    if (m_count == 0) {
    1.28 -      delete this;
    1.29 -    }
    1.30 -  }
    1.31 -  uint32_t GetReferenceCount (void) const { return m_count; }
    1.32    virtual bool IsEqual (Ptr<const CallbackImplBase> other) const = 0;
    1.33 -private:
    1.34 -  mutable uint32_t m_count;
    1.35  };
    1.36  
    1.37  // declare the CallbackImpl class