diff --git a/src/wifi/model/he/he-frame-exchange-manager.h b/src/wifi/model/he/he-frame-exchange-manager.h index 2b510a044f..1192a8ea20 100644 --- a/src/wifi/model/he/he-frame-exchange-manager.h +++ b/src/wifi/model/he/he-frame-exchange-manager.h @@ -22,15 +22,6 @@ namespace ns3 class MultiUserScheduler; class CtrlTriggerHeader; -/** - * Map of PSDUs indexed by STA-ID - */ -typedef std::unordered_map /* PSDU */> WifiPsduMap; -/** - * Map of const PSDUs indexed by STA-ID - */ -typedef std::unordered_map /* PSDU */> WifiConstPsduMap; - /** * @param psduMap a PSDU map * @return true if the given PSDU map contains a single PSDU including a single MPDU diff --git a/src/wifi/model/he/multi-user-scheduler.h b/src/wifi/model/he/multi-user-scheduler.h index a58084f76b..4e2cc4dcaa 100644 --- a/src/wifi/model/he/multi-user-scheduler.h +++ b/src/wifi/model/he/multi-user-scheduler.h @@ -26,8 +26,6 @@ namespace ns3 class HeFrameExchangeManager; -typedef std::unordered_map /* PSDU */> WifiPsduMap; - /** * @ingroup wifi * diff --git a/src/wifi/model/ht/ht-frame-exchange-manager.h b/src/wifi/model/ht/ht-frame-exchange-manager.h index c72ae3f177..e0c30b2f2d 100644 --- a/src/wifi/model/ht/ht-frame-exchange-manager.h +++ b/src/wifi/model/ht/ht-frame-exchange-manager.h @@ -12,7 +12,6 @@ #include "ns3/mpdu-aggregator.h" #include "ns3/msdu-aggregator.h" #include "ns3/qos-frame-exchange-manager.h" -#include "ns3/wifi-psdu.h" class AmpduAggregationTest; diff --git a/src/wifi/model/wifi-ppdu.cc b/src/wifi/model/wifi-ppdu.cc index ac56bbdd12..58075241ab 100644 --- a/src/wifi/model/wifi-ppdu.cc +++ b/src/wifi/model/wifi-ppdu.cc @@ -283,14 +283,4 @@ operator<<(std::ostream& os, const Ptr& ppdu) return os; } -std::ostream& -operator<<(std::ostream& os, const WifiConstPsduMap& psdus) -{ - for (const auto& psdu : psdus) - { - os << "PSDU for STA_ID=" << psdu.first << " (" << *psdu.second << ") "; - } - return os; -} - } // namespace ns3 diff --git a/src/wifi/model/wifi-ppdu.h b/src/wifi/model/wifi-ppdu.h index 593430a462..6c4d40ae40 100644 --- a/src/wifi/model/wifi-ppdu.h +++ b/src/wifi/model/wifi-ppdu.h @@ -230,15 +230,6 @@ class WifiPpdu : public SimpleRefCount */ std::ostream& operator<<(std::ostream& os, const Ptr& ppdu); -/** - * @brief Stream insertion operator. - * - * @param os the stream - * @param psdus the PSDUs - * @returns a reference to the stream - */ -std::ostream& operator<<(std::ostream& os, const WifiConstPsduMap& psdus); - } // namespace ns3 #endif /* WIFI_PPDU_H */ diff --git a/src/wifi/model/wifi-psdu.cc b/src/wifi/model/wifi-psdu.cc index 5a7fe7942b..a90dcbacc7 100644 --- a/src/wifi/model/wifi-psdu.cc +++ b/src/wifi/model/wifi-psdu.cc @@ -378,4 +378,40 @@ operator<<(std::ostream& os, const WifiPsdu& psdu) return os; } +std::ostream& +operator<<(std::ostream& os, const WifiPsduMap& psduMap) +{ + for (const auto& [staId, psdu] : psduMap) + { + if (staId != SU_STA_ID) + { + os << "[PSDU for STA_ID=" << staId << ", "; + } + psdu->Print(os); + if (staId != SU_STA_ID) + { + os << "]"; + } + } + return os; +} + +std::ostream& +operator<<(std::ostream& os, const WifiConstPsduMap& psduMap) +{ + for (const auto& [staId, psdu] : psduMap) + { + if (staId != SU_STA_ID) + { + os << "[PSDU for STA_ID=" << staId << ", "; + } + psdu->Print(os); + if (staId != SU_STA_ID) + { + os << "]"; + } + } + return os; +} + } // namespace ns3 diff --git a/src/wifi/model/wifi-psdu.h b/src/wifi/model/wifi-psdu.h index c128437b1d..705eb569aa 100644 --- a/src/wifi/model/wifi-psdu.h +++ b/src/wifi/model/wifi-psdu.h @@ -15,6 +15,7 @@ #include "ns3/nstime.h" #include +#include #include namespace ns3 @@ -259,6 +260,30 @@ class WifiPsdu : public SimpleRefCount */ std::ostream& operator<<(std::ostream& os, const WifiPsdu& psdu); +/// Map of PSDUs indexed by STA-ID +using WifiPsduMap = std::unordered_map /* PSDU */>; + +/// Map of const PSDUs indexed by STA-ID +using WifiConstPsduMap = std::unordered_map /* PSDU */>; + +/** + * @brief Stream insertion operator. + * + * @param os the stream + * @param psduMap the PSDU map + * @returns a reference to the stream + */ +std::ostream& operator<<(std::ostream& os, const WifiPsduMap& psduMap); + +/** + * @brief Stream insertion operator. + * + * @param os the stream + * @param psduMap the PSDU map + * @returns a reference to the stream + */ +std::ostream& operator<<(std::ostream& os, const WifiConstPsduMap& psduMap); + } // namespace ns3 #endif /* WIFI_PSDU_H */