author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Thu, 30 Aug 2007 13:58:15 +0200 | |
changeset 1399 | 5945e92014e2 |
parent 599 | 7b7012218291 |
child 1533 | 1e8249c58fda |
permissions | -rw-r--r-- |
439
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
599
7b7012218291
add license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
439
diff
changeset
|
2 |
/* |
7b7012218291
add license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
439
diff
changeset
|
3 |
* Copyright (c) 2007 Georgia Tech University, INRIA |
7b7012218291
add license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
439
diff
changeset
|
4 |
* |
7b7012218291
add license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
439
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
7b7012218291
add license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
439
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
7b7012218291
add license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
439
diff
changeset
|
7 |
* published by the Free Software Foundation; |
7b7012218291
add license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
439
diff
changeset
|
8 |
* |
7b7012218291
add license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
439
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
7b7012218291
add license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
439
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
7b7012218291
add license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
439
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7b7012218291
add license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
439
diff
changeset
|
12 |
* GNU General Public License for more details. |
7b7012218291
add license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
439
diff
changeset
|
13 |
* |
7b7012218291
add license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
439
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
7b7012218291
add license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
439
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
7b7012218291
add license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
439
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
7b7012218291
add license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
439
diff
changeset
|
17 |
* |
7b7012218291
add license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
439
diff
changeset
|
18 |
* Authors: Raj Bhattacharjea <raj.b@gatech.edu>, |
7b7012218291
add license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
439
diff
changeset
|
19 |
* Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
7b7012218291
add license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
439
diff
changeset
|
20 |
*/ |
439
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
21 |
|
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
22 |
#include "command-line.h" |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
23 |
#include <unistd.h> |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
24 |
|
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
25 |
namespace ns3 { |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
26 |
|
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
27 |
CommandDefaultValue CommandLine::g_help ("help", |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
28 |
"Print Help text for all commands", |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
29 |
MakeCallback (&CommandLine::PrintHelp)); |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
30 |
|
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
31 |
void |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
32 |
CommandLine::AddArgCommand (const std::string &name, |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
33 |
const std::string &help, |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
34 |
Callback<void> cb) |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
35 |
{ |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
36 |
DefaultValueBase *base = |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
37 |
new CommandDefaultValue (name, help, cb); |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
38 |
GetUserList ()->push_back (base); |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
39 |
} |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
40 |
|
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
41 |
CommandLine::List * |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
42 |
CommandLine::GetUserList (void) |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
43 |
{ |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
44 |
static List list; |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
45 |
return &list; |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
46 |
} |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
47 |
|
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
48 |
void |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
49 |
CommandLine::PrintHelp (void) |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
50 |
{ |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
51 |
for (List::iterator i = GetUserList ()->begin (); |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
52 |
i != GetUserList ()->end (); i++) |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
53 |
{ |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
54 |
DefaultValueBase *item = *i; |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
55 |
if (item->GetType () == "" && |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
56 |
item->GetDefaultValue () == "") |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
57 |
{ |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
58 |
std::cout << "--" << item->GetName () << "\t" << item->GetHelp () << std::endl; |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
59 |
} |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
60 |
else |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
61 |
{ |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
62 |
std::cout << "--" << item->GetName () << "=[" << item->GetType () << ":" |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
63 |
<< item->GetDefaultValue () << "]\t" << item->GetHelp () << std::endl; |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
64 |
} |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
65 |
} |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
66 |
for (List::iterator i = DefaultValueList::Begin (); |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
67 |
i != DefaultValueList::End (); i++) |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
68 |
{ |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
69 |
DefaultValueBase *item = *i; |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
70 |
if (item->GetType () == "" && |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
71 |
item->GetDefaultValue () == "") |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
72 |
{ |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
73 |
std::cout << "--" << item->GetName () << "\t" << item->GetHelp () << std::endl; |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
74 |
} |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
75 |
else |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
76 |
{ |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
77 |
std::cout << "--" << item->GetName () << "=[" << item->GetType () << ":" |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
78 |
<< item->GetDefaultValue () << "]\t" << item->GetHelp () << std::endl; |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
79 |
} |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
80 |
} |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
81 |
// XXX on win32, do the right thing here. |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
82 |
exit (0); |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
83 |
} |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
84 |
|
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
85 |
void |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
86 |
CommandLine::Parse (int argc, char *argv[]) |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
87 |
{ |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
88 |
argc--; |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
89 |
argv++; |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
90 |
while (argc > 0) |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
91 |
{ |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
92 |
// remove "--" or "-" heading. |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
93 |
std::string param = *argv; |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
94 |
std::string::size_type cur = param.find ("--"); |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
95 |
if (cur == std::string::npos) |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
96 |
{ |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
97 |
cur = param.find ("-"); |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
98 |
if (cur == std::string::npos) |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
99 |
{ |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
100 |
// invalid argument. ignore it. |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
101 |
continue; |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
102 |
} |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
103 |
} |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
104 |
if (cur != 0) |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
105 |
{ |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
106 |
// invalid argument. ignore it. |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
107 |
continue; |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
108 |
} |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
109 |
param = std::string (param, 2, param.size ()); |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
110 |
cur = param.find ("="); |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
111 |
std::string name, value; |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
112 |
if (cur == std::string::npos) |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
113 |
{ |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
114 |
name = param; |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
115 |
value = ""; |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
116 |
} |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
117 |
else |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
118 |
{ |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
119 |
name = std::string (param, 0, cur); |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
120 |
value = std::string (param, cur + 1, std::string::npos); |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
121 |
} |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
122 |
// try to find this argument in the user args. |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
123 |
for (List::iterator i = GetUserList ()->begin (); |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
124 |
i != GetUserList ()->end (); i++) |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
125 |
{ |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
126 |
DefaultValueBase *item = *i; |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
127 |
if (item->GetName () == name) |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
128 |
{ |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
129 |
item->ParseValue (value); |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
130 |
continue; |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
131 |
} |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
132 |
} |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
133 |
|
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
134 |
// try to find this argument in the default args. |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
135 |
for (List::iterator i = DefaultValueList::Begin (); |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
136 |
i != DefaultValueList::End (); i++) |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
137 |
{ |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
138 |
DefaultValueBase *item = *i; |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
139 |
if (item->GetName () == name) |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
140 |
{ |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
141 |
item->ParseValue (value); |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
142 |
continue; |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
143 |
} |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
144 |
} |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
145 |
argc--; |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
146 |
argv++; |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
147 |
} |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
148 |
} |
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
149 |
|
fed13fb45eef
Incorporated defaults and command-line arguments
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
150 |
}//namespace ns3 |