4 #include "ns3/object.h"
5 #include "ns3/pointer.h"
6 #include "ns3/object-vector.h"
7 #include "ns3/config.h"
9 #include "ns3/global-value.h"
10 #include "ns3/string.h"
11 #include "ns3/node-container.h"
12 #include "ns3/csma-channel.h"
60 << info.
help << std::endl;
92 os <<
" " <<
listStop <<
" " << std::endl;
126 void RecordAggregationInfo (std::string a, std::string b);
136 void Print (
void)
const;
143 std::vector<std::string> Get (
TypeId tid);
149 std::string GetCurrentPath (
void)
const;
155 void DoGather (
TypeId tid);
161 void RecordOutput (
TypeId tid);
167 bool HasAlreadyBeenProcessed (
TypeId tid)
const;
175 void find_and_replace (std::string &source,
const std::string find, std::string replace );
179 std::vector<std::pair<TypeId,std::string> >
m_output;
203 for (std::vector<std::pair<TypeId,std::string> >::const_iterator i = m_output.begin (); i != m_output.end (); ++i)
205 std::pair<TypeId,std::string> item = *i;
206 std::cout << item.first.GetName () <<
" -> " << item.second << std::endl;
213 std::ostringstream oss;
214 for (std::vector<std::string>::const_iterator i = m_currentPath.begin (); i != m_currentPath.end (); ++i)
216 std::string item = *i;
225 m_output.push_back (std::make_pair (tid, GetCurrentPath ()));
231 for (uint32_t i = 0; i < m_alreadyProcessed.size (); ++i)
233 if (m_alreadyProcessed[i] == tid)
241 std::vector<std::string>
244 std::vector<std::string> paths;
245 for (uint32_t i = 0; i < m_output.size (); ++i)
247 std::pair<TypeId,std::string> tmp = m_output[i];
248 if (tmp.first == tid)
250 paths.push_back (tmp.second);
261 std::sort (m_output.begin (), m_output.end ());
262 m_output.erase (std::unique (m_output.begin (), m_output.end ()), m_output.end ());
269 if (HasAlreadyBeenProcessed (tid))
284 TypeId objectTypeId =
object->GetTypeId ();
285 if (objectTypeId == pointee)
294 m_currentPath.push_back (info.
name);
295 m_alreadyProcessed.push_back (tid);
297 m_alreadyProcessed.pop_back ();
298 m_currentPath.pop_back ();
303 if (vectorChecker != 0)
306 m_currentPath.push_back (info.
name +
"/[i]");
307 m_alreadyProcessed.push_back (tid);
309 m_alreadyProcessed.pop_back ();
310 m_currentPath.pop_back ();
322 find_and_replace(childName,
"::",replaceWith);
323 m_currentPath.push_back (childName);
324 m_alreadyProcessed.push_back (tid);
326 m_alreadyProcessed.pop_back ();
327 m_currentPath.pop_back ();
330 for (uint32_t k = 0; k < m_aggregates.size (); ++k)
332 std::pair<TypeId,TypeId> tmp = m_aggregates[k];
333 if (tmp.first == tid || tmp.second == tid)
336 if (tmp.first == tid)
340 if (tmp.second == tid)
358 find_and_replace(name,
"::",replaceWith);
359 m_currentPath.push_back (name);
360 m_alreadyProcessed.push_back (tid);
362 m_alreadyProcessed.pop_back ();
363 m_currentPath.pop_back ();
372 j = source.find (find);
373 while (j != std::string::npos )
375 source.replace (j, find.length (),replace);
376 j = source.find (find,j+1);
383 std::cout <<
"Usage: " << program_name <<
" [options]" << std::endl
385 <<
"Options:" << std::endl
386 <<
" --help : print these options" << std::endl
387 <<
" --output-text : format output as plain text" << std::endl;
390 int main (
int argc,
char *argv[])
392 bool outputText =
false;
393 char *programName = argv[0];
401 if (strcmp (arg,
"--help") == 0)
406 else if (strcmp(arg,
"--output-text") == 0)
428 commentStart =
"===============================================================\n";
509 csma = CreateObject<CsmaChannel> ();
517 std::map< std::string, uint32_t> nameMap;
518 std::map< std::string, uint32_t>::const_iterator nameMapIterator;
532 std::string name = tid.
GetName ();
533 for (uint32_t j = 0; j < name.length (); j++)
535 name[j] = toupper (name[j]);
544 for (nameMapIterator = nameMap.begin ();
545 nameMapIterator != nameMap.end ();
549 uint32_t i = nameMapIterator->second;
558 std::cout << std::endl;
559 std::vector<std::string> paths = info.
Get (tid);
564 std::cout <<
"Doxygen introspection did not find any typical Config paths."
572 std::cout << std::endl;
574 <<
" is accessible through the following paths"
575 <<
" with Config::Set and Config::Connect:"
578 for (uint32_t k = 0; k < paths.size (); ++k)
580 std::string path = paths[k];
590 std::cout <<
"No Attributes are defined for this type."
605 <<
"Attributes defined in parent class "
617 std::cout <<
"No TraceSources are defined for this type."
633 <<
"TraceSources defined in parent class "
707 (*i)->GetValue (val);
712 <<
"GlobalValue" << (*i)->GetName () <<
" " << (*i)->GetName ()
714 <<
": " << (*i)->GetHelp () <<
"(" << val.
Get () <<
")"