dispose properly from Node::Dispose

Mathieu Lacage 2007-05-02 09:16:58 +02:00
parent fb6b984be4
commit 8c580647fd
1 changed files with 9 additions and 0 deletions

View File

@ -24,6 +24,7 @@
#include "node.h"
#include "node-list.h"
#include "net-device.h"
namespace ns3{
@ -89,6 +90,14 @@ Node::GetNDevices (void) const
void Node::Dispose()
{
for (std::vector<NetDevice *>::iterator i = m_devices.begin ();
i != m_devices.end (); i++)
{
NetDevice *device = *i;
device->Dispose ();
device->Unref ();
}
m_devices.erase (m_devices.begin (), m_devices.end ());
}
// Node stack creation and management routines.