A Discrete-Event Network Simulator
API
command-line.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008 INRIA
4  *
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
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 
21 #include <algorithm> // for transform
22 #include <cctype> // for tolower
23 #include <cstdlib> // for exit
24 #include <iomanip> // for setw, boolalpha
25 #include <set>
26 #include <sstream>
27 
28 #include "command-line.h"
29 #include "des-metrics.h"
30 #include "log.h"
31 #include "config.h"
32 #include "global-value.h"
33 #include "system-path.h"
34 #include "type-id.h"
35 #include "string.h"
36 
37 
44 namespace ns3 {
45 
46 NS_LOG_COMPONENT_DEFINE ("CommandLine");
47 
49  : m_NNonOptions (0),
50  m_nonOptionCount (0)
51 {
52  NS_LOG_FUNCTION (this);
53 }
55 {
56  Copy (cmd);
57 }
60 {
61  Clear ();
62  Copy (cmd);
63  return *this;
64 }
66 {
67  NS_LOG_FUNCTION (this);
68  Clear ();
69 }
70 void
72 {
74 
75  std::copy (cmd.m_options.begin (), cmd.m_options.end (), m_options.end ());
76  std::copy (cmd.m_nonOptions.begin (), cmd.m_nonOptions.end (), m_nonOptions.end ());
77 
78  m_NNonOptions = cmd.m_NNonOptions;
79  m_usage = cmd.m_usage;
80  m_name = cmd.m_name;
81 }
82 void
84 {
85  NS_LOG_FUNCTION (this);
86 
87  for (auto i : m_options)
88  {
89  delete i;
90  }
91  for (auto i : m_nonOptions)
92  {
93  delete i;
94  }
95  m_options.clear ();
96  m_nonOptions.clear ();
97  m_NNonOptions = 0;
98  m_usage = "";
99  m_name = "";
100 }
101 
102 void
103 CommandLine::Usage (const std::string usage)
104 {
105  m_usage = usage;
106 }
107 
108 std::string
110 {
111  return m_name;
112 }
113 
115 {
116  NS_LOG_FUNCTION (this);
117 }
118 
119 void
120 CommandLine::Parse (std::vector<std::string> args)
121 {
122  NS_LOG_FUNCTION (this << args.size () << args);
123 
124  m_nonOptionCount = 0;
125  m_name = "";
126 
127  if (args.size () > 0)
128  {
129  m_name = SystemPath::Split (args[0]).back ();
130  args.erase (args.begin ()); // discard the program name
131 
132  for (auto param : args)
133  {
134  if (HandleOption (param)) continue;
135  if (HandleNonOption (param)) continue;
136 
137  // is this possible?
138  NS_ASSERT_MSG (false,
139  "unexpected error parsing command line parameter: '"
140  << param << "'");
141 
142  }
143  }
144 
145 #ifdef ENABLE_DES_METRICS
146  DesMetrics::Get ()->Initialize (args);
147 #endif
148 
149 }
150 
151 bool
152 CommandLine::HandleOption (const std::string & param) const
153 {
154  // remove leading "--" or "-"
155  std::string arg = param;
156  std::string::size_type cur = arg.find ("--");
157  if (cur == 0)
158  {
159  arg = arg.substr (2, arg.size () - 2);
160  }
161  else
162  {
163  cur = arg.find ("-");
164  if (cur == 0)
165  {
166  arg = arg.substr (1, arg.size () - 1);
167  }
168  else
169  {
170  // non-option argument?
171  return false;
172  }
173  }
174  // find any value following '='
175  cur = arg.find ("=");
176  std::string name, value;
177  if (cur == std::string::npos)
178  {
179  name = arg;
180  value = "";
181  }
182  else
183  {
184  name = arg.substr (0, cur);
185  value = arg.substr (cur + 1, arg.size () - (cur+1));
186  }
187  HandleArgument (name, value);
188 
189  return true;
190 }
191 
192 bool
193 CommandLine::HandleNonOption (const std::string &value)
194 {
195  NS_LOG_FUNCTION (this << value);
196 
197  if (m_nonOptionCount == m_nonOptions.size())
198  {
199  // Add an unspecified non-option as a string
200  NS_LOG_LOGIC ("adding StringItem, NOCount:" << m_nonOptionCount
201  << ", NOSize:" << m_nonOptions.size ());
202  StringItem * item = new StringItem;
203  item->m_name = "extra-non-option-argument";
204  item->m_help = "Extra non-option argument encountered.";
205  item->m_value = value;
206  m_nonOptions.push_back (item);
207  }
208 
209  auto i = m_nonOptions[m_nonOptionCount];
210  if (!i->Parse (value))
211  {
212  std::cerr << "Invalid non-option argument value "
213  << value << " for " << i->m_name
214  << std::endl;
215  std::exit (1);
216  }
218  return true;
219 }
220 
221 
222 
223 void
224 CommandLine::Parse (int argc, char *argv[])
225 {
226  NS_LOG_FUNCTION (this << argc);
227  std::vector<std::string> args (argv, argv + argc);
228  Parse (args);
229 }
230 
231 void
232 CommandLine::PrintHelp (std::ostream &os) const
233 {
234  NS_LOG_FUNCTION (this);
235 
236  // Hack to show just the declared non-options
237  Items nonOptions (m_nonOptions.begin (),
238  m_nonOptions.begin () + m_NNonOptions);
239  os << m_name
240  << (m_options.size () ? " [Program Options]" : "")
241  << (nonOptions.size () ? " [Program Arguments]" : "")
242  << " [General Arguments]"
243  << std::endl;
244 
245  if (m_usage.length ())
246  {
247  os << std::endl;
248  os << m_usage << std::endl;
249  }
250 
251  std::size_t width = 0;
252  for (auto it : m_options)
253  {
254  width = std::max (width, it->m_name.size ());
255  }
256  for (auto it : nonOptions)
257  {
258  width = std::max (width, it->m_name.size ());
259  }
260  width += 3; // room for ": " between option and help
261 
262  if (!m_options.empty ())
263  {
264  os << std::endl;
265  os << "Program Options:" << std::endl;
266  for (auto i : m_options)
267  {
268  os << " --"
269  << std::left << std::setw (width) << ( i->m_name + ":")
270  << std::right
271  << i->m_help;
272 
273  if ( i->HasDefault ())
274  {
275  os << " [" << i->GetDefault () << "]";
276  }
277  os << std::endl;
278  }
279  }
280 
281  if (!nonOptions.empty ())
282  {
283  width += 2; // account for "--" added above
284  os << std::endl;
285  os << "Program Arguments:" << std::endl;
286  for (auto i : nonOptions)
287  {
288  os << " "
289  << std::left << std::setw (width) << ( i->m_name + ":")
290  << std::right
291  << i->m_help;
292 
293  if ( i->HasDefault ())
294  {
295  os << " [" << i->GetDefault () << "]";
296  }
297  os << std::endl;
298  }
299  }
300 
301  os << std::endl;
302  os
303  << "General Arguments:\n"
304  << " --PrintGlobals: Print the list of globals.\n"
305  << " --PrintGroups: Print the list of groups.\n"
306  << " --PrintGroup=[group]: Print all TypeIds of group.\n"
307  << " --PrintTypeIds: Print all TypeIds.\n"
308  << " --PrintAttributes=[typeid]: Print all attributes of typeid.\n"
309  << " --PrintHelp: Print this help message.\n"
310  << std::endl;
311 }
312 
313 void
314 CommandLine::PrintGlobals (std::ostream &os) const
315 {
316  NS_LOG_FUNCTION (this);
317 
318  os << "Global values:" << std::endl;
319 
320  // Sort output
321  std::vector<std::string> globals;
322 
324  i != GlobalValue::End ();
325  ++i)
326  {
327  std::stringstream ss;
328  ss << " --" << (*i)->GetName () << "=[";
329  Ptr<const AttributeChecker> checker = (*i)->GetChecker ();
330  StringValue v;
331  (*i)->GetValue (v);
332  ss << v.Get () << "]" << std::endl;
333  ss << " " << (*i)->GetHelp () << std::endl;
334  globals.push_back (ss.str ());
335  }
336  std::sort (globals.begin (), globals.end ());
337  for (std::vector<std::string>::const_iterator it = globals.begin ();
338  it < globals.end ();
339  ++it)
340  {
341  os << *it;
342  }
343 }
344 
345 void
346 CommandLine::PrintAttributes (std::ostream &os, const std::string &type) const
347 {
348  NS_LOG_FUNCTION (this);
349 
350  TypeId tid;
351  if (!TypeId::LookupByNameFailSafe (type, &tid))
352  {
353  NS_FATAL_ERROR ("Unknown type=" << type << " in --PrintAttributes");
354  }
355 
356  os << "Attributes for TypeId " << tid.GetName () << std::endl;
357 
358  // Sort output
359  std::vector<std::string> attributes;
360 
361  for (uint32_t i = 0; i < tid.GetAttributeN (); ++i)
362  {
363  std::stringstream ss;
364  ss << " --" << tid.GetAttributeFullName (i) << "=[";
365  struct TypeId::AttributeInformation info = tid.GetAttribute (i);
366  ss << info.initialValue->SerializeToString (info.checker) << "]"
367  << std::endl;
368  ss << " " << info.help << std::endl;
369  attributes.push_back (ss.str ());
370  }
371  std::sort (attributes.begin (), attributes.end ());
372  for (std::vector<std::string>::const_iterator it = attributes.begin ();
373  it < attributes.end ();
374  ++it)
375  {
376  os << *it;
377  }
378 }
379 
380 
381 void
382 CommandLine::PrintGroup (std::ostream &os, const std::string &group) const
383 {
384  NS_LOG_FUNCTION (this);
385 
386  os << "TypeIds in group " << group << ":" << std::endl;
387 
388  // Sort output
389  std::vector<std::string> groupTypes;
390 
391  for (uint16_t i = 0; i < TypeId::GetRegisteredN (); ++i)
392  {
393  std::stringstream ss;
394  TypeId tid = TypeId::GetRegistered (i);
395  if (tid.GetGroupName () == group)
396  {
397  ss << " " <<tid.GetName () << std::endl;
398  }
399  groupTypes.push_back (ss.str ());
400  }
401  std::sort (groupTypes.begin (), groupTypes.end ());
402  for (std::vector<std::string>::const_iterator it = groupTypes.begin ();
403  it < groupTypes.end ();
404  ++it)
405  {
406  os << *it;
407  }
408 }
409 
410 void
411 CommandLine::PrintTypeIds (std::ostream &os) const
412 {
413  NS_LOG_FUNCTION (this);
414  os << "Registered TypeIds:" << std::endl;
415 
416  // Sort output
417  std::vector<std::string> types;
418 
419  for (uint16_t i = 0; i < TypeId::GetRegisteredN (); ++i)
420  {
421  std::stringstream ss;
422  TypeId tid = TypeId::GetRegistered (i);
423  ss << " " << tid.GetName () << std::endl;
424  types.push_back (ss.str ());
425  }
426  std::sort (types.begin (), types.end ());
427  for (std::vector<std::string>::const_iterator it = types.begin ();
428  it < types.end ();
429  ++it)
430  {
431  os << *it;
432  }
433 }
434 
435 void
436 CommandLine::PrintGroups (std::ostream &os) const
437 {
438  NS_LOG_FUNCTION (this);
439 
440  std::set<std::string> groups;
441  for (uint16_t i = 0; i < TypeId::GetRegisteredN (); ++i)
442  {
443  TypeId tid = TypeId::GetRegistered (i);
444  groups.insert (tid.GetGroupName ());
445  }
446 
447  os << "Registered TypeId groups:" << std::endl;
448  // Sets are already sorted
449  for (std::set<std::string>::const_iterator k = groups.begin ();
450  k != groups.end ();
451  ++k)
452  {
453  os << " " << *k << std::endl;
454  }
455 }
456 
457 void
458 CommandLine::HandleArgument (const std::string &name, const std::string &value) const
459 {
460  NS_LOG_FUNCTION (this << name << value);
461 
462  NS_LOG_DEBUG ("Handle arg name=" << name << " value=" << value);
463 
464  // Hard-coded options
465  if (name == "PrintHelp" || name == "help")
466  {
467  // method below never returns.
468  PrintHelp (std::cout);
469  std::exit (0);
470  }
471  else if (name == "PrintGroups")
472  {
473  // method below never returns.
474  PrintGroups (std::cout);
475  std::exit (0);
476  }
477  else if (name == "PrintTypeIds")
478  {
479  // method below never returns.
480  PrintTypeIds (std::cout);
481  std::exit (0);
482  }
483  else if (name == "PrintGlobals")
484  {
485  // method below never returns.
486  PrintGlobals (std::cout);
487  std::exit (0);
488  }
489  else if (name == "PrintGroup")
490  {
491  // method below never returns.
492  PrintGroup (std::cout, value);
493  std::exit (0);
494  }
495  else if (name == "PrintAttributes")
496  {
497  // method below never returns.
498  PrintAttributes (std::cout, value);
499  std::exit (0);
500  }
501  else
502  {
503  for (auto i : m_options)
504  {
505  if (i->m_name == name)
506  {
507  if (! i->Parse (value))
508  {
509  std::cerr << "Invalid argument value: "
510  << name << "=" << value << std::endl;
511  std::exit (1);
512  }
513  else
514  {
515  return;
516  }
517  }
518  }
519  }
520  // Global or ConfigPath options
521  if (!Config::SetGlobalFailSafe (name, StringValue (value))
522  && !Config::SetDefaultFailSafe (name, StringValue (value)))
523  {
524  std::cerr << "Invalid command-line arguments: --"
525  << name << "=" << value << std::endl;
526  PrintHelp (std::cerr);
527  std::exit (1);
528  }
529 }
530 
531 bool
532 CommandLine::CallbackItem::Parse (const std::string value)
533 {
534  NS_LOG_FUNCTION (this);
535  NS_LOG_DEBUG ("CommandLine::CallbackItem::Parse \"" << value << "\"");
536  return m_callback (value);
537 }
538 
539 void
540 CommandLine::AddValue (const std::string &name,
541  const std::string &help,
543 {
544  NS_LOG_FUNCTION (this << &name << &help << &callback);
545  CallbackItem *item = new CallbackItem ();
546  item->m_name = name;
547  item->m_help = help;
548  item->m_callback = callback;
549  m_options.push_back (item);
550 }
551 
552 void
553 CommandLine::AddValue (const std::string &name,
554  const std::string &attributePath)
555 {
556  NS_LOG_FUNCTION (this << name << attributePath);
557  // Attribute name is last token
558  std::size_t colon = attributePath.rfind ("::");
559  const std::string typeName = attributePath.substr (0, colon);
560  NS_LOG_DEBUG ("typeName: '" << typeName << "', colon: " << colon);
561 
562  TypeId tid;
563  if (!TypeId::LookupByNameFailSafe (typeName, &tid))
564  {
565  NS_FATAL_ERROR ("Unknown type=" << typeName);
566  }
567 
568  const std::string attrName = attributePath.substr (colon + 2);
569  struct TypeId::AttributeInformation info;
570  if (!tid.LookupAttributeByName (attrName, &info))
571  {
572  NS_FATAL_ERROR ("Attribute not found: " << attributePath);
573  }
574 
575  std::stringstream ss;
576  ss << info.help
577  << " (" << attributePath << ") ["
578  << info.initialValue->SerializeToString (info.checker) << "]";
579 
580  AddValue (name, ss.str (),
582 }
583 
584 std::string
585 CommandLine::GetExtraNonOption (std::size_t i) const
586 {
587  std::string value;
588 
589  if (m_nonOptions.size () >= i + m_NNonOptions)
590  {
591  auto ip = dynamic_cast<StringItem *> (m_nonOptions[i + m_NNonOptions]);
592  if (ip != NULL)
593  {
594  value = ip->m_value;
595  }
596  }
597  return value;
598 }
599 
600 std::size_t
602 {
603  if (m_nonOptions.size () > m_NNonOptions)
604  {
605  return m_nonOptions.size () - m_NNonOptions;
606  }
607  else
608  {
609  return 0;
610  }
611 }
612 
613 
614 /* static */
615 bool
616 CommandLine::HandleAttribute (const std::string name,
617  const std::string value)
618 {
619  bool success = true;
620  if (!Config::SetGlobalFailSafe (name, StringValue (value))
621  && !Config::SetDefaultFailSafe (name, StringValue (value)))
622  {
623  success = false;
624  }
625  return success;
626 }
627 
628 
629 bool
631 {
632  return false;
633 }
634 
635 std::string
637 {
638  return "";
639 }
640 
641 bool
642 CommandLine::StringItem::Parse (const std::string value)
643 {
644  m_value = value;
645  return true;
646 }
647 
648 bool
650 {
651  return false;
652 }
653 
654 std::string
656 {
657  return "";
658 }
659 
660 template <>
661 std::string
663 {
664  std::ostringstream oss;
665  oss << std::boolalpha << val;
666  return oss.str ();
667 }
668 
669 template <>
670 bool
671 CommandLineHelper::UserItemParse<bool> (const std::string value, bool & val)
672 {
673  std::string src = value;
674  std::transform(src.begin(), src.end(), src.begin(),
675  [](char c) {return static_cast<char>(std::tolower(c)); });
676  if (src.length () == 0)
677  {
678  val = ! val;
679  return true;
680  }
681  else if ( (src == "true") || (src == "t") )
682  {
683  val = true;
684  return true;
685  }
686  else if ( (src == "false") || (src == "f"))
687  {
688  val = false;
689  return true;
690  }
691  else
692  {
693  std::istringstream iss;
694  iss.str (src);
695  iss >> val;
696  return !iss.bad () && !iss.fail ();
697  }
698 }
699 
700 std::ostream &
701 operator << (std::ostream & os, const CommandLine & cmd)
702 {
703  cmd.PrintHelp (os);
704  return os;
705 }
706 
707 } // namespace ns3
~CommandLine()
Destructor.
Definition: command-line.cc:65
void PrintHelp(std::ostream &os) const
Print program usage to the desired output stream.
std::string GetName(void) const
Get the name.
Definition: type-id.cc:969
void PrintGroups(std::ostream &os) const
Handler for --PrintGroups: print all TypeId group names.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
bool SetDefaultFailSafe(std::string fullName, const AttributeValue &value)
Definition: config.cc:818
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
Hold variables of type string.
Definition: string.h:41
std::vector< Item * > Items
Argument list container.
Definition: command-line.h:514
ns3::StringValue attribute value declarations.
bool SetGlobalFailSafe(std::string name, const AttributeValue &value)
Definition: config.cc:855
std::string m_value
The argument value.
Definition: command-line.h:420
std::string GetName() const
Get the program name.
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1686
Items m_nonOptions
The list of non-option arguments.
Definition: command-line.h:516
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:204
Vector::const_iterator Iterator
Iterator type for the list of all global values.
Definition: global-value.h:80
static TypeId GetRegistered(uint16_t i)
Get a TypeId by index.
Definition: type-id.cc:870
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:162
cmd
Definition: second.py:35
static bool LookupByNameFailSafe(std::string name, TypeId *tid)
Get a TypeId by name.
Definition: type-id.cc:832
std::string GetDefault< bool >(const bool &val)
Helper to specialize CommandLine::UserItem::GetDefault() on bool.
void PrintGlobals(std::ostream &os) const
Handler for --PrintGlobals: print all global variables and values.
bool LookupAttributeByName(std::string name, struct AttributeInformation *info) const
Find an Attribute by name, retrieving the associated AttributeInformation.
Definition: type-id.cc:877
Declaration of the various ns3::Config functions and classes.
static DesMetrics * Get(void)
Get a pointer to the singleton instance.
Definition: singleton.h:89
ns3::DesMetrics declaration.
void PrintAttributes(std::ostream &os, const std::string &type) const
Handler for --PrintAttributes: print the attributes for a given type.
std::list< std::string > Split(std::string path)
Split a file system path into directories according to the local path separator.
Definition: system-path.cc:205
void Usage(const std::string usage)
Supply the program usage and documentation.
bool HandleNonOption(const std::string &value)
Handle a non-option.
ns3::SystemPath declarations.
void Clear(void)
Remove all arguments, Usage(), name.
Definition: command-line.cc:83
An argument Item using a Callback to parse the input.
Definition: command-line.h:427
void Initialize(std::vector< std::string > args, std::string outDir="")
Open the DesMetrics trace file and print the header.
Definition: des-metrics.cc:42
static bool HandleAttribute(const std::string name, const std::string value)
Callback function to handle attributes.
virtual std::string GetDefault() const
Items m_options
The list of option arguments.
Definition: command-line.h:515
bool HandleOption(const std::string &param) const
Handle an option in the form param=value.
std::string Get(void) const
Definition: string.cc:31
std::string m_usage
The Usage string.
Definition: command-line.h:519
#define max(a, b)
Definition: 80211b.c:43
std::string GetDefault(void) const
static Iterator Begin(void)
The Begin iterator.
Ptr< const AttributeValue > initialValue
Configured initial value.
Definition: type-id.h:86
std::size_t GetNExtraNonOptions(void) const
Get the total number of non-option arguments found, including those configured with AddNonOption() an...
bool Parse(const std::string value)
Parse from a string.
std::string GetExtraNonOption(std::size_t i) const
Get extra non-option arguments by index.
std::string m_name
The program name.
Definition: command-line.h:520
Attribute implementation.
Definition: type-id.h:76
Parse command-line arguments.
Definition: command-line.h:213
void HandleArgument(const std::string &name, const std::string &value) const
Match name against the program or general arguments, and dispatch to the appropriate handler...
std::size_t m_nonOptionCount
The number of actual non-option arguments seen so far.
Definition: command-line.h:518
virtual bool Parse(const std::string value)
Parse from a string.
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:42
ns3::CommandLine declaration.
Ptr< const AttributeChecker > checker
Checker object.
Definition: type-id.h:90
Every class exported by the ns3 library is enclosed in the ns3 namespace.
CommandLine & operator=(const CommandLine &cmd)
Assignment.
Definition: command-line.cc:59
std::string GetGroupName(void) const
Get the group name.
Definition: type-id.cc:961
ns3::TypeId declaration; inline and template implementations.
std::string GetAttributeFullName(std::size_t i) const
Get the Attribute name by index.
Definition: type-id.cc:1082
std::string m_name
Argument label: ---m_name=...
Definition: command-line.h:375
bool UserItemParse< bool >(const std::string value, bool &val)
Helpers to specialize CommandLine::UserItem::Parse() on bool.
void PrintGroup(std::ostream &os, const std::string &group) const
Handler for --PrintGroup: print all types belonging to a given group.
Callback< bool, std::string > m_callback
The Callback.
Definition: command-line.h:437
ns3::GlobalValue declaration.
virtual ~Item()
Destructor.
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
if(desigRtr==addrLocal)
std::string m_help
Argument help string.
Definition: command-line.h:376
CommandLine()
Constructor.
Definition: command-line.cc:48
void AddValue(const std::string &name, const std::string &help, T &value)
Add a program argument, assigning to POD.
Definition: command-line.h:578
std::size_t GetAttributeN(void) const
Get the number of attributes.
Definition: type-id.cc:1069
static Iterator End(void)
The End iterator.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:272
struct TypeId::AttributeInformation GetAttribute(std::size_t i) const
Get Attribute information by index.
Definition: type-id.cc:1076
void Copy(const CommandLine &cmd)
Copy constructor.
Definition: command-line.cc:71
void Parse(int argc, char *argv[])
Parse the program arguments.
std::size_t m_NNonOptions
The expected number of non-option arguments.
Definition: command-line.h:517
static uint16_t GetRegisteredN(void)
Get the number of registered TypeIds.
Definition: type-id.cc:864
Debug message logging.
a unique identifier for an interface.
Definition: type-id.h:58
void PrintTypeIds(std::ostream &os) const
Handler for --PrintTypeIds: print all TypeId names.
std::string help
Attribute help string.
Definition: type-id.h:80
virtual bool HasDefault() const