wave: (fixes #341) Resolve reference cycles
This commit is contained in:
@@ -51,12 +51,6 @@ ChannelManager::ChannelManager ()
|
||||
ChannelManager::~ChannelManager ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
std::map<uint32_t, WaveChannel *> ::iterator i;
|
||||
for (i = m_channels.begin (); i != m_channels.end (); ++i)
|
||||
{
|
||||
delete (i->second);
|
||||
}
|
||||
m_channels.clear ();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
@@ -175,4 +169,16 @@ ChannelManager::GetManagementPowerLevel (uint32_t channelNumber)
|
||||
return m_channels[channelNumber]->txPowerLevel;
|
||||
}
|
||||
|
||||
void
|
||||
ChannelManager::DoDispose (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
std::map<uint32_t, WaveChannel *> ::iterator i;
|
||||
for (i = m_channels.begin (); i != m_channels.end (); ++i)
|
||||
{
|
||||
delete (i->second);
|
||||
}
|
||||
m_channels.clear ();
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -132,6 +132,9 @@ public:
|
||||
*/
|
||||
uint32_t GetManagementPowerLevel (uint32_t channelNumber);
|
||||
|
||||
protected:
|
||||
virtual void DoDispose (void);
|
||||
|
||||
private:
|
||||
/// 1609.4-2010 Annex H
|
||||
static const uint32_t DEFAULT_OPERATING_CLASS = 17;
|
||||
|
||||
@@ -160,4 +160,11 @@ ChannelScheduler::StopSch (uint32_t channelNumber)
|
||||
return ReleaseAccess (channelNumber);
|
||||
}
|
||||
|
||||
void
|
||||
ChannelScheduler::DoDispose (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_device = 0;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -195,6 +195,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void DoInitialize (void);
|
||||
virtual void DoDispose (void);
|
||||
|
||||
/**
|
||||
* \param channelNumber the specific channel
|
||||
|
||||
@@ -111,6 +111,7 @@ DefaultChannelScheduler::DoDispose (void)
|
||||
{
|
||||
m_waitEvent.Cancel ();
|
||||
}
|
||||
m_phy = 0;
|
||||
ChannelScheduler::DoDispose ();
|
||||
}
|
||||
|
||||
|
||||
@@ -459,4 +459,11 @@ OcbWifiMac::EnableForWave (Ptr<WaveNetDevice> device)
|
||||
StaticCast<WaveFrameExchangeManager> (m_feManager)->SetWaveNetDevice (device);
|
||||
}
|
||||
|
||||
void
|
||||
OcbWifiMac::DoDispose (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
RegularWifiMac::DoDispose ();
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -175,6 +175,8 @@ public:
|
||||
|
||||
// Inherited from base class
|
||||
virtual void ConfigureStandard (enum WifiStandard standard);
|
||||
protected:
|
||||
virtual void DoDispose (void);
|
||||
private:
|
||||
virtual void Receive (Ptr<WifiMacQueueItem> mpdu);
|
||||
|
||||
|
||||
@@ -163,5 +163,13 @@ WaveFrameExchangeManager::StartTransmission (Ptr<Txop> dcf)
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
WaveFrameExchangeManager::DoDispose (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_scheduler = 0;
|
||||
m_coordinator = 0;
|
||||
FrameExchangeManager::DoDispose ();
|
||||
}
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
@@ -63,6 +63,10 @@ public:
|
||||
*/
|
||||
void SetWaveNetDevice (Ptr<WaveNetDevice> device);
|
||||
|
||||
protected:
|
||||
// Overridden from FrameExchangeManager
|
||||
virtual void DoDispose (void);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Return a TXVECTOR for the DATA frame given the destination.
|
||||
|
||||
@@ -117,6 +117,7 @@ WaveNetDevice::DoDispose (void)
|
||||
mac->Dispose ();
|
||||
}
|
||||
m_macEntities.clear ();
|
||||
m_phyEntities.clear ();
|
||||
m_channelCoordinator->Dispose ();
|
||||
m_channelManager->Dispose ();
|
||||
m_channelScheduler->Dispose ();
|
||||
@@ -126,7 +127,7 @@ WaveNetDevice::DoDispose (void)
|
||||
m_channelScheduler = 0;
|
||||
m_vsaManager = 0;
|
||||
// chain up.
|
||||
NetDevice::DoDispose ();
|
||||
WifiNetDevice::DoDispose ();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -635,16 +636,6 @@ WaveNetDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protocol)
|
||||
return true;
|
||||
}
|
||||
|
||||
Ptr<Node>
|
||||
WaveNetDevice::GetNode (void) const
|
||||
{
|
||||
return m_node;
|
||||
}
|
||||
void
|
||||
WaveNetDevice::SetNode (Ptr<Node> node)
|
||||
{
|
||||
m_node = node;
|
||||
}
|
||||
bool
|
||||
WaveNetDevice::NeedsArp (void) const
|
||||
{
|
||||
|
||||
@@ -343,8 +343,6 @@ public:
|
||||
virtual Address GetMulticast (Ipv4Address multicastGroup) const;
|
||||
virtual bool IsPointToPoint (void) const;
|
||||
virtual bool IsBridge (void) const;
|
||||
virtual Ptr<Node> GetNode (void) const;
|
||||
virtual void SetNode (Ptr<Node> node);
|
||||
virtual bool NeedsArp (void) const;
|
||||
virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb);
|
||||
virtual Address GetMulticast (Ipv6Address addr) const;
|
||||
@@ -401,7 +399,6 @@ private:
|
||||
TracedCallback<Address, Address> m_addressChange;
|
||||
|
||||
// copy from WifiNetDevice
|
||||
Ptr<Node> m_node; ///< the node
|
||||
NetDevice::ReceiveCallback m_forwardUp; ///< forward up receive callback
|
||||
NetDevice::PromiscReceiveCallback m_promiscRx; ///< promiscious receive callback
|
||||
uint32_t m_ifIndex; ///< IF index
|
||||
|
||||
Reference in New Issue
Block a user