diff --git a/CHANGES.html b/CHANGES.html
index 247481113..9ce02915b 100644
--- a/CHANGES.html
+++ b/CHANGES.html
@@ -86,6 +86,13 @@ width standards has had a change in capitalization:
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 --git a/src/lte/model/lte-spectrum-phy.cc b/src/lte/model/lte-spectrum-phy.cc
index 4534666c0..41303e0f9 100644
--- a/src/lte/model/lte-spectrum-phy.cc
+++ b/src/lte/model/lte-spectrum-phy.cc
@@ -104,7 +104,7 @@ LteSpectrumPhy::GetTypeId (void)
-Ptr
+Ptr
LteSpectrumPhy::GetDevice ()
{
NS_LOG_FUNCTION (this);
@@ -112,7 +112,7 @@ LteSpectrumPhy::GetDevice ()
}
-Ptr
+Ptr
LteSpectrumPhy::GetMobility ()
{
NS_LOG_FUNCTION (this);
@@ -121,7 +121,7 @@ LteSpectrumPhy::GetMobility ()
void
-LteSpectrumPhy::SetDevice (Ptr d)
+LteSpectrumPhy::SetDevice (Ptr d)
{
NS_LOG_FUNCTION (this << d);
m_device = d;
@@ -129,7 +129,7 @@ LteSpectrumPhy::SetDevice (Ptr d)
void
-LteSpectrumPhy::SetMobility (Ptr m)
+LteSpectrumPhy::SetMobility (Ptr m)
{
NS_LOG_FUNCTION (this << m);
m_mobility = m;
diff --git a/src/lte/model/lte-spectrum-phy.h b/src/lte/model/lte-spectrum-phy.h
index dde4f6254..468e5bc16 100644
--- a/src/lte/model/lte-spectrum-phy.h
+++ b/src/lte/model/lte-spectrum-phy.h
@@ -65,10 +65,10 @@ public:
// 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 @@ private:
EventId m_endRxEventId;
- Ptr m_mobility;
+ Ptr m_mobility;
- Ptr m_device;
+ Ptr m_device;
Ptr m_channel;
diff --git a/src/spectrum/helper/adhoc-aloha-noack-ideal-phy-helper.cc b/src/spectrum/helper/adhoc-aloha-noack-ideal-phy-helper.cc
index 2c2602b43..8ceeb2966 100644
--- a/src/spectrum/helper/adhoc-aloha-noack-ideal-phy-helper.cc
+++ b/src/spectrum/helper/adhoc-aloha-noack-ideal-phy-helper.cc
@@ -113,7 +113,7 @@ AdhocAlohaNoackIdealPhyHelper::Install (NodeContainer c) const
dev->SetPhy (phy);
NS_ASSERT (node);
- phy->SetMobility (node);
+ phy->SetMobility (node->GetObject ());
NS_ASSERT (dev);
phy->SetDevice (dev);
diff --git a/src/spectrum/helper/spectrum-analyzer-helper.cc b/src/spectrum/helper/spectrum-analyzer-helper.cc
index fc1f9db34..221bbd8b2 100644
--- a/src/spectrum/helper/spectrum-analyzer-helper.cc
+++ b/src/spectrum/helper/spectrum-analyzer-helper.cc
@@ -142,7 +142,7 @@ SpectrumAnalyzerHelper::Install (NodeContainer c) const
dev->SetPhy (phy);
NS_ASSERT (node);
- phy->SetMobility (node);
+ phy->SetMobility (node->GetObject ());
NS_ASSERT (dev);
phy->SetDevice (dev);
diff --git a/src/spectrum/helper/spectrum-helper.cc b/src/spectrum/helper/spectrum-helper.cc
index 53f9fff67..0aaf25120 100644
--- a/src/spectrum/helper/spectrum-helper.cc
+++ b/src/spectrum/helper/spectrum-helper.cc
@@ -215,7 +215,7 @@ SpectrumPhyHelper::Create (Ptr node, Ptr device) const
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 --git a/src/spectrum/helper/waveform-generator-helper.cc b/src/spectrum/helper/waveform-generator-helper.cc
index 278e2fdfa..f08e39357 100644
--- a/src/spectrum/helper/waveform-generator-helper.cc
+++ b/src/spectrum/helper/waveform-generator-helper.cc
@@ -98,7 +98,7 @@ WaveformGeneratorHelper::Install (NodeContainer c) const
dev->SetPhy (phy);
NS_ASSERT (node);
- phy->SetMobility (node);
+ phy->SetMobility (node->GetObject ());
NS_ASSERT (dev);
phy->SetDevice (dev);
diff --git a/src/spectrum/model/half-duplex-ideal-phy.cc b/src/spectrum/model/half-duplex-ideal-phy.cc
index a565c8c65..38b1aaaa8 100644
--- a/src/spectrum/model/half-duplex-ideal-phy.cc
+++ b/src/spectrum/model/half-duplex-ideal-phy.cc
@@ -126,7 +126,7 @@ HalfDuplexIdealPhy::GetTypeId (void)
-Ptr
+Ptr
HalfDuplexIdealPhy::GetDevice ()
{
NS_LOG_FUNCTION (this);
@@ -134,7 +134,7 @@ HalfDuplexIdealPhy::GetDevice ()
}
-Ptr
+Ptr
HalfDuplexIdealPhy::GetMobility ()
{
NS_LOG_FUNCTION (this);
@@ -143,7 +143,7 @@ HalfDuplexIdealPhy::GetMobility ()
void
-HalfDuplexIdealPhy::SetDevice (Ptr d)
+HalfDuplexIdealPhy::SetDevice (Ptr d)
{
NS_LOG_FUNCTION (this << d);
m_netDevice = d;
@@ -151,7 +151,7 @@ HalfDuplexIdealPhy::SetDevice (Ptr d)
void
-HalfDuplexIdealPhy::SetMobility (Ptr m)
+HalfDuplexIdealPhy::SetMobility (Ptr m)
{
NS_LOG_FUNCTION (this << m);
m_mobility = m;
diff --git a/src/spectrum/model/half-duplex-ideal-phy.h b/src/spectrum/model/half-duplex-ideal-phy.h
index c7ad14f8a..3f54e9772 100644
--- a/src/spectrum/model/half-duplex-ideal-phy.h
+++ b/src/spectrum/model/half-duplex-ideal-phy.h
@@ -94,10 +94,10 @@ public:
// 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 @@ private:
EventId m_endRxEventId;
- Ptr m_mobility;
- Ptr m_netDevice;
+ Ptr m_mobility;
+ Ptr m_netDevice;
Ptr m_channel;
Ptr m_txPsd;
diff --git a/src/spectrum/model/multi-model-spectrum-channel.cc b/src/spectrum/model/multi-model-spectrum-channel.cc
index acba76ca0..c3b84f9b0 100644
--- a/src/spectrum/model/multi-model-spectrum-channel.cc
+++ b/src/spectrum/model/multi-model-spectrum-channel.cc
@@ -222,7 +222,7 @@ MultiModelSpectrumChannel::StartTx (Ptr p, Ptr orig
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 @@ MultiModelSpectrumChannel::StartTx (Ptr p, Ptr orig
Ptr rxPowerSpectrum = convertedTxPowerSpectrum->Copy ();
Time delay = MicroSeconds (0);
- Ptr receiverMobility = (*rxPhyIterator)->GetMobility ()->GetObject ();
+ Ptr receiverMobility = (*rxPhyIterator)->GetMobility ();
if (txMobility && receiverMobility)
{
@@ -296,11 +296,11 @@ MultiModelSpectrumChannel::StartTx (Ptr p, Ptr orig
}
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 @@ MultiModelSpectrumChannel::GetNDevices (void) const
Ptr
MultiModelSpectrumChannel::GetDevice (uint32_t i) const
{
- return m_phyVector.at (i)->GetDevice ()->GetObject ();
+ return m_phyVector.at (i)->GetDevice ();
}
diff --git a/src/spectrum/model/single-model-spectrum-channel.cc b/src/spectrum/model/single-model-spectrum-channel.cc
index 0af9aedcb..fa5d16566 100644
--- a/src/spectrum/model/single-model-spectrum-channel.cc
+++ b/src/spectrum/model/single-model-spectrum-channel.cc
@@ -116,7 +116,7 @@ SingleModelSpectrumChannel::StartTx (Ptr p, Ptr txP
- 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 @@ SingleModelSpectrumChannel::StartTx (Ptr p, Ptr txP
Ptr rxPsd = Copy (txPsd);
Time delay = MicroSeconds (0);
- Ptr receiverMobility = (*rxPhyIterator)->GetMobility ()->GetObject ();
+ Ptr receiverMobility = (*rxPhyIterator)->GetMobility ();
if (senderMobility && receiverMobility)
{
@@ -155,11 +155,11 @@ SingleModelSpectrumChannel::StartTx (Ptr p, Ptr txP
}
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 --git a/src/spectrum/model/spectrum-analyzer.cc b/src/spectrum/model/spectrum-analyzer.cc
index 98d29c729..9962efc47 100644
--- a/src/spectrum/model/spectrum-analyzer.cc
+++ b/src/spectrum/model/spectrum-analyzer.cc
@@ -89,14 +89,14 @@ SpectrumAnalyzer::GetTypeId (void)
-Ptr
+Ptr
SpectrumAnalyzer::GetDevice ()
{
return m_netDevice;
}
-Ptr
+Ptr
SpectrumAnalyzer::GetMobility ()
{
return m_mobility;
@@ -110,7 +110,7 @@ SpectrumAnalyzer::GetRxSpectrumModel () const
}
void
-SpectrumAnalyzer::SetDevice (Ptr d)
+SpectrumAnalyzer::SetDevice (Ptr d)
{
NS_LOG_FUNCTION (this << d);
m_netDevice = d;
@@ -118,7 +118,7 @@ SpectrumAnalyzer::SetDevice (Ptr d)
void
-SpectrumAnalyzer::SetMobility (Ptr m)
+SpectrumAnalyzer::SetMobility (Ptr m)
{
NS_LOG_FUNCTION (this << m);
m_mobility = m;
diff --git a/src/spectrum/model/spectrum-analyzer.h b/src/spectrum/model/spectrum-analyzer.h
index 42d5cd8c4..decfdfa99 100644
--- a/src/spectrum/model/spectrum-analyzer.h
+++ b/src/spectrum/model/spectrum-analyzer.h
@@ -53,10 +53,10 @@ public:
// 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 @@ protected:
void DoDispose ();
private:
- Ptr m_mobility;
- Ptr m_netDevice;
+ Ptr m_mobility;
+ Ptr m_netDevice;
Ptr m_channel;
virtual void GenerateReport ();
diff --git a/src/spectrum/model/spectrum-phy.h b/src/spectrum/model/spectrum-phy.h
index 4271f764a..99563432e 100644
--- a/src/spectrum/model/spectrum-phy.h
+++ b/src/spectrum/model/spectrum-phy.h
@@ -54,28 +54,28 @@ public:
*
* @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 --git a/src/spectrum/model/waveform-generator.cc b/src/spectrum/model/waveform-generator.cc
index 2d2c70b92..fb4874d09 100644
--- a/src/spectrum/model/waveform-generator.cc
+++ b/src/spectrum/model/waveform-generator.cc
@@ -89,14 +89,14 @@ WaveformGenerator::GetTypeId (void)
-Ptr
+Ptr
WaveformGenerator::GetDevice ()
{
return m_netDevice;
}
-Ptr
+Ptr
WaveformGenerator::GetMobility ()
{
return m_mobility;
@@ -111,14 +111,14 @@ WaveformGenerator::GetRxSpectrumModel () const
}
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 --git a/src/spectrum/model/waveform-generator.h b/src/spectrum/model/waveform-generator.h
index 7b43c442f..52fd896a2 100644
--- a/src/spectrum/model/waveform-generator.h
+++ b/src/spectrum/model/waveform-generator.h
@@ -56,10 +56,10 @@ public:
// 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 @@ public:
private:
virtual void DoDispose (void);
- Ptr m_mobility;
- Ptr m_netDevice;
+ Ptr m_mobility;
+ Ptr m_netDevice;
Ptr m_channel;
virtual void GenerateWaveform ();