73   for (Items::const_iterator i = cmd.
m_items.begin (); 
 
   86   for (Items::const_iterator i = 
m_items.begin (); i != 
m_items.end (); ++i)
 
  120   for (iargc--; iargc > 0; iargc--)
 
  123       std::string param = argv[iargc];
 
  124       std::string::size_type cur = param.find (
"--");
 
  127           param = param.substr (2, param.size () - 2);
 
  131           cur = param.find (
"-");
 
  134               param = param.substr (1, param.size () - 1);
 
  142       cur = param.find (
"=");
 
  143       std::string name, value;
 
  144       if (cur == std::string::npos)
 
  151           name = param.substr (0, cur);
 
  152           value = param.substr (cur + 1, param.size () - (cur+1));
 
  157 #ifdef ENABLE_DES_METRICS 
  168   os << 
m_name << 
" [Program Arguments] [General Arguments]" 
  180       for (Items::const_iterator i = 
m_items.begin (); i != 
m_items.end (); ++i)
 
  182           width = 
std::max (width, (*i)->m_name.size ());
 
  187       os << 
"Program Arguments:" << std::endl;
 
  188       for (Items::const_iterator i = 
m_items.begin (); i != 
m_items.end (); ++i)
 
  191                     << std::left << std::setw (width) << ( (*i)->m_name + 
":")
 
  195           if ( (*i)->HasDefault ())
 
  197               os << 
" [" << (*i)->GetDefault () << 
"]";
 
  205     << 
"General Arguments:\n" 
  206     << 
"    --PrintGlobals:              Print the list of globals.\n" 
  207     << 
"    --PrintGroups:               Print the list of groups.\n" 
  208     << 
"    --PrintGroup=[group]:        Print all TypeIds of group.\n" 
  209     << 
"    --PrintTypeIds:              Print all TypeIds.\n" 
  210     << 
"    --PrintAttributes=[typeid]:  Print all attributes of typeid.\n" 
  211     << 
"    --PrintHelp:                 Print this help message.\n" 
  220   os << 
"Global values:" << std::endl;
 
  223   std::vector<std::string> globals;
 
  229       std::stringstream ss;
 
  230       ss << 
"    --" << (*i)->GetName () << 
"=[";
 
  234       ss << v.
Get () << 
"]" << std::endl;
 
  235       ss << 
"        " << (*i)->GetHelp () << std::endl;
 
  236       globals.push_back (ss.str ());
 
  238   std::sort (globals.begin (), globals.end ());
 
  239   for (std::vector<std::string>::const_iterator it = globals.begin ();
 
  255       NS_FATAL_ERROR (
"Unknown type=" << type << 
" in --PrintAttributes");
 
  258   os << 
"Attributes for TypeId " << tid.
GetName () << std::endl;
 
  261   std::vector<std::string> attributes;
 
  265       std::stringstream ss;
 
  270       ss << 
"        " << info.
help << std::endl;
 
  271       attributes.push_back (ss.str ());
 
  273   std::sort (attributes.begin (), attributes.end ());
 
  274   for (std::vector<std::string>::const_iterator it = attributes.begin ();
 
  275        it < attributes.end ();
 
  288   os << 
"TypeIds in group " << group << 
":" << std::endl;
 
  291   std::vector<std::string> groupTypes;
 
  295       std::stringstream ss;
 
  299           ss << 
"    " <<tid.
GetName () << std::endl;
 
  301       groupTypes.push_back (ss.str ());
 
  303   std::sort (groupTypes.begin (), groupTypes.end ());
 
  304   for (std::vector<std::string>::const_iterator it = groupTypes.begin ();
 
  305        it < groupTypes.end ();
 
  316   os << 
"Registered TypeIds:" << std::endl;
 
  319   std::vector<std::string> types;
 
  323       std::stringstream ss;
 
  325       ss << 
"    " << tid.
GetName () << std::endl;
 
  326       types.push_back (ss.str ());
 
  328   std::sort (types.begin (), types.end ());
 
  329   for (std::vector<std::string>::const_iterator it = types.begin ();
 
  342   std::set<std::string> groups;
 
  349   os << 
"Registered TypeId groups:" << std::endl;
 
  351   for (std::set<std::string>::const_iterator k = groups.begin ();
 
  355       os << 
"    " << *k << std::endl;
 
  364   NS_LOG_DEBUG (
"Handle arg name=" << name << 
" value=" << value);
 
  365   if (name == 
"PrintHelp" || name == 
"help")
 
  371   else if (name == 
"PrintGroups")
 
  377   else if (name == 
"PrintTypeIds")
 
  383   else if (name == 
"PrintGlobals")
 
  389   else if (name == 
"PrintGroup")
 
  395   else if (name == 
"PrintAttributes")
 
  403       for (Items::const_iterator i = 
m_items.begin (); i != 
m_items.end (); ++i)
 
  405           if ((*i)->m_name == name)
 
  407               if (!(*i)->Parse (value))
 
  409                   std::cerr << 
"Invalid argument value: " 
  410                             << name << 
"=" << value << std::endl;
 
  423       std::cerr << 
"Invalid command-line arguments: --" 
  424                 << name << 
"=" << value << std::endl;
 
  434   NS_LOG_DEBUG (
"CommandLine::CallbackItem::Parse \"" << value << 
"\"");
 
  435   return m_callback (value);
 
  440                        const std::string &help,
 
  453                        const std::string &attributePath)
 
  457   size_t colon = attributePath.rfind (
"::");
 
  458   const std::string typeName = attributePath.substr (0, colon);
 
  459   NS_LOG_DEBUG (
"typeName: '" << typeName << 
"', colon: " << colon);
 
  467   const std::string attrName = attributePath.substr (colon + 2);
 
  474   std::stringstream ss;
 
  476      << 
" (" << attributePath << 
") [" 
  487                               const std::string value)
 
  515   std::ostringstream oss;
 
  516   oss << std::boolalpha << val;
 
  524   std::string src = value;
 
  525   std::transform(src.begin(), src.end(), src.begin(), ::tolower);
 
  527   if (src.length () == 0)
 
  532   else if ( (src == 
"true") || (src == 
"t") )
 
  537   else if ( (src == 
"false") || (src == 
"f"))
 
  544       std::istringstream iss;
 
  547       return !iss.bad () && !iss.fail ();
 
~CommandLine()
Destructor. 
uint32_t GetAttributeN(void) const 
Get the number of attributes. 
void Initialize(int argc, char *argv[], std::string outDir="")
Open the DesMetrics trace file and print the header. 
Smart pointer class similar to boost::intrusive_ptr. 
#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)
std::string Get(void) const 
Items m_items
The list of arguments. 
Hold variables of type string. 
String attribute value declarations. 
bool SetGlobalFailSafe(std::string name, const AttributeValue &value)
void PrintGlobals(std::ostream &os) const 
Handler for --PrintGlobals: print all global variables and values. 
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument. 
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
Vector::const_iterator Iterator
Iterator type for the list of all global values. 
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate. 
static bool LookupByNameFailSafe(std::string name, TypeId *tid)
Get a TypeId by name. 
std::string GetDefault< bool >(const bool &val)
Helper to specialize CommandLine::UserItem::GetDefault() on bool. 
Declaration of the various ns3::Config functions and classes. 
static DesMetrics * Get(void)
Get a pointer to the singleton instance. 
ns3::DesMetrics declaration. 
std::list< std::string > Split(std::string path)
Split a file system path into directories according to the local path separator. 
std::string GetName() const 
Get the program name. 
void Usage(const std::string usage)
Supply the program usage and documentation. 
System-independent file and directory function declarations. 
void Clear(void)
Remove all arguments, Usage(), name. 
void PrintAttributes(std::ostream &os, const std::string &type) const 
Handler for --PrintAttributes: print the attributes for a given type. 
An argument Item using a Callback to parse the input. 
void PrintHelp(std::ostream &os) const 
Print program usage to the desired output stream. 
static bool HandleAttribute(const std::string name, const std::string value)
Callback function to handle attributes. 
std::string m_usage
The Usage string. 
static uint32_t GetRegisteredN(void)
Get the number of registered TypeIds. 
virtual std::string GetDefault() const 
static Iterator Begin(void)
The Begin iterator. 
static TypeId GetRegistered(uint32_t i)
Get a TypeId by index. 
std::string m_name
The program name. 
Parse command-line arguments. 
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 
void PrintGroups(std::ostream &os) const 
Handler for --PrintGroups: print all TypeId group names. 
CommandLine class declaration. 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
CommandLine & operator=(const CommandLine &cmd)
Assignment. 
bool LookupAttributeByName(std::string name, struct AttributeInformation *info) const 
Find an Attribute by name, retrieving the associated AttributeInformation. 
ns3::TypeId declaration; inline and template implementations. 
std::string m_name
Argument label: ---m_name=... 
bool UserItemParse< bool >(const std::string value, bool &val)
Helpers to specialize CommandLine::UserItem::Parse() on bool. 
Callback< bool, std::string > m_callback
The Callback. 
std::string GetName(void) const 
Get the name. 
ns3::GlobalValue declaration. 
virtual bool HasDefault() const 
virtual ~Item()
Destructor. 
std::string m_help
Argument help string. 
CommandLine()
Constructor. 
void AddValue(const std::string &name, const std::string &help, T &value)
Add a program argument, assigning to POD. 
static Iterator End(void)
The End iterator. 
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG. 
void PrintTypeIds(std::ostream &os) const 
Handler for --PrintTypeIds: print all TypeId names. 
void Copy(const CommandLine &cmd)
Copy constructor. 
void PrintGroup(std::ostream &os, const std::string &group) const 
Handler for --PrintGroup: print all types belonging to a given group. 
std::string GetAttributeFullName(uint32_t i) const 
Get the Attribute name by index. 
void Parse(int argc, char *argv[])
Parse the program arguments. 
std::string GetGroupName(void) const 
Get the group name. 
struct TypeId::AttributeInformation GetAttribute(uint32_t i) const 
Get Attribute information by index. 
a unique identifier for an interface. 
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...