LEFT | RIGHT |
(no file at all) | |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2008 INRIA | 3 * Copyright (c) 2008 INRIA |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 void | 282 void |
283 CommandLine::PrintGroup (std::ostream &os, const std::string &group) const | 283 CommandLine::PrintGroup (std::ostream &os, const std::string &group) const |
284 { | 284 { |
285 NS_LOG_FUNCTION (this); | 285 NS_LOG_FUNCTION (this); |
286 | 286 |
287 os << "TypeIds in group " << group << ":" << std::endl; | 287 os << "TypeIds in group " << group << ":" << std::endl; |
288 ·· | 288 ·· |
289 // Sort output | 289 // Sort output |
290 std::vector<std::string> groupTypes; | 290 std::vector<std::string> groupTypes; |
291 ·· | 291 ·· |
292 for (uint32_t i = 0; i < TypeId::GetRegisteredN (); ++i) | 292 for (uint16_t i = 0; i < TypeId::GetRegisteredN (); ++i) |
293 { | 293 { |
294 std::stringstream ss; | 294 std::stringstream ss; |
295 TypeId tid = TypeId::GetRegistered (i); | 295 TypeId tid = TypeId::GetRegistered (i); |
296 if (tid.GetGroupName () == group) | 296 if (tid.GetGroupName () == group) |
297 { | 297 { |
298 ss << " " <<tid.GetName () << std::endl; | 298 ss << " " <<tid.GetName () << std::endl; |
299 } | 299 } |
300 groupTypes.push_back (ss.str ()); | 300 groupTypes.push_back (ss.str ()); |
301 } | 301 } |
302 std::sort (groupTypes.begin (), groupTypes.end ()); | 302 std::sort (groupTypes.begin (), groupTypes.end ()); |
303 for (std::vector<std::string>::const_iterator it = groupTypes.begin (); | 303 for (std::vector<std::string>::const_iterator it = groupTypes.begin (); |
304 it < groupTypes.end (); | 304 it < groupTypes.end (); |
305 ++it) | 305 ++it) |
306 { | 306 { |
307 os << *it; | 307 os << *it; |
308 } | 308 } |
309 } | 309 } |
310 | 310 |
311 void | 311 void |
312 CommandLine::PrintTypeIds (std::ostream &os) const | 312 CommandLine::PrintTypeIds (std::ostream &os) const |
313 { | 313 { |
314 NS_LOG_FUNCTION (this); | 314 NS_LOG_FUNCTION (this); |
315 os << "Registered TypeIds:" << std::endl; | 315 os << "Registered TypeIds:" << std::endl; |
316 | 316 |
317 // Sort output | 317 // Sort output |
318 std::vector<std::string> types; | 318 std::vector<std::string> types; |
319 ···· | 319 ···· |
320 for (uint32_t i = 0; i < TypeId::GetRegisteredN (); ++i) | 320 for (uint16_t i = 0; i < TypeId::GetRegisteredN (); ++i) |
321 { | 321 { |
322 std::stringstream ss; | 322 std::stringstream ss; |
323 TypeId tid = TypeId::GetRegistered (i); | 323 TypeId tid = TypeId::GetRegistered (i); |
324 ss << " " << tid.GetName () << std::endl; | 324 ss << " " << tid.GetName () << std::endl; |
325 types.push_back (ss.str ()); | 325 types.push_back (ss.str ()); |
326 } | 326 } |
327 std::sort (types.begin (), types.end ()); | 327 std::sort (types.begin (), types.end ()); |
328 for (std::vector<std::string>::const_iterator it = types.begin (); | 328 for (std::vector<std::string>::const_iterator it = types.begin (); |
329 it < types.end (); | 329 it < types.end (); |
330 ++it) | 330 ++it) |
331 { | 331 { |
332 os << *it; | 332 os << *it; |
333 } | 333 } |
334 } | 334 } |
335 | 335 |
336 void | 336 void |
337 CommandLine::PrintGroups (std::ostream &os) const | 337 CommandLine::PrintGroups (std::ostream &os) const |
338 { | 338 { |
339 NS_LOG_FUNCTION (this); | 339 NS_LOG_FUNCTION (this); |
340 | 340 |
341 std::set<std::string> groups; | 341 std::set<std::string> groups; |
342 for (uint32_t i = 0; i < TypeId::GetRegisteredN (); ++i) | 342 for (uint16_t i = 0; i < TypeId::GetRegisteredN (); ++i) |
343 { | 343 { |
344 TypeId tid = TypeId::GetRegistered (i); | 344 TypeId tid = TypeId::GetRegistered (i); |
345 groups.insert (tid.GetGroupName ()); | 345 groups.insert (tid.GetGroupName ()); |
346 } | 346 } |
347 ·· | 347 ·· |
348 os << "Registered TypeId groups:" << std::endl; | 348 os << "Registered TypeId groups:" << std::endl; |
349 // Sets are already sorted | 349 // Sets are already sorted |
350 for (std::set<std::string>::const_iterator k = groups.begin (); | 350 for (std::set<std::string>::const_iterator k = groups.begin (); |
351 k != groups.end (); | 351 k != groups.end (); |
352 ++k) | 352 ++k) |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 std::ostringstream oss; | 514 std::ostringstream oss; |
515 oss << std::boolalpha << val; | 515 oss << std::boolalpha << val; |
516 return oss.str (); | 516 return oss.str (); |
517 } | 517 } |
518 | 518 |
519 template <> | 519 template <> |
520 bool | 520 bool |
521 CommandLineHelper::UserItemParse<bool> (const std::string value, bool & val) | 521 CommandLineHelper::UserItemParse<bool> (const std::string value, bool & val) |
522 { | 522 { |
523 std::string src = value; | 523 std::string src = value; |
524 std::transform(src.begin(), src.end(), src.begin(), ::tolower); | 524 std::transform(src.begin(), src.end(), src.begin(), |
525 ·· | 525 [](char c) {return static_cast<char>(std::tolower(c)); }); |
526 if (src.length () == 0) | 526 if (src.length () == 0) |
527 { | 527 { |
528 val = ! val; | 528 val = ! val; |
529 return true; | 529 return true; |
530 } | 530 } |
531 else if ( (src == "true") || (src == "t") ) | 531 else if ( (src == "true") || (src == "t") ) |
532 { | 532 { |
533 val = true; | 533 val = true; |
534 return true; | 534 return true; |
535 } | 535 } |
(...skipping 12 matching lines...) Expand all Loading... |
548 } | 548 } |
549 | 549 |
550 std::ostream & | 550 std::ostream & |
551 operator << (std::ostream & os, const CommandLine & cmd) | 551 operator << (std::ostream & os, const CommandLine & cmd) |
552 { | 552 { |
553 cmd.PrintHelp (os); | 553 cmd.PrintHelp (os); |
554 return os; | 554 return os; |
555 } | 555 } |
556 | 556 |
557 } // namespace ns3 | 557 } // namespace ns3 |
LEFT | RIGHT |