73   for (Items::const_iterator i = cmd.
m_items.begin (); 
 
   86   for (Items::const_iterator i = 
m_items.begin (); i != 
m_items.end (); ++i)
 
  119   for (
int iargc = 1; iargc < argc; iargc++)
 
  122       std::string param = argv[iargc];
 
  123       std::string::size_type cur = param.find (
"--");
 
  126           param = param.substr (2, param.size () - 2);
 
  130           cur = param.find (
"-");
 
  133               param = param.substr (1, param.size () - 1);
 
  141       cur = param.find (
"=");
 
  142       std::string name, value;
 
  143       if (cur == std::string::npos)
 
  150           name = param.substr (0, cur);
 
  151           value = param.substr (cur + 1, param.size () - (cur+1));
 
  156 #ifdef ENABLE_DES_METRICS 
  167   os << 
m_name << 
" [Program Arguments] [General Arguments]" 
  179       for (Items::const_iterator i = 
m_items.begin (); i != 
m_items.end (); ++i)
 
  181           width = 
std::max (width, (*i)->m_name.size ());
 
  186       os << 
"Program Arguments:" << std::endl;
 
  187       for (Items::const_iterator i = 
m_items.begin (); i != 
m_items.end (); ++i)
 
  190                     << std::left << std::setw (width) << ( (*i)->m_name + 
":")
 
  194           if ( (*i)->HasDefault ())
 
  196               os << 
" [" << (*i)->GetDefault () << 
"]";
 
  204     << 
"General Arguments:\n" 
  205     << 
"    --PrintGlobals:              Print the list of globals.\n" 
  206     << 
"    --PrintGroups:               Print the list of groups.\n" 
  207     << 
"    --PrintGroup=[group]:        Print all TypeIds of group.\n" 
  208     << 
"    --PrintTypeIds:              Print all TypeIds.\n" 
  209     << 
"    --PrintAttributes=[typeid]:  Print all attributes of typeid.\n" 
  210     << 
"    --PrintHelp:                 Print this help message.\n" 
  219   os << 
"Global values:" << std::endl;
 
  222   std::vector<std::string> globals;
 
  228       std::stringstream ss;
 
  229       ss << 
"    --" << (*i)->GetName () << 
"=[";
 
  233       ss << v.
Get () << 
"]" << std::endl;
 
  234       ss << 
"        " << (*i)->GetHelp () << std::endl;
 
  235       globals.push_back (ss.str ());
 
  237   std::sort (globals.begin (), globals.end ());
 
  238   for (std::vector<std::string>::const_iterator it = globals.begin ();
 
  254       NS_FATAL_ERROR (
"Unknown type=" << type << 
" in --PrintAttributes");
 
  257   os << 
"Attributes for TypeId " << tid.
GetName () << std::endl;
 
  260   std::vector<std::string> attributes;
 
  264       std::stringstream ss;
 
  269       ss << 
"        " << info.
help << std::endl;
 
  270       attributes.push_back (ss.str ());
 
  272   std::sort (attributes.begin (), attributes.end ());
 
  273   for (std::vector<std::string>::const_iterator it = attributes.begin ();
 
  274        it < attributes.end ();
 
  287   os << 
"TypeIds in group " << group << 
":" << std::endl;
 
  290   std::vector<std::string> groupTypes;
 
  294       std::stringstream ss;
 
  298           ss << 
"    " <<tid.
GetName () << std::endl;
 
  300       groupTypes.push_back (ss.str ());
 
  302   std::sort (groupTypes.begin (), groupTypes.end ());
 
  303   for (std::vector<std::string>::const_iterator it = groupTypes.begin ();
 
  304        it < groupTypes.end ();
 
  315   os << 
"Registered TypeIds:" << std::endl;
 
  318   std::vector<std::string> types;
 
  322       std::stringstream ss;
 
  324       ss << 
"    " << tid.
GetName () << std::endl;
 
  325       types.push_back (ss.str ());
 
  327   std::sort (types.begin (), types.end ());
 
  328   for (std::vector<std::string>::const_iterator it = types.begin ();
 
  341   std::set<std::string> groups;
 
  348   os << 
"Registered TypeId groups:" << std::endl;
 
  350   for (std::set<std::string>::const_iterator k = groups.begin ();
 
  354       os << 
"    " << *k << std::endl;
 
  363   NS_LOG_DEBUG (
"Handle arg name=" << name << 
" value=" << value);
 
  364   if (name == 
"PrintHelp" || name == 
"help")
 
  370   else if (name == 
"PrintGroups")
 
  376   else if (name == 
"PrintTypeIds")
 
  382   else if (name == 
"PrintGlobals")
 
  388   else if (name == 
"PrintGroup")
 
  394   else if (name == 
"PrintAttributes")
 
  402       for (Items::const_iterator i = 
m_items.begin (); i != 
m_items.end (); ++i)
 
  404           if ((*i)->m_name == name)
 
  406               if (!(*i)->Parse (value))
 
  408                   std::cerr << 
"Invalid argument value: " 
  409                             << name << 
"=" << value << std::endl;
 
  422       std::cerr << 
"Invalid command-line arguments: --" 
  423                 << name << 
"=" << value << std::endl;
 
  433   NS_LOG_DEBUG (
"CommandLine::CallbackItem::Parse \"" << value << 
"\"");
 
  434   return m_callback (value);
 
  439                        const std::string &help,
 
  452                        const std::string &attributePath)
 
  456   size_t colon = attributePath.rfind (
"::");
 
  457   const std::string typeName = attributePath.substr (0, colon);
 
  458   NS_LOG_DEBUG (
"typeName: '" << typeName << 
"', colon: " << colon);
 
  466   const std::string attrName = attributePath.substr (colon + 2);
 
  473   std::stringstream ss;
 
  475      << 
" (" << attributePath << 
") [" 
  486                               const std::string value)
 
  514   std::ostringstream oss;
 
  515   oss << std::boolalpha << val;
 
  523   std::string src = value;
 
  524   std::transform(src.begin(), src.end(), src.begin(), ::tolower);
 
  526   if (src.length () == 0)
 
  531   else if ( (src == 
"true") || (src == 
"t") )
 
  536   else if ( (src == 
"false") || (src == 
"f"))
 
  543       std::istringstream iss;
 
  546       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. 
 
ns3::StringValue 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. 
 
ns3::SystemPath 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. 
 
ns3::CommandLine 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...