convert more code to use Ptr<Node> instead of Node *
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu, 10 May 2007 07:35:53 +0200
changeset 553 eb9d614accf0
parent 552 b5f29caf9d8c
child 554 6428d95da8c3
convert more code to use Ptr<Node> instead of Node *
src/internet-node/arp-ipv4-interface.cc
src/internet-node/arp-ipv4-interface.h
src/internet-node/ipv4-loopback-interface.cc
src/internet-node/ipv4-loopback-interface.h
--- a/src/internet-node/arp-ipv4-interface.cc	Thu May 10 07:33:26 2007 +0200
+++ b/src/internet-node/arp-ipv4-interface.cc	Thu May 10 07:35:53 2007 +0200
@@ -31,16 +31,12 @@
 
 namespace ns3 {
 
-ArpIpv4Interface::ArpIpv4Interface (Node *node, NetDevice *device)
+ArpIpv4Interface::ArpIpv4Interface (Ptr<Node> node, NetDevice *device)
   : Ipv4Interface (device),
     m_node (node)
-{
-  m_node->Ref ();
-}
+{}
 ArpIpv4Interface::~ArpIpv4Interface ()
-{
-  m_node->Unref ();
-}
+{}
 
 TraceResolver *
 ArpIpv4Interface::DoCreateTraceResolver (TraceContext const &context)
--- a/src/internet-node/arp-ipv4-interface.h	Thu May 10 07:33:26 2007 +0200
+++ b/src/internet-node/arp-ipv4-interface.h	Thu May 10 07:35:53 2007 +0200
@@ -23,6 +23,7 @@
 #define ARP_IPV4_INTERFACE_H
 
 #include "ipv4-interface.h"
+#include "ns3/ptr.h"
 
 namespace ns3 {
 
@@ -42,13 +43,13 @@
     NETDEVICE,
     ARP,
   };
-  ArpIpv4Interface (Node *node, NetDevice *device);
+  ArpIpv4Interface (Ptr<Node> node, NetDevice *device);
   virtual ~ArpIpv4Interface ();
 
  private:
   virtual void SendTo (Packet p, Ipv4Address dest);
   virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context);
-  Node *m_node;
+  Ptr<Node> m_node;
 };
 
 }//namespace ns3
--- a/src/internet-node/ipv4-loopback-interface.cc	Thu May 10 07:33:26 2007 +0200
+++ b/src/internet-node/ipv4-loopback-interface.cc	Thu May 10 07:35:53 2007 +0200
@@ -27,16 +27,12 @@
 
 namespace ns3 {
 
-Ipv4LoopbackInterface::Ipv4LoopbackInterface (Node *node)
+Ipv4LoopbackInterface::Ipv4LoopbackInterface (Ptr<Node> node)
   : Ipv4Interface (0),
     m_node (node)
-{
-  m_node->Ref ();
-}
+{}
 Ipv4LoopbackInterface::~Ipv4LoopbackInterface ()
-{
-  m_node->Unref ();
-}
+{}
 
 TraceResolver *
 Ipv4LoopbackInterface::DoCreateTraceResolver (TraceContext const &context)
--- a/src/internet-node/ipv4-loopback-interface.h	Thu May 10 07:33:26 2007 +0200
+++ b/src/internet-node/ipv4-loopback-interface.h	Thu May 10 07:35:53 2007 +0200
@@ -23,6 +23,7 @@
 #define IPV4_LOOPBACK_INTERFACE_H
 
 #include "ipv4-interface.h"
+#include "ns3/ptr.h"
 
 namespace ns3 {
 
@@ -31,14 +32,14 @@
 class Ipv4LoopbackInterface : public Ipv4Interface 
 {
  public:
-  Ipv4LoopbackInterface (Node *node);
+  Ipv4LoopbackInterface (Ptr<Node> node);
   virtual ~Ipv4LoopbackInterface ();
 
  private:
   virtual void SendTo (Packet p, Ipv4Address dest);
   virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context);
 
-  Node *m_node;
+  Ptr<Node> m_node;
 };
 
 }//namespace ns3