From dbf5feba29968fffca480aa4010cb240831813a9 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 17 Apr 2009 09:59:54 +0200 Subject: [PATCH] cleanup --- src/devices/wifi/aarf-wifi-manager.cc | 31 +++++++++++---------------- src/devices/wifi/aarf-wifi-manager.h | 19 ++++++---------- src/devices/wifi/arf-wifi-manager.cc | 24 +++++++++------------ src/devices/wifi/arf-wifi-manager.h | 10 +++------ 4 files changed, 33 insertions(+), 51 deletions(-) diff --git a/src/devices/wifi/aarf-wifi-manager.cc b/src/devices/wifi/aarf-wifi-manager.cc index 23451d704..765fec03a 100644 --- a/src/devices/wifi/aarf-wifi-manager.cc +++ b/src/devices/wifi/aarf-wifi-manager.cc @@ -71,39 +71,34 @@ AarfWifiManager::~AarfWifiManager () WifiRemoteStation * AarfWifiManager::CreateStation (void) { - return new AarfWifiRemoteStation (this, m_minTimerThreshold, - m_minSuccessThreshold, - m_successK, - m_maxSuccessThreshold, - m_timerK); + return new AarfWifiRemoteStation (this); } -AarfWifiRemoteStation::AarfWifiRemoteStation (Ptr stations, - uint32_t minTimerThreshold, - uint32_t minSuccessThreshold, - double successK, - uint32_t maxSuccessThreshold, - double timerK) - : ArfWifiRemoteStation (stations, minTimerThreshold, minSuccessThreshold), - m_successK (successK), - m_maxSuccessThreshold (maxSuccessThreshold), - m_timerK (timerK) +AarfWifiRemoteStation::AarfWifiRemoteStation (Ptr manager) + : ArfWifiRemoteStation (manager), + m_manager (manager) {} AarfWifiRemoteStation::~AarfWifiRemoteStation () {} +Ptr +AarfWifiRemoteStation::GetManager (void) const +{ + return m_manager; +} + void AarfWifiRemoteStation::ReportRecoveryFailure (void) { - SetSuccessThreshold ((int)(Min (GetSuccessThreshold () * m_successK, - m_maxSuccessThreshold))); + SetSuccessThreshold ((int)(Min (GetSuccessThreshold () * m_manager->m_successK, + m_manager->m_maxSuccessThreshold))); SetTimerTimeout ((int)(Max (GetMinTimerTimeout (), - GetSuccessThreshold () * m_timerK))); + GetSuccessThreshold () * m_manager->m_timerK))); } void diff --git a/src/devices/wifi/aarf-wifi-manager.h b/src/devices/wifi/aarf-wifi-manager.h index 855c327f5..79a70789b 100644 --- a/src/devices/wifi/aarf-wifi-manager.h +++ b/src/devices/wifi/aarf-wifi-manager.h @@ -17,8 +17,8 @@ * * Author: Mathieu Lacage */ -#ifndef AARF_MAC_STATIONS_H -#define AARF_MAC_STATIONS_H +#ifndef AARF_WIFI_MANAGER_H +#define AARF_WIFI_MANAGER_H #include "arf-wifi-manager.h" @@ -39,6 +39,7 @@ public: AarfWifiManager (); virtual ~AarfWifiManager (); private: + friend class AarfWifiRemoteStation; virtual class WifiRemoteStation *CreateStation (void); uint32_t m_minTimerThreshold; uint32_t m_minSuccessThreshold; @@ -50,24 +51,18 @@ private: class AarfWifiRemoteStation : public ArfWifiRemoteStation { public: - AarfWifiRemoteStation (Ptr stations, - uint32_t minTimerThreshold, - uint32_t minSuccessThreshold, - double successK, - uint32_t maxSuccessThreshold, - double timerK); + AarfWifiRemoteStation (Ptr stations); virtual ~AarfWifiRemoteStation (); private: virtual void ReportRecoveryFailure (void); virtual void ReportFailure (void); + virtual Ptr GetManager (void) const; - double m_successK; - uint32_t m_maxSuccessThreshold; - double m_timerK; + Ptr m_manager; }; } // namespace ns3 -#endif /* AARF_MAC_STATIONS_H */ +#endif /* AARF_WIFI_MANAGER_H */ diff --git a/src/devices/wifi/arf-wifi-manager.cc b/src/devices/wifi/arf-wifi-manager.cc index e20e0b73e..fbbc0391f 100644 --- a/src/devices/wifi/arf-wifi-manager.cc +++ b/src/devices/wifi/arf-wifi-manager.cc @@ -28,15 +28,11 @@ NS_LOG_COMPONENT_DEFINE ("ns3::ArfWifiManager"); namespace ns3 { -ArfWifiRemoteStation::ArfWifiRemoteStation (Ptr stations, - int minTimerTimeout, - int minSuccessThreshold) - : m_stations (stations) +ArfWifiRemoteStation::ArfWifiRemoteStation (Ptr manager) + : m_manager (manager) { - m_minTimerTimeout = minTimerTimeout; - m_minSuccessThreshold = minSuccessThreshold; - m_successThreshold = m_minSuccessThreshold; - m_timerTimeout = m_minTimerTimeout; + m_successThreshold = m_manager->m_successThreshold; + m_timerTimeout = m_manager->m_timerThreshold; m_rate = GetMinRate (); m_success = 0; @@ -189,11 +185,11 @@ void ArfWifiRemoteStation::ReportFailure (void) {} uint32_t ArfWifiRemoteStation::GetMinTimerTimeout (void) { - return m_minTimerTimeout; + return m_manager->m_timerThreshold; } uint32_t ArfWifiRemoteStation::GetMinSuccessThreshold (void) { - return m_minSuccessThreshold; + return m_manager->m_successThreshold; } uint32_t ArfWifiRemoteStation::GetTimerTimeout (void) { @@ -205,18 +201,18 @@ uint32_t ArfWifiRemoteStation::GetSuccessThreshold (void) } void ArfWifiRemoteStation::SetTimerTimeout (uint32_t timerTimeout) { - NS_ASSERT (timerTimeout >= m_minTimerTimeout); + NS_ASSERT (timerTimeout >= m_manager->m_timerThreshold); m_timerTimeout = timerTimeout; } void ArfWifiRemoteStation::SetSuccessThreshold (uint32_t successThreshold) { - NS_ASSERT (successThreshold >= m_minSuccessThreshold); + NS_ASSERT (successThreshold >= m_manager->m_successThreshold); m_successThreshold = successThreshold; } Ptr ArfWifiRemoteStation::GetManager (void) const { - return m_stations; + return m_manager; } NS_OBJECT_ENSURE_REGISTERED (ArfWifiManager); @@ -247,7 +243,7 @@ ArfWifiManager::~ArfWifiManager () WifiRemoteStation * ArfWifiManager::CreateStation (void) { - return new ArfWifiRemoteStation (this, m_timerThreshold, m_successThreshold); + return new ArfWifiRemoteStation (this); } } // namespace ns3 diff --git a/src/devices/wifi/arf-wifi-manager.h b/src/devices/wifi/arf-wifi-manager.h index f074bc5d1..6fb68a86b 100644 --- a/src/devices/wifi/arf-wifi-manager.h +++ b/src/devices/wifi/arf-wifi-manager.h @@ -46,6 +46,7 @@ public: virtual ~ArfWifiManager (); private: + friend class ArfWifiRemoteStation; virtual class WifiRemoteStation *CreateStation (void); uint32_t m_timerThreshold; uint32_t m_successThreshold; @@ -55,9 +56,7 @@ private: class ArfWifiRemoteStation : public WifiRemoteStation { public: - ArfWifiRemoteStation (Ptr stations, - int minTimerTimeout, - int minSuccessThreshold); + ArfWifiRemoteStation (Ptr manager); virtual ~ArfWifiRemoteStation (); protected: @@ -85,10 +84,7 @@ private: uint32_t m_rate; - uint32_t m_minTimerTimeout; - uint32_t m_minSuccessThreshold; - - Ptr m_stations; + Ptr m_manager; private: // overriden by AarfMacStation.