|
Bugzilla – Full Text Bug Listing |
| Summary: | doxygen comments on device-level SetMobility () | ||
|---|---|---|---|
| Product: | ns-3 | Reporter: | Tom Henderson <tomh> |
| Component: | wifi | Assignee: | sebastien.deronne |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | mathieu.lacage, ns-bugs, ruben |
| Priority: | P5 | ||
| Version: | pre-release | ||
| Hardware: | All | ||
| OS: | All | ||
| Attachments: | suggested patch to fix | ||
|
Description
Tom Henderson
2011-08-18 18:52:17 UTC
bump What if we just enforce the use of Ptr<MobilityModel>? I think it would be inline with other discussions and modifications that we had recently. (In reply to comment #2) > What if we just enforce the use of Ptr<MobilityModel>? > I think it would be inline with other discussions and modifications that we had > recently. I would be fine with that solution from an API perspective. Presumably also m_device could be changed similarly as well. One aspect of this that could use clarification is the need to call SetMobility(). Presently, one must associate a MobilityModel with the device explicitly; that is, it is not sufficient to aggregate a MobilityModel with the Node (e.g. a multi-device node) and have the channel successfully call GetMobility(). Something like this would make the assignment of SetMobility() optional. --- a/src/wifi/model/yans-wifi-phy.cc Sun Nov 13 22:47:56 2011 -0800 +++ b/src/wifi/model/yans-wifi-phy.cc Wed Jan 04 10:27:05 2012 -0800 @@ -303,7 +303,14 @@ Ptr<Object> YansWifiPhy::GetMobility (void) { - return m_mobility; + if (m_mobility != 0) + { + return m_mobility; + } + else + { + return GetDevice()->GetNode()->GetObject<MobilityModel> (); + } } I think that the original reason for the Set/GetMobility method was to allow unit testing of the PHY layer outside of the node. Could we end up to a conclusion? It's already an old discussion and I do not think it will be once cleaned from the tracker if we do not decide to a final point :) Created attachment 2063 [details]
suggested patch to fix
This makes the SetMobility() of the Phy optional; the model defaults to using the mobility model that has been aggregated to the Node, but allows one to override this and set a device-specific mobility object.
This also changes the pointer type of SetNetDevice and SetMobility to be of the respective type, rather than ns3::Object. It turns out that it is not needed this way for the tests. The Ptr<Object> was being exploited by the YansWifiPhyHelper to set a mobility pointer to the node since at the time of Phy creation, the mobility pointer was not yet available. However, the current patch addresses this in a different way.
Tom, thanks for the fix. I find this solution indeed better and cleaner than the existing one, I do not have further comments on your patch. Fix committed in changeset 11451:36f951da53ac |