32 #include "ns3/command-line.h" 33 #include "ns3/config.h" 34 #include "ns3/global-value.h" 36 #include "ns3/object-vector.h" 37 #include "ns3/object.h" 38 #include "ns3/pointer.h" 39 #include "ns3/string.h" 40 #include "ns3/node-container.h" 41 #include "ns3/simple-channel.h" 42 #include "ns3/system-path.h" 113 commentStart =
"===============================================================\n";
212 << info.
checker->GetValueTypeName ()
215 if (info.
checker->HasUnderlyingTypeInformation ())
219 <<
"Underlying type: ";
221 std::string valType = info.
checker->GetValueTypeName ();
222 std::string underType = info.
checker->GetUnderlyingTypeInformation ();
223 if ((valType !=
"ns3::EnumValue") && (underType !=
"std::string"))
226 bool handled =
false;
228 if (valType ==
"ns3::PointerValue")
240 else if (valType ==
"ns3::ObjectPtrContainerValue")
253 class StringBeginMatcher
256 StringBeginMatcher (
const std::string s)
258 bool operator () (
const std::string t)
260 std::size_t pos = m_string.find (t);
264 std::string m_string;
266 StringBeginMatcher match (underType);
268 if ( match (
"bool") || match (
"double") ||
269 match (
"int8_t") || match (
"uint8_t") ||
270 match (
"int16_t") || match (
"uint16_t") ||
271 match (
"int32_t") || match (
"uint32_t") ||
272 match (
"int64_t") || match (
"uint64_t")
333 os <<
"No Attributes are defined for this type." 353 <<
"Attributes defined in parent class " 385 <<
"%Callback signature: " 410 os <<
"No TraceSources are defined for this type." 429 <<
"TraceSources defined in parent class " 450 std::size_t arch = (
sizeof (
void *) * CHAR_BIT);
453 <<
" of this type is " << tid.
GetSize ()
454 <<
" bytes (on a " << arch <<
"-bit architecture)." 474 os <<
"This is a list of all" <<
reference <<
"attribute by class. " 475 <<
"For more information see the" <<
reference <<
"attribute " 476 <<
"section of this API documentation and the Attributes sections " 477 <<
"in the Tutorial and Manual.\n" 519 os <<
"This is a list of all" <<
reference <<
"ns3::GlobalValue instances.\n" 528 (*i)->GetValue (val);
533 <<
"GlobalValue" << (*i)->GetName () <<
" " << (*i)->GetName ()
535 <<
": " << (*i)->GetHelp ()
536 <<
". Default value: " << val.
Get () <<
"." 557 os <<
"This is a list of all" <<
reference <<
"ns3::LogComponent instances.\n" 566 LogComponent::ComponentList::const_iterator it;
567 for (it = logs->begin (); it != logs->end (); ++it)
569 std::string
file = it->second->File ();
572 while (
file.find (
"../") == 0)
598 os <<
"This is a list of all" <<
reference <<
"tracing sources. " 599 <<
"For more information see the " <<
reference <<
"tracing " 600 <<
"section of this API documentation and the Tracing sections " 601 <<
"in the Tutorial and Manual.\n" 652 const std::string & name,
653 const bool seeBase =
true)
656 std::string section =
"attribute_" + name;
662 << name <<
" Attribute\n" 663 <<
"Attribute implementation for " << name <<
"\n";
667 if (name !=
"IeMeshId")
669 os <<
seeAlso <<
"ns3::" << name <<
"\n";
673 os <<
seeAlso <<
"ns3::dot11s::" << name <<
"\n";
693 const std::string & name,
694 const std::string & type,
695 const std::string & header)
698 std::string sectAttr =
sectionStart +
"attribute_" + name;
702 std::string valClass = name +
"Value";
703 std::string qualClass =
" ns3::" + valClass;
706 os <<
classStart << qualClass <<
" \"" << header <<
"\"" << std::endl;
707 os <<
"AttributeValue implementation for " << name <<
"." << std::endl;
708 os <<
seeAlso <<
"AttributeValue" << std::endl;
714 << qualClass <<
"::" << valClass;
715 if ( (name ==
"EmptyAttribute") ||
716 (name ==
"ObjectPtrContainer") )
724 os <<
"(const " << type <<
" & value)\n" 725 <<
"Copy constructor.\n" 726 <<
argument <<
"[in] value The " << name <<
" value to copy.\n";
733 << qualClass <<
"::Get (void) const\n" 734 <<
returns <<
"The " << name <<
" value.\n" 740 << qualClass <<
"::GetAccessor (T & value) const\n" 741 <<
"Access the " << name <<
" value as type " <<
codeWord <<
"T.\n" 743 <<
argument <<
"[out] value The " << name <<
" value, as type " 749 if (type !=
"Callback")
753 << qualClass <<
"::Set (const " << type <<
" & value)\n" 754 <<
"Set the value.\n" 755 <<
argument <<
"[in] value The value to adopt.\n" 762 << qualClass <<
"::m_value\n" 763 <<
"The stored " << name <<
" instance.\n" 782 std::string sectAttr =
sectionStart +
"attribute_" + name +
"\n";
783 std::string make =
"ns3::Make" + name +
"Accessor ";
788 <<
functionStart <<
"ns3::Ptr<const ns3::AttributeAccessor> " 789 << make <<
"(T1 a1)\n" 790 <<
copyDoc <<
"ns3::MakeAccessorHelper(T1)\n" 791 <<
seeAlso <<
"AttributeAccessor\n" 797 <<
functionStart <<
"ns3::Ptr<const ns3::AttributeAccessor> " 798 << make <<
"(T1 a1, T2 a2)\n" 799 <<
copyDoc <<
"ns3::MakeAccessorHelper(T1,T2)\n" 800 <<
seeAlso <<
"AttributeAccessor\n" 816 const std::string & name,
817 const std::string & header)
820 std::string sectAttr =
sectionStart +
"attribute_" + name +
"\n";
821 std::string make =
"ns3::Make" + name +
"Checker ";
826 os <<
classStart <<
" ns3::" << name <<
"Checker" 827 <<
" \"" << header <<
"\"" << std::endl;
828 os <<
"AttributeChecker implementation for " << name <<
"Value." << std::endl;
829 os <<
seeAlso <<
"AttributeChecker" << std::endl;
836 << make <<
"(void)\n" 837 <<
returns <<
"The AttributeChecker.\n" 838 <<
seeAlso <<
"AttributeChecker\n" 886 {
"Address",
"Address",
true,
"address.h" },
887 {
"Box",
"Box",
true,
"box.h" },
888 {
"DataRate",
"DataRate",
true,
"data-rate.h" },
889 {
"DsssParameterSet",
891 true,
"dsss-parameter-set.h"},
892 {
"EdcaParameterSet",
894 true,
"edca-parameter-set.h"},
895 {
"ErpInformation",
"ErpInformation",
true,
"erp-information.h" },
896 {
"ExtendedCapabilities",
"ExtendedCapabilities",
true,
"extended-capabilities.h" },
897 {
"HeCapabilities",
"HeCapabilities",
true,
"he-capabilities.h" },
898 {
"VhtCapabilities",
"VhtCapabilities",
true,
"vht-capabilities.h" },
899 {
"HtCapabilities",
"HtCapabilities",
true,
"ht-capabilities.h" },
900 {
"IeMeshId",
"IeMeshId",
true,
"ie-dot11s-id.h" },
901 {
"Ipv4Address",
"Ipv4Address",
true,
"ipv4-address.h" },
902 {
"Ipv4Mask",
"Ipv4Mask",
true,
"ipv4-address.h" },
903 {
"Ipv6Address",
"Ipv6Address",
true,
"ipv6-address.h" },
904 {
"Ipv6Prefix",
"Ipv6Prefix",
true,
"ipv6-address.h" },
905 {
"Mac16Address",
"Mac16Address",
true,
"mac16-address.h" },
906 {
"Mac48Address",
"Mac48Address",
true,
"mac48-address.h" },
907 {
"Mac64Address",
"Mac64Address",
true,
"mac64-address.h" },
908 {
"ObjectFactory",
"ObjectFactory",
true,
"object-factory.h" },
909 {
"OrganizationIdentifier",
910 "OrganizationIdentifier",
911 true,
"vendor-specific-action.h" },
912 {
"Rectangle",
"Rectangle",
true,
"rectangle.h" },
913 {
"Ssid",
"Ssid",
true,
"ssid.h" },
914 {
"TypeId",
"TypeId",
true,
"type-id.h" },
915 {
"UanModesList",
"UanModesList",
true,
"uan-tx-mode.h" },
917 {
"Vector2D",
"Vector2D",
true,
"vector.h" },
918 {
"Vector3D",
"Vector3D",
true,
"vector.h" },
919 {
"HeOperation",
"HeOperation",
true,
"he-operation.h" },
920 {
"VhtOperation",
"VhtOperation",
true,
"vht-operation.h" },
921 {
"HtOperation",
"HtOperation",
true,
"ht-operation.h" },
922 {
"Waypoint",
"Waypoint",
true,
"waypoint.h" },
923 {
"WifiMode",
"WifiMode",
true,
"wifi-mode.h" },
926 {
"Boolean",
"Boolean",
false,
"boolean.h" },
927 {
"Callback",
"Callback",
true,
"callback.h" },
928 {
"Double",
"double",
false,
"double.h" },
929 {
"Enum",
"int",
false,
"enum.h" },
930 {
"Integer",
"int64_t",
false,
"integer.h" },
931 {
"Pointer",
"Pointer",
false,
"pointer.h" },
932 {
"RandomVariable",
"RandomVariable",
true,
"random-variable-stream.h" },
933 {
"String",
"std::string",
false,
"string.h" },
934 {
"Time",
"Time",
true,
"nstime.h" },
935 {
"Uinteger",
"uint64_t",
false,
"uinteger.h" },
936 {
"",
"",
false,
"last placeholder" }
940 while (attributes[i].m_name !=
"")
982 void RecordAggregationInfo (std::string a, std::string b);
992 void Print (
void)
const;
999 std::vector<std::string> Get (
TypeId tid)
const;
1004 std::vector<std::string> GetNoTypeIds (
void)
const;
1010 std::string GetCurrentPath (
void)
const;
1016 void DoGather (
TypeId tid);
1022 void RecordOutput (
TypeId tid);
1028 bool HasAlreadyBeenProcessed (
TypeId tid)
const;
1064 m_noTids.push_back (a);
1071 m_noTids.push_back (b);
1075 m_aggregates.push_back (std::make_pair (aTid, bTid));
1083 for (std::vector<std::pair<TypeId,std::string> >::const_iterator i = m_output.begin (); i != m_output.end (); ++i)
1085 std::pair<TypeId,std::string> item = *i;
1086 std::cout << item.first.GetName () <<
" -> " << item.second << std::endl;
1095 std::ostringstream oss;
1096 for (std::vector<std::string>::const_iterator i = m_currentPath.begin (); i != m_currentPath.end (); ++i)
1098 std::string item = *i;
1109 m_output.push_back (std::make_pair (tid, GetCurrentPath ()));
1117 for (uint32_t i = 0; i < m_alreadyProcessed.size (); ++i)
1119 if (m_alreadyProcessed[i] == tid)
1128 std::vector<std::string>
1132 std::vector<std::string> paths;
1133 for (uint32_t i = 0; i < m_output.size (); ++i)
1135 std::pair<TypeId,std::string> tmp = m_output[i];
1136 if (tmp.first == tid)
1138 paths.push_back (tmp.second);
1159 template <
typename T>
1163 std::sort (t.begin (), t.end ());
1164 t.erase (std::unique (t.begin (), t.end ()), t.end ());
1167 std::vector<std::string>
1189 if (HasAlreadyBeenProcessed (tid))
1198 if (ptrChecker != 0)
1204 TypeId objectTypeId =
object->GetTypeId ();
1205 if (objectTypeId == pointee)
1214 m_currentPath.push_back (info.
name);
1215 m_alreadyProcessed.push_back (tid);
1217 m_alreadyProcessed.pop_back ();
1218 m_currentPath.pop_back ();
1223 if (vectorChecker != 0)
1226 m_currentPath.push_back (info.
name +
"/[i]");
1227 m_alreadyProcessed.push_back (tid);
1229 m_alreadyProcessed.pop_back ();
1230 m_currentPath.pop_back ();
1239 std::string childName =
"$" + child.
GetName ();
1240 m_currentPath.push_back (childName);
1241 m_alreadyProcessed.push_back (tid);
1243 m_alreadyProcessed.pop_back ();
1244 m_currentPath.pop_back ();
1247 for (uint32_t k = 0; k < m_aggregates.size (); ++k)
1249 std::pair<TypeId,TypeId> tmp = m_aggregates[k];
1250 if (tmp.first == tid || tmp.second == tid)
1253 if (tmp.first == tid)
1257 if (tmp.second == tid)
1261 std::string name =
"$" + other.
GetName ();
1262 m_currentPath.push_back (name);
1263 m_alreadyProcessed.push_back (tid);
1265 m_alreadyProcessed.pop_back ();
1266 m_currentPath.pop_back ();
1311 simpleChannel = CreateObject<SimpleChannel> ();
1353 std::string name = tid.
GetName ();
1354 for (uint32_t j = 0; j < name.length (); j++)
1356 name[j] = toupper (name[j]);
1364 std::vector<std::string> noTids = info.
GetNoTypeIds ();
1365 for (std::vector<std::string>::const_iterator i = noTids.begin ();
1387 std::vector<std::string> paths = info.
Get (tid);
1392 os <<
"Introspection did not find any typical Config paths." 1404 <<
" is accessible through the following paths" 1405 <<
" with Config::Set and Config::Connect:" 1408 for (uint32_t k = 0; k < paths.size (); ++k)
1410 std::string path = paths[k];
1412 <<
"\"" << path <<
"\"" 1426 int main (
int argc,
char *argv[])
1429 bool outputText =
false;
1432 cmd.Usage (
"Generate documentation for all ns-3 registered types, " 1433 "trace sources, attributes and global variables.");
1434 cmd.AddValue (
"output-text",
"format output as plain text", outputText);
1435 cmd.Parse (argc, argv);
1447 std::cout <<
"/* -*- Mode:C++; c-file-style:\"gnu\"; " 1448 "indent-tabs-mode:nil; -*- */\n" 1450 std::cout <<
"#include \"ns3/log.h\"" 1455 std::cout << std::endl;
1459 <<
"Doxygen docs generated from the TypeId database.\n" 1460 <<
note <<
"This file is automatically generated by " 1461 <<
codeWord <<
"print-introspected-doxygen.cc. Do not edit this file! " 1462 <<
"Edit that file instead.\n" 1474 nameMapIterator != nameMap.end ();
1478 std::string name = nameMapIterator->first;
1479 int32_t i = nameMapIterator->second;
1494 std::cout <<
classStart << name << std::endl;
1495 std::cout << std::endl;
1506 std::cout <<
"Introspection could not find Config paths for " << name
1507 <<
" in this build because the parent module" 1508 <<
" was not included in the waf configuration." bool IsChildOf(TypeId other) const
Check if this TypeId is a child of another.
std::string classStart
start of a class
std::string GetName(void) const
Get the name.
NameMap GetNameMap(const StaticInformation &info)
Create a map from the class names to their index in the vector of TypeId's so that the names will end...
void PrintAllTraceSources(std::ostream &os)
Print the list of all Trace sources.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
std::string functionStop
end of a method/function
const std::string m_header
The header file name.
std::string headingStop
end of section heading (h3)
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
Hold variables of type string.
std::string note
start a note section
void PrintAttributes(std::ostream &os, const TypeId tid)
Print the Attributes block for tid, including Attributes declared in base classes.
void Uniquefy(T t)
Helper to keep only the unique items in a container.
std::string templArgDeduced
template argument deduced from function
void PrintConfigPaths(std::ostream &os, const StaticInformation &info, const TypeId tid)
Print config paths.
std::string argument
function argument
std::string headingStart
start of section heading (h3)
U * PeekPointer(const Ptr< U > &p)
const std::string m_type
The name of the underlying type.
virtual TypeId GetPointeeTypeId(void) const =0
Get the TypeId of the base type.
std::string flagSpanStart
start of Attribute flag value
#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.
std::string boldStart
start of bold span
static TypeId GetRegistered(uint16_t i)
Get a TypeId by index.
std::string templArgExplicit
template argument required
std::string commentStop
end of code comment
void PrintAllAttributes(std::ostream &os)
Print the list of all Attributes.
static bool LookupByNameFailSafe(std::string name, TypeId *tid)
Get a TypeId by name.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
The attribute can be written at construction-time.
void PrintAllLogComponents(std::ostream &os)
Print the list of all LogComponents.
void SetMarkup(bool outputText)
Initialize the markup strings, for either doxygen or text.
virtual TypeId GetItemTypeId(void) const =0
Get the TypeId of the container class type.
void PrintTraceSources(std::ostream &os, const TypeId tid)
Print the Trace sources block for tid, including Trace sources declared in base classes.
std::size_t GetTraceSourceN(void) const
Get the number of Trace sources.
std::string listLineStart
start unordered list item
TypeId GetParent(void) const
Get the parent of this TypeId.
std::string breakTextOnly
linebreak for text output only
void PrintAttributeValueSection(std::ostream &os, const std::string &name, const bool seeBase=true)
Print the section definition for an AttributeValue.
The attribute can be read.
std::map< std::string, int32_t > NameMap
Map from TypeId name to tid.
std::string indentHtmlOnly
small indent
std::string templateArgument
template argument
std::string Get(void) const
void PrintAttributeHelper(std::ostream &os, const AttributeDescriptor &attr)
Print documentation corresponding to use of the ATTRIBUTE_HELPER_HEADER macro or ATTRIBUTE_VALUE_DEFI...
std::string brief
brief tag
const std::string m_name
The base name of the resulting AttributeValue type.
static Iterator Begin(void)
The Begin iterator.
std::string subSectionStart
start a new subsection
std::string variable
variable or class member
std::string sectionStart
start of a section or group
Ptr< Object > GetRootNamespaceObject(uint32_t i)
AttributeChecker implementation for ObjectPtrContainerValue.
NameMap::const_iterator NameMapIterator
NameMap iterator.
void PrintSize(std::ostream &os, const TypeId tid)
Print the size of the type represented by this tid.
bool MustHideFromDocumentation(void) const
Check if this TypeId should not be listed in documentation.
struct TypeId::TraceSourceInformation GetTraceSource(std::size_t i) const
Get the trace source by index.
Parse command-line arguments.
std::string returns
the return value
std::string breakHtmlOnly
linebreak for html output only
std::map< std::string, LogComponent * > ComponentList
LogComponent name map.
std::string codeWord
format next word as source code
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
std::size_t GetSize(void) const
Get the size of this object.
std::size_t GetRootNamespaceObjectN(void)
The attribute can be written.
std::string listLineStop
end unordered list item
static ComponentList * GetComponentList(void)
Get the list of LogComponnents.
std::string reference
reference tag
const bool m_seeBase
Print a "see also" pointing to the base class.
std::string listStart
start unordered list
std::string listStop
end unordered list
void PrintMakeChecker(std::ostream &os, const std::string &name, const std::string &header)
Print the AttributeValue MakeChecker documentation for a class.
std::string classStop
end of a class
StaticInformation GetTypicalAggregations()
Register aggregation relationships that are not automatically detected by this introspection program...
AttributeChecker implementation for PointerValue.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
void PrintAttributeValueWithName(std::ostream &os, const std::string &name, const std::string &type, const std::string &header)
Print the AttributeValue documentation for a class.
Descriptor for an AttributeValue.
std::string anchor
hyperlink anchor
void PrintMakeAccessors(std::ostream &os, const std::string &name)
Print the AttributeValue MakeAccessor documentation for a class.
std::size_t GetAttributeN(void) const
Get the number of attributes.
static Iterator End(void)
The End iterator.
void Print(ComponentCarrier cc)
struct TypeId::AttributeInformation GetAttribute(std::size_t i) const
Get Attribute information by index.
std::string copyDoc
copy (or refer) to docs elsewhere
std::string page
start a separate page
std::string seeAlso
Reference to other docs.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void PrintAttributeImplementations(std::ostream &os)
Print documentation for Attribute implementations.
std::string functionStart
start of a method/function
static uint16_t GetRegisteredN(void)
Get the number of registered TypeIds.
std::string breakBoth
linebreak
void PrintAttributesTid(std::ostream &os, const TypeId tid)
Print direct Attributes for this TypeId.
std::string flagSpanStop
end of Attribute flag value
a unique identifier for an interface.
std::string boldStop
end of bold span
void PrintAllGlobals(std::ostream &os)
Print the list of all global variables.
void PrintTraceSourcesTid(std::ostream &os, const TypeId tid)
Print direct Trace sources for this TypeId.
std::string commentStart
start of code comment