implement properly NetDevice::DoDispose and rename NetDevice::PeekNode to NetDevice::GetNode

Mathieu Lacage 2007-05-10 08:18:41 +02:00
parent 96f4b45eab
commit e322d7f1df
4 changed files with 13 additions and 13 deletions

View File

@ -79,13 +79,13 @@ PointToPointTopology::AddIpv4Addresses(
NetDevice* nd1 = chan->GetDevice (0);
NetDevice* nd2 = chan->GetDevice (1);
// Make sure that nd1 belongs to n1 and nd2 to n2
if ( (nd1->PeekNode ()->GetId () == n2->GetId () ) &&
(nd2->PeekNode ()->GetId () == n1->GetId () ) )
if ( (nd1->GetNode ()->GetId () == n2->GetId () ) &&
(nd2->GetNode ()->GetId () == n1->GetId () ) )
{
std::swap(nd1, nd2);
}
NS_ASSERT (nd1->PeekNode ()->GetId () == n1->GetId ());
NS_ASSERT (nd2->PeekNode ()->GetId () == n2->GetId ());
NS_ASSERT (nd1->GetNode ()->GetId () == n1->GetId ());
NS_ASSERT (nd2->GetNode ()->GetId () == n2->GetId ());
IIpv4 *ip1 = n1->QueryInterface<IIpv4> (IIpv4::iid);
uint32_t index1 = ip1->AddInterface (nd1);

View File

@ -19,10 +19,11 @@
//
// Topology helper for ns3.
// George F. Riley, Georgia Tech, Spring 2007
#include "ns3/ptr.h"
#ifndef __POINT_TO_POINT_TOPOLOGY_H__
#define __POINT_TO_POINT_TOPOLOGY_H__
#include "ns3/ptr.h"
// The topology class consists of only static methods thar are used to
// create the topology and data flows for an ns3 simulation

View File

@ -39,13 +39,10 @@ NetDevice::NetDevice(Ptr<Node> node, const MacAddress& addr) :
m_isBroadcast (false),
m_isMulticast (false),
m_isPointToPoint (false)
{
}
{}
NetDevice::~NetDevice ()
{
m_node = 0;
}
{}
MacAddress
NetDevice::GetAddress (void) const
@ -227,7 +224,7 @@ NetDevice::NotifyLinkDown (void)
}
Ptr<Node>
NetDevice::PeekNode (void) const
NetDevice::GetNode (void) const
{
return m_node;
}
@ -246,6 +243,8 @@ NetDevice::SetReceiveCallback (Callback<bool,NetDevice *,const Packet &,uint16_t
void
NetDevice::DoDispose()
{}
{
m_node = 0;
}
}; // namespace ns3

View File

@ -170,7 +170,7 @@ public:
* base class to print the nodeid for example, it can invoke
* this method.
*/
Ptr<Node> PeekNode (void) const;
Ptr<Node> GetNode (void) const;
bool NeedsArp (void) const;