23 #include "ns3/unused.h" 36 std::string::size_type
n = s.find_first_not_of (
"0123456789.");
37 if (
n != std::string::npos)
39 std::istringstream iss;
40 iss.str (s.substr (0,
n));
43 std::string trailer = s.substr (
n, std::string::npos);
48 *value =
static_cast<uint32_t
>(r);
50 else if (trailer ==
"kB" || trailer ==
"KB")
54 *value =
static_cast<uint32_t
>(r * 1000);
56 else if (trailer ==
"KiB")
60 *value =
static_cast<uint32_t
>(r * 1024);
62 else if (trailer ==
"MB")
66 *value =
static_cast<uint32_t
>(r * 1000000);
68 else if (trailer ==
"MiB")
72 *value =
static_cast<uint32_t
>(r * 1048576);
74 else if (trailer ==
"p")
78 *value =
static_cast<uint32_t
>(r);
80 else if (trailer ==
"kp" || trailer ==
"Kp")
84 *value =
static_cast<uint32_t
>(r * 1000);
86 else if (trailer ==
"Kip")
90 *value =
static_cast<uint32_t
>(r * 1024);
92 else if (trailer ==
"Mp")
96 *value =
static_cast<uint32_t
>(r * 1000000);
98 else if (trailer ==
"Mip")
102 *value =
static_cast<uint32_t
>(r * 1048576);
205 is.setstate (std::ios_base::failbit);
std::istream & operator>>(std::istream &is, Angles &a)
initialize a struct Angles from input
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Class for representing queue sizes.
uint32_t m_value
queue size [bytes or packets]
uint32_t GetValue() const
Get the underlying value.
QueueSizeUnit
Enumeration of the operating modes of queues.
#define ATTRIBUTE_HELPER_CPP(type)
Define the attribute value, accessor and checkers for class type.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_UNUSED(x)
Mark a local variable as unused.
static bool DoParse(const std::string s, QueueSizeUnit *unit, uint32_t *value)
Parse a string representing a QueueSize.
Use number of packets for queue size.
bool operator<=(const QueueSize &rhs) const
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool operator==(const QueueSize &rhs) const
QueueSizeUnit GetUnit() const
Get the underlying unit.
bool operator>(const QueueSize &rhs) const
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
bool operator!=(const QueueSize &rhs) const
bool operator<(const QueueSize &rhs) const
bool operator>=(const QueueSize &rhs) const
Use number of bytes for queue size.