Removed manual ref/unref calls for Ptr<Node>
parent
ecfcfa977d
commit
de3b9c78f3
|
@ -184,11 +184,11 @@ int main (int argc, char *argv[])
|
||||||
ipv4->SetDefaultRoute (Ipv4Address ("10.1.3.1"), 1);
|
ipv4->SetDefaultRoute (Ipv4Address ("10.1.3.1"), 1);
|
||||||
ipv4->Unref ();
|
ipv4->Unref ();
|
||||||
|
|
||||||
n0->Unref ();
|
n0 = 0;
|
||||||
n1->Unref ();
|
n1 = 0;
|
||||||
n2->Unref ();
|
n2 = 0;
|
||||||
n3->Unref ();
|
n3 = 0;
|
||||||
|
|
||||||
// Configure tracing of all enqueue, dequeue, and NetDevice receive events
|
// Configure tracing of all enqueue, dequeue, and NetDevice receive events
|
||||||
// Trace output will be sent to the simple-p2p.tr file
|
// Trace output will be sent to the simple-p2p.tr file
|
||||||
AsciiTrace asciitrace ("simple-p2p.tr");
|
AsciiTrace asciitrace ("simple-p2p.tr");
|
||||||
|
|
|
@ -39,7 +39,6 @@ Application::Application(Ptr<Node> n)
|
||||||
m_startVar(0), m_stopVar(0),
|
m_startVar(0), m_stopVar(0),
|
||||||
m_start(false), m_stop(false)
|
m_start(false), m_stop(false)
|
||||||
{
|
{
|
||||||
m_node->Ref ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::Application(const Application& o)
|
Application::Application(const Application& o)
|
||||||
|
@ -47,7 +46,6 @@ Application::Application(const Application& o)
|
||||||
m_start(false), m_stop(false)
|
m_start(false), m_stop(false)
|
||||||
{ // Copy constructor
|
{ // Copy constructor
|
||||||
m_node = o.m_node;
|
m_node = o.m_node;
|
||||||
m_node->Ref ();
|
|
||||||
// Copy the start and stop random variables if they exist
|
// Copy the start and stop random variables if they exist
|
||||||
if (o.m_startVar) m_startVar = o.m_startVar->Copy();
|
if (o.m_startVar) m_startVar = o.m_startVar->Copy();
|
||||||
if (o.m_stopVar) m_stopVar = o.m_stopVar->Copy();
|
if (o.m_stopVar) m_stopVar = o.m_stopVar->Copy();
|
||||||
|
@ -65,7 +63,6 @@ Application::DoDispose (void)
|
||||||
{
|
{
|
||||||
if (m_node != 0)
|
if (m_node != 0)
|
||||||
{
|
{
|
||||||
m_node->Unref ();
|
|
||||||
m_node = 0;
|
m_node = 0;
|
||||||
}
|
}
|
||||||
if (m_start)
|
if (m_start)
|
||||||
|
@ -87,10 +84,7 @@ Application::DoDispose (void)
|
||||||
Application& Application::operator=(const Application& rhs)
|
Application& Application::operator=(const Application& rhs)
|
||||||
{
|
{
|
||||||
if (this == &rhs) return *this; // Self assignment
|
if (this == &rhs) return *this; // Self assignment
|
||||||
m_node->Unref ();
|
|
||||||
m_node = 0;
|
|
||||||
m_node = rhs.m_node;
|
m_node = rhs.m_node;
|
||||||
m_node->Ref ();
|
|
||||||
|
|
||||||
delete m_startVar;
|
delete m_startVar;
|
||||||
m_startVar = 0;
|
m_startVar = 0;
|
||||||
|
@ -149,12 +143,7 @@ void Application::Stop(const RandomVariable& stopVar)
|
||||||
// an application to a node.
|
// an application to a node.
|
||||||
void Application::SetNode(Ptr<Node> n)
|
void Application::SetNode(Ptr<Node> n)
|
||||||
{
|
{
|
||||||
if (m_node != 0)
|
|
||||||
{
|
|
||||||
m_node->Unref ();
|
|
||||||
}
|
|
||||||
m_node = n;
|
m_node = n;
|
||||||
m_node->Ref ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ptr<Node> Application::PeekNode() const
|
Ptr<Node> Application::PeekNode() const
|
||||||
|
|
|
@ -40,12 +40,10 @@ NetDevice::NetDevice(Ptr<Node> node, const MacAddress& addr) :
|
||||||
m_isMulticast (false),
|
m_isMulticast (false),
|
||||||
m_isPointToPoint (false)
|
m_isPointToPoint (false)
|
||||||
{
|
{
|
||||||
m_node->Ref ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NetDevice::~NetDevice ()
|
NetDevice::~NetDevice ()
|
||||||
{
|
{
|
||||||
m_node->Unref ();
|
|
||||||
m_node = 0;
|
m_node = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue