wifi: Use pointer to print PPDU's content

So as to be able to call overridden implementations of PrintPayload
This commit is contained in:
Rediet
2020-11-24 15:31:50 +01:00
parent c71915a843
commit e9da125f90
4 changed files with 28 additions and 12 deletions

View File

@@ -224,7 +224,7 @@ HePpdu::PrintPayload (void) const
}
else
{
ss << "PSDU=" << m_psdus.at (SU_STA_ID);
ss << "PSDU=" << m_psdus.at (SU_STA_ID) << " ";
}
return ss.str ();
}

View File

@@ -2419,7 +2419,7 @@ WifiPhy::StartReceivePreamble (Ptr<WifiPpdu> ppdu, RxPowerWattPerChannelBand rxP
[] (const std::pair<WifiSpectrumBand, double>& p1, const std::pair<WifiSpectrumBand, double>& p2) {
return p1.second < p2.second;
});
NS_LOG_FUNCTION (this << *ppdu << it->second);
NS_LOG_FUNCTION (this << ppdu << it->second);
WifiTxVector txVector = ppdu->GetTxVector ();
Time rxDuration = ppdu->GetTxDuration ();
@@ -2577,7 +2577,7 @@ WifiPhy::StartReceivePreamble (Ptr<WifiPpdu> ppdu, RxPowerWattPerChannelBand rxP
void
WifiPhy::DropPreambleEvent (Ptr<const WifiPpdu> ppdu, WifiPhyRxfailureReason reason, Time endRx, uint16_t measurementChannelWidth)
{
NS_LOG_FUNCTION (this << *ppdu << reason << endRx << measurementChannelWidth);
NS_LOG_FUNCTION (this << ppdu << reason << endRx << measurementChannelWidth);
NotifyRxDrop (GetAddressedPsduInPpdu (ppdu), reason);
auto it = m_currentPreambleEvents.find (std::make_pair (ppdu->GetUid (), ppdu->GetPreamble ()));
if (it != m_currentPreambleEvents.end ())
@@ -2615,7 +2615,7 @@ WifiPhy::StartReceiveOfdmaPayload (Ptr<Event> event)
[] (const std::pair<WifiSpectrumBand, double>& p1, const std::pair<WifiSpectrumBand, double>& p2) {
return p1.second < p2.second;
});
NS_LOG_FUNCTION (this << event << *ppdu << it->second);
NS_LOG_FUNCTION (this << event << ppdu << it->second);
NS_ASSERT (m_currentEvent != 0);
auto itEvent = m_beginOfdmaPayloadRxEvents.find (GetStaId (ppdu));
/**

View File

@@ -132,18 +132,19 @@ WifiPpdu::GetTxDuration (void) const
void
WifiPpdu::Print (std::ostream& os) const
{
os << "preamble=" << m_preamble
os << "[ preamble=" << m_preamble
<< ", modulation=" << m_modulation
<< ", truncatedTx=" << (m_truncatedTx ? "Y" : "N")
<< ", uid=" << m_uid
<< "," << PrintPayload ();
<< ", UID=" << m_uid
<< ", " << PrintPayload ()
<< "]";
}
std::string
WifiPpdu::PrintPayload (void) const
{
std::ostringstream ss;
ss << "PSDU=" << GetPsdu ();
ss << "PSDU=" << GetPsdu () << " ";
return ss.str ();
}
@@ -154,9 +155,15 @@ WifiPpdu::Copy (void) const
return Create<WifiPpdu> (GetPsdu (), GetTxVector ());
}
std::ostream & operator << (std::ostream &os, const WifiPpdu &ppdu)
std::ostream & operator << (std::ostream &os, const Ptr<const WifiPpdu> &ppdu)
{
ppdu.Print (os);
ppdu->Print (os);
return os;
}
std::ostream & operator << (std::ostream &os, const Ptr<WifiPpdu> &ppdu)
{
ppdu->Print (os);
return os;
}

View File

@@ -177,10 +177,19 @@ private:
* \brief Stream insertion operator.
*
* \param os the stream
* \param ppdu the PPDU
* \param ppdu the const pointer to the PPDU
* \returns a reference to the stream
*/
std::ostream& operator<< (std::ostream& os, const WifiPpdu &ppdu);
std::ostream& operator<< (std::ostream& os, const Ptr<const WifiPpdu> &ppdu);
/**
* \brief Stream insertion operator.
*
* \param os the stream
* \param ppdu the pointer to the PPDU
* \returns a reference to the stream
*/
std::ostream& operator<< (std::ostream& os, const Ptr<WifiPpdu> &ppdu);
/**
* \brief Stream insertion operator.