constify refcounted object base class
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu, 03 May 2007 00:23:23 +0200
changeset 502 1b13c6e1ca1b
parent 501 612bd30cb669
child 503 38f16e0e5513
constify refcounted object base class
src/core/object.cc
src/core/object.h
--- a/src/core/object.cc	Thu May 03 00:12:39 2007 +0200
+++ b/src/core/object.cc	Thu May 03 00:23:23 2007 +0200
@@ -35,7 +35,7 @@
 }
 
 void 
-Object::Ref (void)
+Object::Ref (void) const
 {
   NS_DEBUG("Object::Ref (): this == 0x" << this);
   m_count++;
@@ -43,7 +43,7 @@
 }
 
 void 
-Object::Unref (void)
+Object::Unref (void) const
 {
   NS_DEBUG("Object::Unref (): this == 0x" << this);
   m_count--;
@@ -57,7 +57,7 @@
 }
 
 bool 
-Object::IsSingle (void)
+Object::IsSingle (void) const
 {
   NS_DEBUG("Object::IsSingle (): m_count == " << m_count);
   return m_count == 1;
--- a/src/core/object.h	Thu May 03 00:12:39 2007 +0200
+++ b/src/core/object.h	Thu May 03 00:23:23 2007 +0200
@@ -30,12 +30,12 @@
 public:
   Object ();
   virtual ~Object ();
-  void Ref (void);
-  void Unref (void);
-  bool IsSingle (void);
+  void Ref (void) const;
+  void Unref (void) const;
+  bool IsSingle (void) const;
   virtual void Dispose (void);
 private:
-  uint32_t m_count;
+  mutable uint32_t m_count;
 };
 
 }//namespace ns3