--- a/CHANGES.html Fri Sep 30 14:25:23 2011 -0700
+++ b/CHANGES.html Tue Oct 04 18:40:50 2011 +0200
@@ -86,6 +86,13 @@
<li> WIFI_PHY_STANDARD_80211_10Mhz was changed to WIFI_PHY_STANDARD_80211_10MHZ
<li> WIFI_PHY_STANDARD_80211_5Mhz was changed to WIFI_PHY_STANDARD_80211_5MHZ
</ul>
+<li> In the SpectrumPhy base class, the methods to get/set the
+ MobilityModel and the NetDevice were previously working with
+ opaque Ptr<Object>. Now all these methods have been
+ changed so that they work with Ptr<NetDevice>
+ and Ptr<MobilityModel> as appropriate. See <A href="https://www.nsnam.org/bugzilla/show_bug.cgi?id=1271">Bug 1271</A> on
+ bugzilla for the motivation.
+</li>
</ul>
<h2>Changed behavior:</h2>
--- a/src/lte/model/lte-spectrum-phy.cc Fri Sep 30 14:25:23 2011 -0700
+++ b/src/lte/model/lte-spectrum-phy.cc Tue Oct 04 18:40:50 2011 +0200
@@ -104,7 +104,7 @@
-Ptr<Object>
+Ptr<NetDevice>
LteSpectrumPhy::GetDevice ()
{
NS_LOG_FUNCTION (this);
@@ -112,7 +112,7 @@
}
-Ptr<Object>
+Ptr<MobilityModel>
LteSpectrumPhy::GetMobility ()
{
NS_LOG_FUNCTION (this);
@@ -121,7 +121,7 @@
void
-LteSpectrumPhy::SetDevice (Ptr<Object> d)
+LteSpectrumPhy::SetDevice (Ptr<NetDevice> d)
{
NS_LOG_FUNCTION (this << d);
m_device = d;
@@ -129,7 +129,7 @@
void
-LteSpectrumPhy::SetMobility (Ptr<Object> m)
+LteSpectrumPhy::SetMobility (Ptr<MobilityModel> m)
{
NS_LOG_FUNCTION (this << m);
m_mobility = m;
--- a/src/lte/model/lte-spectrum-phy.h Fri Sep 30 14:25:23 2011 -0700
+++ b/src/lte/model/lte-spectrum-phy.h Tue Oct 04 18:40:50 2011 +0200
@@ -65,10 +65,10 @@
// inherited from SpectrumPhy
void SetChannel (Ptr<SpectrumChannel> c);
- void SetMobility (Ptr<Object> m);
- void SetDevice (Ptr<Object> d);
- Ptr<Object> GetMobility ();
- Ptr<Object> GetDevice ();
+ void SetMobility (Ptr<MobilityModel> m);
+ void SetDevice (Ptr<NetDevice> d);
+ Ptr<MobilityModel> GetMobility ();
+ Ptr<NetDevice> GetDevice ();
Ptr<const SpectrumModel> GetRxSpectrumModel () const;
/**
@@ -182,9 +182,9 @@
EventId m_endRxEventId;
- Ptr<Object> m_mobility;
+ Ptr<MobilityModel> m_mobility;
- Ptr<Object> m_device;
+ Ptr<NetDevice> m_device;
Ptr<SpectrumChannel> m_channel;
--- a/src/spectrum/helper/adhoc-aloha-noack-ideal-phy-helper.cc Fri Sep 30 14:25:23 2011 -0700
+++ b/src/spectrum/helper/adhoc-aloha-noack-ideal-phy-helper.cc Tue Oct 04 18:40:50 2011 +0200
@@ -113,7 +113,7 @@
dev->SetPhy (phy);
NS_ASSERT (node);
- phy->SetMobility (node);
+ phy->SetMobility (node->GetObject<MobilityModel> ());
NS_ASSERT (dev);
phy->SetDevice (dev);
--- a/src/spectrum/helper/spectrum-analyzer-helper.cc Fri Sep 30 14:25:23 2011 -0700
+++ b/src/spectrum/helper/spectrum-analyzer-helper.cc Tue Oct 04 18:40:50 2011 +0200
@@ -142,7 +142,7 @@
dev->SetPhy (phy);
NS_ASSERT (node);
- phy->SetMobility (node);
+ phy->SetMobility (node->GetObject<MobilityModel> ());
NS_ASSERT (dev);
phy->SetDevice (dev);
--- a/src/spectrum/helper/spectrum-helper.cc Fri Sep 30 14:25:23 2011 -0700
+++ b/src/spectrum/helper/spectrum-helper.cc Tue Oct 04 18:40:50 2011 +0200
@@ -215,7 +215,7 @@
NS_ASSERT (m_channel);
Ptr<SpectrumPhy> phy = (m_phy.Create ())->GetObject<SpectrumPhy> ();
phy->SetChannel (m_channel);
- phy->SetMobility (node);
+ phy->SetMobility (node->GetObject<MobilityModel> ());
phy->SetDevice (device);
return phy;
}
--- a/src/spectrum/helper/waveform-generator-helper.cc Fri Sep 30 14:25:23 2011 -0700
+++ b/src/spectrum/helper/waveform-generator-helper.cc Tue Oct 04 18:40:50 2011 +0200
@@ -98,7 +98,7 @@
dev->SetPhy (phy);
NS_ASSERT (node);
- phy->SetMobility (node);
+ phy->SetMobility (node->GetObject<MobilityModel> ());
NS_ASSERT (dev);
phy->SetDevice (dev);
--- a/src/spectrum/model/half-duplex-ideal-phy.cc Fri Sep 30 14:25:23 2011 -0700
+++ b/src/spectrum/model/half-duplex-ideal-phy.cc Tue Oct 04 18:40:50 2011 +0200
@@ -126,7 +126,7 @@
-Ptr<Object>
+Ptr<NetDevice>
HalfDuplexIdealPhy::GetDevice ()
{
NS_LOG_FUNCTION (this);
@@ -134,7 +134,7 @@
}
-Ptr<Object>
+Ptr<MobilityModel>
HalfDuplexIdealPhy::GetMobility ()
{
NS_LOG_FUNCTION (this);
@@ -143,7 +143,7 @@
void
-HalfDuplexIdealPhy::SetDevice (Ptr<Object> d)
+HalfDuplexIdealPhy::SetDevice (Ptr<NetDevice> d)
{
NS_LOG_FUNCTION (this << d);
m_netDevice = d;
@@ -151,7 +151,7 @@
void
-HalfDuplexIdealPhy::SetMobility (Ptr<Object> m)
+HalfDuplexIdealPhy::SetMobility (Ptr<MobilityModel> m)
{
NS_LOG_FUNCTION (this << m);
m_mobility = m;
--- a/src/spectrum/model/half-duplex-ideal-phy.h Fri Sep 30 14:25:23 2011 -0700
+++ b/src/spectrum/model/half-duplex-ideal-phy.h Tue Oct 04 18:40:50 2011 +0200
@@ -94,10 +94,10 @@
// inherited from SpectrumPhy
void SetChannel (Ptr<SpectrumChannel> c);
- void SetMobility (Ptr<Object> m);
- void SetDevice (Ptr<Object> d);
- Ptr<Object> GetMobility ();
- Ptr<Object> GetDevice ();
+ void SetMobility (Ptr<MobilityModel> m);
+ void SetDevice (Ptr<NetDevice> d);
+ Ptr<MobilityModel> GetMobility ();
+ Ptr<NetDevice> GetDevice ();
Ptr<const SpectrumModel> GetRxSpectrumModel () const;
void StartRx (Ptr<PacketBurst> p, Ptr <const SpectrumValue> rxPsd, SpectrumType st, Time duration);
@@ -195,8 +195,8 @@
EventId m_endRxEventId;
- Ptr<Object> m_mobility;
- Ptr<Object> m_netDevice;
+ Ptr<MobilityModel> m_mobility;
+ Ptr<NetDevice> m_netDevice;
Ptr<SpectrumChannel> m_channel;
Ptr<SpectrumValue> m_txPsd;
--- a/src/spectrum/model/multi-model-spectrum-channel.cc Fri Sep 30 14:25:23 2011 -0700
+++ b/src/spectrum/model/multi-model-spectrum-channel.cc Tue Oct 04 18:40:50 2011 +0200
@@ -222,7 +222,7 @@
NS_ASSERT (originalTxPowerSpectrum);
- Ptr<MobilityModel> txMobility = txPhy->GetMobility ()->GetObject<MobilityModel> ();
+ Ptr<MobilityModel> txMobility = txPhy->GetMobility ();
SpectrumModelUid_t txSpectrumModelUid = originalTxPowerSpectrum->GetSpectrumModelUid ();
NS_LOG_LOGIC (" txSpectrumModelUid " << txSpectrumModelUid);
@@ -268,7 +268,7 @@
Ptr <SpectrumValue> rxPowerSpectrum = convertedTxPowerSpectrum->Copy ();
Time delay = MicroSeconds (0);
- Ptr<MobilityModel> receiverMobility = (*rxPhyIterator)->GetMobility ()->GetObject<MobilityModel> ();
+ Ptr<MobilityModel> receiverMobility = (*rxPhyIterator)->GetMobility ();
if (txMobility && receiverMobility)
{
@@ -296,11 +296,11 @@
}
Ptr<PacketBurst> pktBurstCopy = p->Copy ();
- Ptr<Object> netDevObj = (*rxPhyIterator)->GetDevice ();
- if (netDevObj)
+ Ptr<NetDevice> netDev = (*rxPhyIterator)->GetDevice ();
+ if (netDev)
{
// the receiver has a NetDevice, so we expect that it is attached to a Node
- uint32_t dstNode = netDevObj->GetObject<NetDevice> ()->GetNode ()->GetId ();
+ uint32_t dstNode = netDev->GetNode ()->GetId ();
Simulator::ScheduleWithContext (dstNode, delay, &MultiModelSpectrumChannel::StartRx, this,
pktBurstCopy, rxPowerSpectrum, st, duration, *rxPhyIterator);
}
@@ -337,7 +337,7 @@
Ptr<NetDevice>
MultiModelSpectrumChannel::GetDevice (uint32_t i) const
{
- return m_phyVector.at (i)->GetDevice ()->GetObject<NetDevice> ();
+ return m_phyVector.at (i)->GetDevice ();
}
--- a/src/spectrum/model/single-model-spectrum-channel.cc Fri Sep 30 14:25:23 2011 -0700
+++ b/src/spectrum/model/single-model-spectrum-channel.cc Tue Oct 04 18:40:50 2011 +0200
@@ -116,7 +116,7 @@
- Ptr<MobilityModel> senderMobility = txPhy->GetMobility ()->GetObject<MobilityModel> ();
+ Ptr<MobilityModel> senderMobility = txPhy->GetMobility ();
for (PhyList::const_iterator rxPhyIterator = m_phyList.begin ();
rxPhyIterator != m_phyList.end ();
@@ -127,7 +127,7 @@
Ptr <SpectrumValue> rxPsd = Copy<SpectrumValue> (txPsd);
Time delay = MicroSeconds (0);
- Ptr<MobilityModel> receiverMobility = (*rxPhyIterator)->GetMobility ()->GetObject<MobilityModel> ();
+ Ptr<MobilityModel> receiverMobility = (*rxPhyIterator)->GetMobility ();
if (senderMobility && receiverMobility)
{
@@ -155,11 +155,11 @@
}
Ptr<PacketBurst> pktBurstCopy = p->Copy ();
- Ptr<Object> netDevObj = (*rxPhyIterator)->GetDevice ();
- if (netDevObj)
+ Ptr<NetDevice> netDev = (*rxPhyIterator)->GetDevice ();
+ if (netDev)
{
// the receiver has a NetDevice, so we expect that it is attached to a Node
- uint32_t dstNode = netDevObj->GetObject<NetDevice> ()->GetNode ()->GetId ();
+ uint32_t dstNode = netDev->GetNode ()->GetId ();
Simulator::ScheduleWithContext (dstNode, delay, &SingleModelSpectrumChannel::StartRx, this,
pktBurstCopy, rxPsd, st, duration, *rxPhyIterator);
}
--- a/src/spectrum/model/spectrum-analyzer.cc Fri Sep 30 14:25:23 2011 -0700
+++ b/src/spectrum/model/spectrum-analyzer.cc Tue Oct 04 18:40:50 2011 +0200
@@ -89,14 +89,14 @@
-Ptr<Object>
+Ptr<NetDevice>
SpectrumAnalyzer::GetDevice ()
{
return m_netDevice;
}
-Ptr<Object>
+Ptr<MobilityModel>
SpectrumAnalyzer::GetMobility ()
{
return m_mobility;
@@ -110,7 +110,7 @@
}
void
-SpectrumAnalyzer::SetDevice (Ptr<Object> d)
+SpectrumAnalyzer::SetDevice (Ptr<NetDevice> d)
{
NS_LOG_FUNCTION (this << d);
m_netDevice = d;
@@ -118,7 +118,7 @@
void
-SpectrumAnalyzer::SetMobility (Ptr<Object> m)
+SpectrumAnalyzer::SetMobility (Ptr<MobilityModel> m)
{
NS_LOG_FUNCTION (this << m);
m_mobility = m;
--- a/src/spectrum/model/spectrum-analyzer.h Fri Sep 30 14:25:23 2011 -0700
+++ b/src/spectrum/model/spectrum-analyzer.h Tue Oct 04 18:40:50 2011 +0200
@@ -53,10 +53,10 @@
// inherited from SpectrumPhy
void SetChannel (Ptr<SpectrumChannel> c);
- void SetMobility (Ptr<Object> m);
- void SetDevice (Ptr<Object> d);
- Ptr<Object> GetMobility ();
- Ptr<Object> GetDevice ();
+ void SetMobility (Ptr<MobilityModel> m);
+ void SetDevice (Ptr<NetDevice> d);
+ Ptr<MobilityModel> GetMobility ();
+ Ptr<NetDevice> GetDevice ();
Ptr<const SpectrumModel> GetRxSpectrumModel () const;
void StartRx (Ptr<PacketBurst> pb, Ptr <const SpectrumValue> rxPowerSpectralDensity, SpectrumType st, Time duration);
@@ -86,8 +86,8 @@
void DoDispose ();
private:
- Ptr<Object> m_mobility;
- Ptr<Object> m_netDevice;
+ Ptr<MobilityModel> m_mobility;
+ Ptr<NetDevice> m_netDevice;
Ptr<SpectrumChannel> m_channel;
virtual void GenerateReport ();
--- a/src/spectrum/model/spectrum-phy.h Fri Sep 30 14:25:23 2011 -0700
+++ b/src/spectrum/model/spectrum-phy.h Tue Oct 04 18:40:50 2011 +0200
@@ -54,28 +54,28 @@
*
* @param d the NetDevice instance
*/
- virtual void SetDevice (Ptr<Object> d) = 0;
+ virtual void SetDevice (Ptr<NetDevice> d) = 0;
/**
* get the associated NetDevice instance
*
* @return a Ptr to the associated NetDevice instance
*/
- virtual Ptr<Object> GetDevice () = 0;
+ virtual Ptr<NetDevice> GetDevice () = 0;
/**
* Set the mobility model associated with this device.
*
* @param m the mobility model
*/
- virtual void SetMobility (Ptr<Object> m) = 0;
+ virtual void SetMobility (Ptr<MobilityModel> m) = 0;
/**
* get the associated MobilityModel instance
*
* @return a Ptr to the associated NetDevice instance
*/
- virtual Ptr<Object> GetMobility () = 0;
+ virtual Ptr<MobilityModel> GetMobility () = 0;
/**
--- a/src/spectrum/model/waveform-generator.cc Fri Sep 30 14:25:23 2011 -0700
+++ b/src/spectrum/model/waveform-generator.cc Tue Oct 04 18:40:50 2011 +0200
@@ -89,14 +89,14 @@
-Ptr<Object>
+Ptr<NetDevice>
WaveformGenerator::GetDevice ()
{
return m_netDevice;
}
-Ptr<Object>
+Ptr<MobilityModel>
WaveformGenerator::GetMobility ()
{
return m_mobility;
@@ -111,14 +111,14 @@
}
void
-WaveformGenerator::SetDevice (Ptr<Object> d)
+WaveformGenerator::SetDevice (Ptr<NetDevice> d)
{
m_netDevice = d;
}
void
-WaveformGenerator::SetMobility (Ptr<Object> m)
+WaveformGenerator::SetMobility (Ptr<MobilityModel> m)
{
m_mobility = m;
}
--- a/src/spectrum/model/waveform-generator.h Fri Sep 30 14:25:23 2011 -0700
+++ b/src/spectrum/model/waveform-generator.h Tue Oct 04 18:40:50 2011 +0200
@@ -56,10 +56,10 @@
// inherited from SpectrumPhy
void SetChannel (Ptr<SpectrumChannel> c);
- void SetMobility (Ptr<Object> m);
- void SetDevice (Ptr<Object> d);
- Ptr<Object> GetMobility ();
- Ptr<Object> GetDevice ();
+ void SetMobility (Ptr<MobilityModel> m);
+ void SetDevice (Ptr<NetDevice> d);
+ Ptr<MobilityModel> GetMobility ();
+ Ptr<NetDevice> GetDevice ();
Ptr<const SpectrumModel> GetRxSpectrumModel () const;
void StartRx (Ptr<PacketBurst> p, Ptr <const SpectrumValue> rxPsd, SpectrumType st, Time duration);
@@ -129,8 +129,8 @@
private:
virtual void DoDispose (void);
- Ptr<Object> m_mobility;
- Ptr<Object> m_netDevice;
+ Ptr<MobilityModel> m_mobility;
+ Ptr<NetDevice> m_netDevice;
Ptr<SpectrumChannel> m_channel;
virtual void GenerateWaveform ();