convert Node * to Ptr<Node>
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu, 10 May 2007 07:44:18 +0200
changeset 556 c6f107a2b886
parent 555 4d3b2a77bc92
child 557 927a5bb6432a
convert Node * to Ptr<Node>
src/internet-node/l3-demux.cc
src/internet-node/l3-demux.h
--- a/src/internet-node/l3-demux.cc	Thu May 10 07:43:52 2007 +0200
+++ b/src/internet-node/l3-demux.cc	Thu May 10 07:44:18 2007 +0200
@@ -31,12 +31,10 @@
 
 const Iid L3Demux::iid ("L3Demux");
 
-L3Demux::L3Demux (Node *node)
+L3Demux::L3Demux (Ptr<Node> node)
   : NsUnknown (L3Demux::iid),
     m_node (node)
-{
-  m_node->Ref ();
-}
+{}
 
 L3Demux::~L3Demux()
 {}
@@ -50,11 +48,7 @@
       i->second->Unref ();
     }
   m_protocols.clear ();
-  if (m_node != 0)
-    {
-      m_node->Unref ();
-      m_node = 0;
-    }
+  m_node = 0;
   NsUnknown::DoDispose ();
 }
 
--- a/src/internet-node/l3-demux.h	Thu May 10 07:43:52 2007 +0200
+++ b/src/internet-node/l3-demux.h	Thu May 10 07:44:18 2007 +0200
@@ -29,6 +29,7 @@
 
 #include <map>
 #include "ns3/ns-unknown.h"
+#include "ns3/ptr.h"
 
 namespace ns3 {
 
@@ -45,7 +46,7 @@
 public:
   static const Iid iid;
   typedef int ProtocolTraceType;
-  L3Demux(Node *node);
+  L3Demux(Ptr<Node> node);
   virtual ~L3Demux();
 
   /**
@@ -90,7 +91,7 @@
 private:
   typedef std::map<int, ns3::L3Protocol*> L3Map_t;
 
-  Node *m_node;
+  Ptr<Node> m_node;
   L3Map_t m_protocols;
 };