diff -r 2fa7219968b3 CHANGES.html
--- a/CHANGES.html Wed Sep 28 14:03:25 2011 +0100
+++ b/CHANGES.html Wed Sep 28 19:03:44 2011 +0200
@@ -86,6 +86,13 @@
WIFI_PHY_STANDARD_80211_10Mhz was changed to WIFI_PHY_STANDARD_80211_10MHZ
WIFI_PHY_STANDARD_80211_5Mhz was changed to WIFI_PHY_STANDARD_80211_5MHZ
+ 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 Bug 1271 on
+ bugzilla for the motivation.
+
Changed behavior:
diff -r 2fa7219968b3 src/lte/model/lte-spectrum-phy.cc
--- a/src/lte/model/lte-spectrum-phy.cc Wed Sep 28 14:03:25 2011 +0100
+++ b/src/lte/model/lte-spectrum-phy.cc Wed Sep 28 19:03:44 2011 +0200
@@ -104,7 +104,7 @@
-Ptr
+Ptr
LteSpectrumPhy::GetDevice ()
{
NS_LOG_FUNCTION (this);
@@ -112,7 +112,7 @@
}
-Ptr
+Ptr
LteSpectrumPhy::GetMobility ()
{
NS_LOG_FUNCTION (this);
@@ -121,7 +121,7 @@
void
-LteSpectrumPhy::SetDevice (Ptr d)
+LteSpectrumPhy::SetDevice (Ptr d)
{
NS_LOG_FUNCTION (this << d);
m_device = d;
@@ -129,7 +129,7 @@
void
-LteSpectrumPhy::SetMobility (Ptr m)
+LteSpectrumPhy::SetMobility (Ptr m)
{
NS_LOG_FUNCTION (this << m);
m_mobility = m;
diff -r 2fa7219968b3 src/lte/model/lte-spectrum-phy.h
--- a/src/lte/model/lte-spectrum-phy.h Wed Sep 28 14:03:25 2011 +0100
+++ b/src/lte/model/lte-spectrum-phy.h Wed Sep 28 19:03:44 2011 +0200
@@ -65,10 +65,10 @@
// inherited from SpectrumPhy
void SetChannel (Ptr c);
- void SetMobility (Ptr m);
- void SetDevice (Ptr d);
- Ptr GetMobility ();
- Ptr GetDevice ();
+ void SetMobility (Ptr m);
+ void SetDevice (Ptr d);
+ Ptr GetMobility ();
+ Ptr GetDevice ();
Ptr GetRxSpectrumModel () const;
/**
@@ -182,9 +182,9 @@
EventId m_endRxEventId;
- Ptr m_mobility;
+ Ptr m_mobility;
- Ptr m_device;
+ Ptr m_device;
Ptr m_channel;
diff -r 2fa7219968b3 src/spectrum/helper/adhoc-aloha-noack-ideal-phy-helper.cc
--- a/src/spectrum/helper/adhoc-aloha-noack-ideal-phy-helper.cc Wed Sep 28 14:03:25 2011 +0100
+++ b/src/spectrum/helper/adhoc-aloha-noack-ideal-phy-helper.cc Wed Sep 28 19:03:44 2011 +0200
@@ -113,7 +113,7 @@
dev->SetPhy (phy);
NS_ASSERT (node);
- phy->SetMobility (node);
+ phy->SetMobility (node->GetObject ());
NS_ASSERT (dev);
phy->SetDevice (dev);
diff -r 2fa7219968b3 src/spectrum/helper/spectrum-analyzer-helper.cc
--- a/src/spectrum/helper/spectrum-analyzer-helper.cc Wed Sep 28 14:03:25 2011 +0100
+++ b/src/spectrum/helper/spectrum-analyzer-helper.cc Wed Sep 28 19:03:44 2011 +0200
@@ -142,7 +142,7 @@
dev->SetPhy (phy);
NS_ASSERT (node);
- phy->SetMobility (node);
+ phy->SetMobility (node->GetObject ());
NS_ASSERT (dev);
phy->SetDevice (dev);
diff -r 2fa7219968b3 src/spectrum/helper/spectrum-helper.cc
--- a/src/spectrum/helper/spectrum-helper.cc Wed Sep 28 14:03:25 2011 +0100
+++ b/src/spectrum/helper/spectrum-helper.cc Wed Sep 28 19:03:44 2011 +0200
@@ -215,7 +215,7 @@
NS_ASSERT (m_channel);
Ptr phy = (m_phy.Create ())->GetObject ();
phy->SetChannel (m_channel);
- phy->SetMobility (node);
+ phy->SetMobility (node->GetObject ());
phy->SetDevice (device);
return phy;
}
diff -r 2fa7219968b3 src/spectrum/helper/waveform-generator-helper.cc
--- a/src/spectrum/helper/waveform-generator-helper.cc Wed Sep 28 14:03:25 2011 +0100
+++ b/src/spectrum/helper/waveform-generator-helper.cc Wed Sep 28 19:03:44 2011 +0200
@@ -98,7 +98,7 @@
dev->SetPhy (phy);
NS_ASSERT (node);
- phy->SetMobility (node);
+ phy->SetMobility (node->GetObject ());
NS_ASSERT (dev);
phy->SetDevice (dev);
diff -r 2fa7219968b3 src/spectrum/model/half-duplex-ideal-phy.cc
--- a/src/spectrum/model/half-duplex-ideal-phy.cc Wed Sep 28 14:03:25 2011 +0100
+++ b/src/spectrum/model/half-duplex-ideal-phy.cc Wed Sep 28 19:03:44 2011 +0200
@@ -126,7 +126,7 @@
-Ptr
+Ptr
HalfDuplexIdealPhy::GetDevice ()
{
NS_LOG_FUNCTION (this);
@@ -134,7 +134,7 @@
}
-Ptr
+Ptr
HalfDuplexIdealPhy::GetMobility ()
{
NS_LOG_FUNCTION (this);
@@ -143,7 +143,7 @@
void
-HalfDuplexIdealPhy::SetDevice (Ptr d)
+HalfDuplexIdealPhy::SetDevice (Ptr d)
{
NS_LOG_FUNCTION (this << d);
m_netDevice = d;
@@ -151,7 +151,7 @@
void
-HalfDuplexIdealPhy::SetMobility (Ptr m)
+HalfDuplexIdealPhy::SetMobility (Ptr m)
{
NS_LOG_FUNCTION (this << m);
m_mobility = m;
diff -r 2fa7219968b3 src/spectrum/model/half-duplex-ideal-phy.h
--- a/src/spectrum/model/half-duplex-ideal-phy.h Wed Sep 28 14:03:25 2011 +0100
+++ b/src/spectrum/model/half-duplex-ideal-phy.h Wed Sep 28 19:03:44 2011 +0200
@@ -94,10 +94,10 @@
// inherited from SpectrumPhy
void SetChannel (Ptr c);
- void SetMobility (Ptr m);
- void SetDevice (Ptr d);
- Ptr GetMobility ();
- Ptr GetDevice ();
+ void SetMobility (Ptr m);
+ void SetDevice (Ptr d);
+ Ptr GetMobility ();
+ Ptr GetDevice ();
Ptr GetRxSpectrumModel () const;
void StartRx (Ptr p, Ptr rxPsd, SpectrumType st, Time duration);
@@ -195,8 +195,8 @@
EventId m_endRxEventId;
- Ptr m_mobility;
- Ptr m_netDevice;
+ Ptr m_mobility;
+ Ptr m_netDevice;
Ptr m_channel;
Ptr m_txPsd;
diff -r 2fa7219968b3 src/spectrum/model/multi-model-spectrum-channel.cc
--- a/src/spectrum/model/multi-model-spectrum-channel.cc Wed Sep 28 14:03:25 2011 +0100
+++ b/src/spectrum/model/multi-model-spectrum-channel.cc Wed Sep 28 19:03:44 2011 +0200
@@ -222,7 +222,7 @@
NS_ASSERT (originalTxPowerSpectrum);
- Ptr txMobility = txPhy->GetMobility ()->GetObject ();
+ Ptr txMobility = txPhy->GetMobility ();
SpectrumModelUid_t txSpectrumModelUid = originalTxPowerSpectrum->GetSpectrumModelUid ();
NS_LOG_LOGIC (" txSpectrumModelUid " << txSpectrumModelUid);
@@ -268,7 +268,7 @@
Ptr rxPowerSpectrum = convertedTxPowerSpectrum->Copy ();
Time delay = MicroSeconds (0);
- Ptr receiverMobility = (*rxPhyIterator)->GetMobility ()->GetObject ();
+ Ptr receiverMobility = (*rxPhyIterator)->GetMobility ();
if (txMobility && receiverMobility)
{
@@ -296,11 +296,11 @@
}
Ptr pktBurstCopy = p->Copy ();
- Ptr netDevObj = (*rxPhyIterator)->GetDevice ();
- if (netDevObj)
+ Ptr 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 ()->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
MultiModelSpectrumChannel::GetDevice (uint32_t i) const
{
- return m_phyVector.at (i)->GetDevice ()->GetObject ();
+ return m_phyVector.at (i)->GetDevice ();
}
diff -r 2fa7219968b3 src/spectrum/model/single-model-spectrum-channel.cc
--- a/src/spectrum/model/single-model-spectrum-channel.cc Wed Sep 28 14:03:25 2011 +0100
+++ b/src/spectrum/model/single-model-spectrum-channel.cc Wed Sep 28 19:03:44 2011 +0200
@@ -116,7 +116,7 @@
- Ptr senderMobility = txPhy->GetMobility ()->GetObject ();
+ Ptr senderMobility = txPhy->GetMobility ();
for (PhyList::const_iterator rxPhyIterator = m_phyList.begin ();
rxPhyIterator != m_phyList.end ();
@@ -127,7 +127,7 @@
Ptr rxPsd = Copy (txPsd);
Time delay = MicroSeconds (0);
- Ptr receiverMobility = (*rxPhyIterator)->GetMobility ()->GetObject ();
+ Ptr receiverMobility = (*rxPhyIterator)->GetMobility ();
if (senderMobility && receiverMobility)
{
@@ -155,11 +155,11 @@
}
Ptr pktBurstCopy = p->Copy ();
- Ptr netDevObj = (*rxPhyIterator)->GetDevice ();
- if (netDevObj)
+ Ptr 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 ()->GetNode ()->GetId ();
+ uint32_t dstNode = netDev->GetNode ()->GetId ();
Simulator::ScheduleWithContext (dstNode, delay, &SingleModelSpectrumChannel::StartRx, this,
pktBurstCopy, rxPsd, st, duration, *rxPhyIterator);
}
diff -r 2fa7219968b3 src/spectrum/model/spectrum-analyzer.cc
--- a/src/spectrum/model/spectrum-analyzer.cc Wed Sep 28 14:03:25 2011 +0100
+++ b/src/spectrum/model/spectrum-analyzer.cc Wed Sep 28 19:03:44 2011 +0200
@@ -89,14 +89,14 @@
-Ptr
+Ptr
SpectrumAnalyzer::GetDevice ()
{
return m_netDevice;
}
-Ptr
+Ptr
SpectrumAnalyzer::GetMobility ()
{
return m_mobility;
@@ -110,7 +110,7 @@
}
void
-SpectrumAnalyzer::SetDevice (Ptr d)
+SpectrumAnalyzer::SetDevice (Ptr d)
{
NS_LOG_FUNCTION (this << d);
m_netDevice = d;
@@ -118,7 +118,7 @@
void
-SpectrumAnalyzer::SetMobility (Ptr m)
+SpectrumAnalyzer::SetMobility (Ptr m)
{
NS_LOG_FUNCTION (this << m);
m_mobility = m;
diff -r 2fa7219968b3 src/spectrum/model/spectrum-analyzer.h
--- a/src/spectrum/model/spectrum-analyzer.h Wed Sep 28 14:03:25 2011 +0100
+++ b/src/spectrum/model/spectrum-analyzer.h Wed Sep 28 19:03:44 2011 +0200
@@ -53,10 +53,10 @@
// inherited from SpectrumPhy
void SetChannel (Ptr c);
- void SetMobility (Ptr m);
- void SetDevice (Ptr d);
- Ptr GetMobility ();
- Ptr GetDevice ();
+ void SetMobility (Ptr m);
+ void SetDevice (Ptr d);
+ Ptr GetMobility ();
+ Ptr GetDevice ();
Ptr GetRxSpectrumModel () const;
void StartRx (Ptr pb, Ptr rxPowerSpectralDensity, SpectrumType st, Time duration);
@@ -86,8 +86,8 @@
void DoDispose ();
private:
- Ptr m_mobility;
- Ptr m_netDevice;
+ Ptr m_mobility;
+ Ptr m_netDevice;
Ptr m_channel;
virtual void GenerateReport ();
diff -r 2fa7219968b3 src/spectrum/model/spectrum-phy.h
--- a/src/spectrum/model/spectrum-phy.h Wed Sep 28 14:03:25 2011 +0100
+++ b/src/spectrum/model/spectrum-phy.h Wed Sep 28 19:03:44 2011 +0200
@@ -54,28 +54,28 @@
*
* @param d the NetDevice instance
*/
- virtual void SetDevice (Ptr d) = 0;
+ virtual void SetDevice (Ptr d) = 0;
/**
* get the associated NetDevice instance
*
* @return a Ptr to the associated NetDevice instance
*/
- virtual Ptr GetDevice () = 0;
+ virtual Ptr GetDevice () = 0;
/**
* Set the mobility model associated with this device.
*
* @param m the mobility model
*/
- virtual void SetMobility (Ptr m) = 0;
+ virtual void SetMobility (Ptr m) = 0;
/**
* get the associated MobilityModel instance
*
* @return a Ptr to the associated NetDevice instance
*/
- virtual Ptr GetMobility () = 0;
+ virtual Ptr GetMobility () = 0;
/**
diff -r 2fa7219968b3 src/spectrum/model/waveform-generator.cc
--- a/src/spectrum/model/waveform-generator.cc Wed Sep 28 14:03:25 2011 +0100
+++ b/src/spectrum/model/waveform-generator.cc Wed Sep 28 19:03:44 2011 +0200
@@ -89,14 +89,14 @@
-Ptr
+Ptr
WaveformGenerator::GetDevice ()
{
return m_netDevice;
}
-Ptr
+Ptr
WaveformGenerator::GetMobility ()
{
return m_mobility;
@@ -111,14 +111,14 @@
}
void
-WaveformGenerator::SetDevice (Ptr d)
+WaveformGenerator::SetDevice (Ptr d)
{
m_netDevice = d;
}
void
-WaveformGenerator::SetMobility (Ptr m)
+WaveformGenerator::SetMobility (Ptr m)
{
m_mobility = m;
}
diff -r 2fa7219968b3 src/spectrum/model/waveform-generator.h
--- a/src/spectrum/model/waveform-generator.h Wed Sep 28 14:03:25 2011 +0100
+++ b/src/spectrum/model/waveform-generator.h Wed Sep 28 19:03:44 2011 +0200
@@ -56,10 +56,10 @@
// inherited from SpectrumPhy
void SetChannel (Ptr c);
- void SetMobility (Ptr m);
- void SetDevice (Ptr d);
- Ptr GetMobility ();
- Ptr GetDevice ();
+ void SetMobility (Ptr m);
+ void SetDevice (Ptr d);
+ Ptr GetMobility ();
+ Ptr GetDevice ();
Ptr GetRxSpectrumModel () const;
void StartRx (Ptr p, Ptr rxPsd, SpectrumType st, Time duration);
@@ -129,8 +129,8 @@
private:
virtual void DoDispose (void);
- Ptr m_mobility;
- Ptr m_netDevice;
+ Ptr m_mobility;
+ Ptr m_netDevice;
Ptr m_channel;
virtual void GenerateWaveform ();