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"
57 << info.
help << std::endl;
60 if (info.
checker->HasUnderlyingTypeInformation ())
63 if ( (info.
checker->GetValueTypeName () !=
"ns3::EnumValue")
64 && (info.
checker->GetUnderlyingTypeInformation () !=
"std::string")
70 if (info.
checker->GetValueTypeName () ==
"ns3::PointerValue")
81 else if (info.
checker->GetValueTypeName () ==
"ns3::ObjectPtrContainerValue")
117 os <<
" " <<
listStop <<
" " << std::endl;
151 void RecordAggregationInfo (std::string a, std::string b);
161 void Print (
void)
const;
168 std::vector<std::string> Get (
TypeId tid);
174 std::string GetCurrentPath (
void)
const;
180 void DoGather (
TypeId tid);
186 void RecordOutput (
TypeId tid);
192 bool HasAlreadyBeenProcessed (
TypeId tid)
const;
200 void find_and_replace (std::string &source,
const std::string find, std::string replace );
204 std::vector<std::pair<TypeId,std::string> >
m_output;
228 for (std::vector<std::pair<TypeId,std::string> >::const_iterator i = m_output.begin (); i != m_output.end (); ++i)
230 std::pair<TypeId,std::string> item = *i;
231 std::cout << item.first.GetName () <<
" -> " << item.second << std::endl;
238 std::ostringstream oss;
239 for (std::vector<std::string>::const_iterator i = m_currentPath.begin (); i != m_currentPath.end (); ++i)
241 std::string item = *i;
250 m_output.push_back (std::make_pair (tid, GetCurrentPath ()));
256 for (uint32_t i = 0; i < m_alreadyProcessed.size (); ++i)
258 if (m_alreadyProcessed[i] == tid)
266 std::vector<std::string>
269 std::vector<std::string> paths;
270 for (uint32_t i = 0; i < m_output.size (); ++i)
272 std::pair<TypeId,std::string> tmp = m_output[i];
273 if (tmp.first == tid)
275 paths.push_back (tmp.second);
286 std::sort (m_output.begin (), m_output.end ());
287 m_output.erase (std::unique (m_output.begin (), m_output.end ()), m_output.end ());
294 if (HasAlreadyBeenProcessed (tid))
309 TypeId objectTypeId =
object->GetTypeId ();
310 if (objectTypeId == pointee)
319 m_currentPath.push_back (info.
name);
320 m_alreadyProcessed.push_back (tid);
322 m_alreadyProcessed.pop_back ();
323 m_currentPath.pop_back ();
328 if (vectorChecker != 0)
331 m_currentPath.push_back (info.
name +
"/[i]");
332 m_alreadyProcessed.push_back (tid);
334 m_alreadyProcessed.pop_back ();
335 m_currentPath.pop_back ();
347 find_and_replace(childName,
"::",replaceWith);
348 m_currentPath.push_back (childName);
349 m_alreadyProcessed.push_back (tid);
351 m_alreadyProcessed.pop_back ();
352 m_currentPath.pop_back ();
355 for (uint32_t k = 0; k < m_aggregates.size (); ++k)
357 std::pair<TypeId,TypeId> tmp = m_aggregates[k];
358 if (tmp.first == tid || tmp.second == tid)
361 if (tmp.first == tid)
365 if (tmp.second == tid)
383 find_and_replace(name,
"::",replaceWith);
384 m_currentPath.push_back (name);
385 m_alreadyProcessed.push_back (tid);
387 m_alreadyProcessed.pop_back ();
388 m_currentPath.pop_back ();
397 j = source.find (find);
398 while (j != std::string::npos )
400 source.replace (j, find.length (),replace);
401 j = source.find (find,j+1);
408 std::cout <<
"Usage: " << program_name <<
" [options]" << std::endl
410 <<
"Options:" << std::endl
411 <<
" --help : print these options" << std::endl
412 <<
" --output-text : format output as plain text" << std::endl;
415 int main (
int argc,
char *argv[])
417 bool outputText =
false;
418 char *programName = argv[0];
426 if (strcmp (arg,
"--help") == 0)
431 else if (strcmp(arg,
"--output-text") == 0)
453 commentStart =
"===============================================================\n";
526 csma = CreateObject<CsmaChannel> ();
534 std::map< std::string, uint32_t> nameMap;
535 std::map< std::string, uint32_t>::const_iterator nameMapIterator;
549 std::string name = tid.
GetName ();
550 for (uint32_t j = 0; j < name.length (); j++)
552 name[j] = toupper (name[j]);
561 for (nameMapIterator = nameMap.begin ();
562 nameMapIterator != nameMap.end ();
566 uint32_t i = nameMapIterator->second;
575 std::cout << std::endl;
576 std::vector<std::string> paths = info.
Get (tid);
581 std::cout <<
"Doxygen introspection did not find any typical Config paths."
589 std::cout << std::endl;
591 <<
" is accessible through the following paths"
592 <<
" with Config::Set and Config::Connect:"
595 for (uint32_t k = 0; k < paths.size (); ++k)
597 std::string path = paths[k];
607 std::cout <<
"No Attributes are defined for this type."
622 <<
"Attributes defined in parent class "
634 std::cout <<
"No TraceSources are defined for this type."
650 <<
"TraceSources defined in parent class "
728 (*i)->GetValue (val);
733 <<
"GlobalValue" << (*i)->GetName () <<
" " << (*i)->GetName ()
735 <<
": " << (*i)->GetHelp () <<
". Default value: " << val.
Get () <<
"."
void PrintAttributes(TypeId tid, std::ostream &os)
uint32_t GetAttributeN(void) const
void PrintTraceSources(TypeId tid, std::ostream &os)
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
std::string Get(void) const
std::string functionStop
end of a class/function
virtual TypeId GetInstanceTypeId(void) const
std::string headingStop
end of section heading (h3)
hold variables of type string
std::string headingStart
start of section heading (h3)
virtual TypeId GetPointeeTypeId(void) const =0
std::string flagSpanStart
start of Attribute flag value
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
TypeId GetParent(void) const
Vector::const_iterator Iterator
std::string boldStart
start of bold span
std::string commentStop
end of code comment
The attribute can be written at construction-time.
virtual TypeId GetItemTypeId(void) const =0
Ptr< Object > GetRootNamespaceObject(uint32_t i)
std::string listLineStart
start unordered list item
std::string breakTextOnly
linebreak for text output only
std::string pageGlobalValueList
start GlobalValue page
The attribute can be read.
bool MustHideFromDocumentation(void) const
std::string indentHtmlOnly
small indent
int main(int argc, char *argv[])
std::string brief
brief tag
static uint32_t GetRegisteredN(void)
void PrintHelp(const char *program_name)
static Iterator Begin(void)
T * PeekPointer(const Ptr< T > &p)
uint32_t GetTraceSourceN(void) const
static TypeId GetRegistered(uint32_t i)
std::string breakHtmlOnly
linebreak for html output only
std::string pageTraceSourceList
start Trace sources page
keep track of a set of node pointers.
The attribute can be written.
std::string listLineStop
end unordered list item
std::string reference
reference tag
std::string GetName(void) const
std::string listStart
start unordered list
std::string listStop
end unordered list
std::string temporaryCharacter
"%" placeholder
std::string anchor
hyperlink anchor
static Iterator End(void)
std::string pageAttributeList
start Attributes list
uint32_t GetRootNamespaceObjectN(void)
bool IsChildOf(TypeId other) const
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
struct TypeId::TraceSourceInformation GetTraceSource(uint32_t i) const
std::string functionStart
start of a class/function
struct TypeId::AttributeInformation GetAttribute(uint32_t i) const
std::string breakBoth
linebreak
std::string flagSpanStop
end of Attribute flag value
a unique identifier for an interface.
std::string boldStop
end of bold span
std::string commentStart
start of code comment
static TypeId LookupByName(std::string name)