wifi: Move operator << for WifiPhyState to its header file
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
#ifndef WIFI_PHY_STATE_H
|
||||
#define WIFI_PHY_STATE_H
|
||||
|
||||
#include "ns3/fatal-error.h"
|
||||
|
||||
/**
|
||||
* The state of the PHY layer.
|
||||
*/
|
||||
@@ -58,4 +60,35 @@ enum WifiPhyState
|
||||
OFF
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Stream insertion operator.
|
||||
*
|
||||
* \param os the stream
|
||||
* \param state the state
|
||||
* \returns a reference to the stream
|
||||
*/
|
||||
inline std::ostream& operator<< (std::ostream& os, WifiPhyState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case IDLE:
|
||||
return (os << "IDLE");
|
||||
case CCA_BUSY:
|
||||
return (os << "CCA_BUSY");
|
||||
case TX:
|
||||
return (os << "TX");
|
||||
case RX:
|
||||
return (os << "RX");
|
||||
case SWITCHING:
|
||||
return (os << "SWITCHING");
|
||||
case SLEEP:
|
||||
return (os << "SLEEP");
|
||||
case OFF:
|
||||
return (os << "OFF");
|
||||
default:
|
||||
NS_FATAL_ERROR ("Invalid state");
|
||||
return (os << "INVALID");
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* WIFI_PHY_STATE_H */
|
||||
|
||||
@@ -4135,30 +4135,6 @@ WifiPhy::AssignStreams (int64_t stream)
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::ostream& operator<< (std::ostream& os, WifiPhyState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case WifiPhyState::IDLE:
|
||||
return (os << "IDLE");
|
||||
case WifiPhyState::CCA_BUSY:
|
||||
return (os << "CCA_BUSY");
|
||||
case WifiPhyState::TX:
|
||||
return (os << "TX");
|
||||
case WifiPhyState::RX:
|
||||
return (os << "RX");
|
||||
case WifiPhyState::SWITCHING:
|
||||
return (os << "SWITCHING");
|
||||
case WifiPhyState::SLEEP:
|
||||
return (os << "SLEEP");
|
||||
case WifiPhyState::OFF:
|
||||
return (os << "OFF");
|
||||
default:
|
||||
NS_FATAL_ERROR ("Invalid WifiPhy state");
|
||||
return (os << "INVALID");
|
||||
}
|
||||
}
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -1998,13 +1998,6 @@ private:
|
||||
Callback<void> m_capabilitiesChangedCallback; //!< Callback when PHY capabilities changed
|
||||
};
|
||||
|
||||
/**
|
||||
* \param os output stream
|
||||
* \param state wifi state to stringify
|
||||
* \return output stream
|
||||
*/
|
||||
std::ostream& operator<< (std::ostream& os, WifiPhyState state);
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
#endif /* WIFI_PHY_H */
|
||||
|
||||
Reference in New Issue
Block a user