From 84df21f72c7ef00ec01bde02a73a9557f9b09ef2 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 15 Apr 2011 20:48:12 +0200 Subject: [PATCH] avoid ambiguous method overloads for python bindings --- src/network/utils/radiotap-header.cc | 65 +++++++++++----------------- src/network/utils/radiotap-header.h | 18 -------- 2 files changed, 25 insertions(+), 58 deletions(-) diff --git a/src/network/utils/radiotap-header.cc b/src/network/utils/radiotap-header.cc index 49dc16795..e3fbb9b81 100644 --- a/src/network/utils/radiotap-header.cc +++ b/src/network/utils/radiotap-header.cc @@ -324,37 +324,29 @@ RadiotapHeader::GetChannelFlags (void) const } void -RadiotapHeader::SetAntennaSignalPower (int8_t signal) +RadiotapHeader::SetAntennaSignalPower (double signal) { NS_LOG_FUNCTION (this << signal); - m_antennaSignal = signal; if (!(m_present & RADIOTAP_DBM_ANTSIGNAL)) { m_present |= RADIOTAP_DBM_ANTSIGNAL; m_length += 1; } - - NS_LOG_LOGIC (this << " m_length=" << m_length << " m_present=0x" << std::hex << m_present << std::dec); -} - -void -RadiotapHeader::SetAntennaSignalPower (double signal) -{ - NS_LOG_FUNCTION (this << signal); - - if (signal < -128) - { - return SetAntennaSignalPower (static_cast (-128)); - } - if (signal > 127) { - return SetAntennaSignalPower (static_cast (127)); + m_antennaSignal = 127; } - - SetAntennaSignalPower (static_cast (floor(signal + 0.5))); -} + else if (signal < -128) + { + m_antennaSignal = -128; + } + else + { + m_antennaSignal = static_cast (floor(signal + 0.5)); + } + + NS_LOG_LOGIC (this << " m_length=" << m_length << " m_present=0x" << std::hex << m_present << std::dec);} uint8_t RadiotapHeader::GetAntennaSignalPower (void) const @@ -364,38 +356,31 @@ RadiotapHeader::GetAntennaSignalPower (void) const } void -RadiotapHeader::SetAntennaNoisePower (int8_t noise) +RadiotapHeader::SetAntennaNoisePower (double noise) { NS_LOG_FUNCTION (this << noise); - m_antennaNoise = noise; if (!(m_present & RADIOTAP_DBM_ANTNOISE)) { m_present |= RADIOTAP_DBM_ANTNOISE; m_length += 1; } + if (noise > 127.0) + { + m_antennaNoise = 127; + } + else if (noise < -128.0) + { + m_antennaNoise = -128; + } + else + { + m_antennaNoise = static_cast (floor (noise + 0.5)); + } NS_LOG_LOGIC (this << " m_length=" << m_length << " m_present=0x" << std::hex << m_present << std::dec); } -void -RadiotapHeader::SetAntennaNoisePower (double noise) -{ - NS_LOG_FUNCTION (this << noise); - - if (noise < -128) - { - return SetAntennaNoisePower (static_cast (-128)); - } - - if (noise > 127) - { - return SetAntennaNoisePower (static_cast (127)); - } - - SetAntennaNoisePower (static_cast (floor(noise + 0.5))); -} - uint8_t RadiotapHeader::GetAntennaNoisePower (void) const { diff --git a/src/network/utils/radiotap-header.h b/src/network/utils/radiotap-header.h index 436661101..6cccde18e 100644 --- a/src/network/utils/radiotap-header.h +++ b/src/network/utils/radiotap-header.h @@ -187,15 +187,6 @@ public: */ uint16_t GetChannelFlags (void) const; - /** - * @brief Set the RF signal power at the antenna as a decibel difference - * from an arbitrary, fixed reference. - * - * @param signal The RF signal power at the antenna as a decibel difference - * from an arbitrary, fixed reference. - */ - void SetAntennaSignalPower (int8_t signal); - /** * @brief Set the RF signal power at the antenna as a decibel difference * from an arbitrary, fixed reference. @@ -214,15 +205,6 @@ public: */ uint8_t GetAntennaSignalPower (void) const; - /** - * @brief Set the RF noise power at the antenna as a decibel difference - * from an arbitrary, fixed reference. - * - * @param noise The RF noise power at the antenna as a decibel difference - * from an arbitrary, fixed reference. - */ - void SetAntennaNoisePower (int8_t noise); - /** * @brief Set the RF noise power at the antenna as a decibel difference * from an arbitrary, fixed reference.