5 #include "ns3/object.h"
6 #include "ns3/pointer.h"
7 #include "ns3/object-vector.h"
8 #include "ns3/config.h"
10 #include "ns3/global-value.h"
11 #include "ns3/string.h"
12 #include "ns3/node-container.h"
13 #include "ns3/csma-channel.h"
61 << info.
help << std::endl;
93 os <<
" " <<
listStop <<
" " << std::endl;
127 void RecordAggregationInfo (std::string a, std::string b);
137 void Print (
void)
const;
144 std::vector<std::string> Get (
TypeId tid);
150 std::string GetCurrentPath (
void)
const;
156 void DoGather (
TypeId tid);
162 void RecordOutput (
TypeId tid);
168 bool HasAlreadyBeenProcessed (
TypeId tid)
const;
176 void find_and_replace (std::string &source,
const std::string find, std::string replace );
180 std::vector<std::pair<TypeId,std::string> >
m_output;
204 for (std::vector<std::pair<TypeId,std::string> >::const_iterator i = m_output.begin (); i != m_output.end (); ++i)
206 std::pair<TypeId,std::string> item = *i;
207 std::cout << item.first.GetName () <<
" -> " << item.second << std::endl;
214 std::ostringstream oss;
215 for (std::vector<std::string>::const_iterator i = m_currentPath.begin (); i != m_currentPath.end (); ++i)
217 std::string item = *i;
226 m_output.push_back (std::make_pair (tid, GetCurrentPath ()));
232 for (uint32_t i = 0; i < m_alreadyProcessed.size (); ++i)
234 if (m_alreadyProcessed[i] == tid)
242 std::vector<std::string>
245 std::vector<std::string> paths;
246 for (uint32_t i = 0; i < m_output.size (); ++i)
248 std::pair<TypeId,std::string> tmp = m_output[i];
249 if (tmp.first == tid)
251 paths.push_back (tmp.second);
262 std::sort (m_output.begin (), m_output.end ());
263 m_output.erase (std::unique (m_output.begin (), m_output.end ()), m_output.end ());
270 if (HasAlreadyBeenProcessed (tid))
285 TypeId objectTypeId =
object->GetTypeId ();
286 if (objectTypeId == pointee)
295 m_currentPath.push_back (info.
name);
296 m_alreadyProcessed.push_back (tid);
298 m_alreadyProcessed.pop_back ();
299 m_currentPath.pop_back ();
304 if (vectorChecker != 0)
307 m_currentPath.push_back (info.
name +
"/[i]");
308 m_alreadyProcessed.push_back (tid);
310 m_alreadyProcessed.pop_back ();
311 m_currentPath.pop_back ();
323 find_and_replace(childName,
"::",replaceWith);
324 m_currentPath.push_back (childName);
325 m_alreadyProcessed.push_back (tid);
327 m_alreadyProcessed.pop_back ();
328 m_currentPath.pop_back ();
331 for (uint32_t k = 0; k < m_aggregates.size (); ++k)
333 std::pair<TypeId,TypeId> tmp = m_aggregates[k];
334 if (tmp.first == tid || tmp.second == tid)
337 if (tmp.first == tid)
341 if (tmp.second == tid)
359 find_and_replace(name,
"::",replaceWith);
360 m_currentPath.push_back (name);
361 m_alreadyProcessed.push_back (tid);
363 m_alreadyProcessed.pop_back ();
364 m_currentPath.pop_back ();
373 j = source.find (find);
374 while (j != std::string::npos )
376 source.replace (j, find.length (),replace);
377 j = source.find (find,j+1);
384 std::cout <<
"Usage: " << program_name <<
" [options]" << std::endl
386 <<
"Options:" << std::endl
387 <<
" --help : print these options" << std::endl
388 <<
" --output-text : format output as plain text" << std::endl;
391 int main (
int argc,
char *argv[])
393 bool outputText =
false;
394 char *programName = argv[0];
402 if (strcmp (arg,
"--help") == 0)
407 else if (strcmp(arg,
"--output-text") == 0)
429 commentStart =
"===============================================================\n";
510 csma = CreateObject<CsmaChannel> ();
518 std::map< std::string, uint32_t> nameMap;
519 std::map< std::string, uint32_t>::const_iterator nameMapIterator;
533 std::string name = tid.
GetName ();
534 for (uint32_t j = 0; j < name.length (); j++)
536 name[j] = toupper (name[j]);
545 for (nameMapIterator = nameMap.begin ();
546 nameMapIterator != nameMap.end ();
550 uint32_t i = nameMapIterator->second;
559 std::cout << std::endl;
560 std::vector<std::string> paths = info.
Get (tid);
565 std::cout <<
"Doxygen introspection did not find any typical Config paths."
573 std::cout << std::endl;
575 <<
" is accessible through the following paths"
576 <<
" with Config::Set and Config::Connect:"
579 for (uint32_t k = 0; k < paths.size (); ++k)
581 std::string path = paths[k];
591 std::cout <<
"No Attributes are defined for this type."
606 <<
"Attributes defined in parent class "
618 std::cout <<
"No TraceSources are defined for this type."
634 <<
"TraceSources defined in parent class "
708 (*i)->GetValue (val);
713 <<
"GlobalValue" << (*i)->GetName () <<
" " << (*i)->GetName ()
715 <<
": " << (*i)->GetHelp () <<
". Default value: " << val.
Get () <<
"."