49 #define HEXHILOW(hi, lo) \ 50 std::hex << std::setfill ('0') << std::right << " (0x" \ 51 << std::setw (16) << hi << " " \ 52 << std::setw (16) << lo \ 53 << std::dec << std::setfill (' ') << std::left << ")" 71 const bool negative = (value < 0);
72 const int64x64_t absVal = (negative ? -value : value);
77 std::size_t precision =
static_cast<std::size_t
> (os.precision ());
78 std::ios_base::fmtflags ff = os.flags ();
79 const bool floatfield = os.flags () & std::ios_base::floatfield;
80 os << std::setw (1) << std::noshowpos;
82 os << std::right << (negative ?
"-" :
"+");
84 std::ostringstream oss;
89 std::size_t places = 0;
93 << (floatfield ?
" f" :
" ")
94 <<
"[" << precision <<
"] " << hi <<
". " 102 digit = low.GetHigh ();
104 "digit " << digit <<
" out of range [0,9] " 109 oss << std::setw (1) << digit;
114 more = places < precision;
119 more = low.GetLow () && (places < 20);
123 << (floatfield ?
"f" :
" ")
124 <<
"[" << places <<
"] " << digit
125 <<
HEXHILOW (low.GetHigh (), low.GetLow ())
126 << std::dec << std::setfill (
' ' ) << std::left);
132 std::string digits = oss.str ();
134 int64_t nextDigit = low.GetHigh ();
135 if ( (nextDigit > 5) || ((nextDigit == 5) && (digit % 2 == 1)) )
139 for (std::string::reverse_iterator rit = digits.rbegin ();
140 rit != digits.rend ();
161 digits.insert (digits.begin (),
'1');
181 const char *buf = str.c_str ();
186 retval += *buf -
'0';
207 for (std::string::const_reverse_iterator rit = str.rbegin ();
211 int digit = *rit -
'0';
213 "digit " << digit <<
" out of range [0,9]" 214 <<
" streaming in low digits \"" << str <<
"\"");
215 low = (low + digit + round) / 10;
228 std::string::size_type cur;
229 cur = str.find_first_not_of (
" ");
230 std::string::size_type next;
232 next = str.find (
"-", cur);
233 if (next != std::string::npos)
240 next = str.find (
"+", cur);
241 if (next != std::string::npos)
254 next = str.find (
".", cur);
255 if (next != std::string::npos)
258 lo =
ReadLoDigits (str.substr (next+1, str.size ()-(next+1)));
260 else if (cur != std::string::npos)
272 value = negative ? -value : value;
std::istream & operator>>(std::istream &is, Angles &a)
initialize a struct Angles from input
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
High precision numerical type, implementing Q64.64 fixed precision.
NS_ASSERT() and NS_ASSERT_MSG() macro definitions.
#define NS_LOG_COMPONENT_DEFINE_MASK(name, mask)
Define a logging component with a mask.
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
static uint64_t ReadHiDigits(std::string str)
Read the integer portion of a number from a string containing just the integral digits (no decimal po...
Prefix all trace prints with simulation time.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
#define HEXHILOW(hi, lo)
Print the high and low words of an int64x64 in hex, for debugging.
static uint64_t ReadLoDigits(std::string str)
Read the fractional part of a number from a string containing just the decimal digits of the fraction...
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
uint64_t GetLow(void) const
Get the fractional portion of this value, unscaled.
Declaration of the ns3::int64x64_t type and associated operators.
int64_t GetHigh(void) const
Get the integer portion.