26 #include "ns3/command-line.h"
27 #include "ns3/config.h"
28 #include "ns3/global-value.h"
30 #include "ns3/object-vector.h"
31 #include "ns3/object.h"
32 #include "ns3/pointer.h"
33 #include "ns3/string.h"
34 #include "ns3/node-container.h"
35 #include "ns3/simple-channel.h"
101 commentStart =
"===============================================================\n";
190 << info.
checker->GetValueTypeName ()
193 if (info.
checker->HasUnderlyingTypeInformation ())
197 <<
"Underlying type: ";
199 std::string valType = info.
checker->GetValueTypeName ();
200 std::string underType = info.
checker->GetUnderlyingTypeInformation ();
201 if ((valType !=
"ns3::EnumValue") && (underType !=
"std::string"))
204 bool handled =
false;
206 if (valType ==
"ns3::PointerValue")
218 else if (valType ==
"ns3::ObjectPtrContainerValue")
231 class StringBeginMatcher
234 StringBeginMatcher (
const std::string
s)
236 bool operator () (
const std::string t)
238 std::size_t pos = m_string.find (t);
242 std::string m_string;
244 StringBeginMatcher match (underType);
246 if ( match (
"bool") || match (
"double") ||
247 match (
"int8_t") || match (
"uint8_t") ||
248 match (
"int16_t") || match (
"uint16_t") ||
249 match (
"int32_t") || match (
"uint32_t") ||
250 match (
"int64_t") || match (
"uint64_t")
311 os <<
"No Attributes are defined for this type."
331 <<
"Attributes defined in parent class "
363 <<
"%Callback signature: "
388 os <<
"No TraceSources are defined for this type."
407 <<
"TraceSources defined in parent class "
428 std::size_t arch = (
sizeof (
void *) * CHAR_BIT);
431 <<
" of this type is " << tid.
GetSize ()
432 <<
" bytes (on a " << arch <<
"-bit architecture)."
452 os <<
"This is a list of all" <<
reference <<
"attribute by class. "
453 <<
"For more information see the" <<
reference <<
"attribute "
454 <<
"section of this API documentation and the Attributes sections "
455 <<
"in the Tutorial and Manual.\n"
497 os <<
"This is a list of all" <<
reference <<
"ns3::GlobalValue instances.\n"
506 (*i)->GetValue (val);
511 <<
"GlobalValue" << (*i)->GetName () <<
" " << (*i)->GetName ()
513 <<
": " << (*i)->GetHelp ()
514 <<
". Default value: " << val.
Get () <<
"."
535 os <<
"This is a list of all" <<
reference <<
"ns3::LogComponent instances.\n"
544 LogComponent::ComponentList::const_iterator it;
545 for (it = logs->begin (); it != logs->end (); ++it)
547 std::string file = it->second->File ();
550 while (file.find (
"../") == 0)
552 file = file.substr (3);
576 os <<
"This is a list of all" <<
reference <<
"tracing sources. "
577 <<
"For more information see the " <<
reference <<
"tracing "
578 <<
"section of this API documentation and the Tracing sections "
579 <<
"in the Tutorial and Manual.\n"
630 const std::string & name,
631 const bool seeBase =
true)
634 std::string section =
"attribute_" + name;
640 << name <<
" Attribute\n"
641 <<
"Attribute implementation for " << name <<
"\n";
645 if (name !=
"IeMeshId")
647 os <<
seeAlso <<
"ns3::" << name <<
"\n";
651 os <<
seeAlso <<
"ns3::dot11s::" << name <<
"\n";
671 const std::string & name,
672 const std::string & type,
673 const std::string & header)
676 std::string sectAttr =
sectionStart +
"attribute_" + name;
680 std::string valClass = name +
"Value";
681 std::string qualClass =
" ns3::" + valClass;
684 os <<
classStart << qualClass <<
" \"" << header <<
"\"" << std::endl;
685 os <<
"AttributeValue implementation for " << name <<
"." << std::endl;
686 os <<
seeAlso <<
"AttributeValue" << std::endl;
692 << qualClass <<
"::" << valClass;
693 if ( (name ==
"EmptyAttribute") ||
694 (name ==
"ObjectPtrContainer") )
702 os <<
"(const " << type <<
" & value)\n"
703 <<
"Copy constructor.\n"
704 <<
argument <<
"[in] value The " << name <<
" value to copy.\n";
711 << qualClass <<
"::Get (void) const\n"
712 <<
returns <<
"The " << name <<
" value.\n"
718 << qualClass <<
"::GetAccessor (T & value) const\n"
719 <<
"Access the " << name <<
" value as type " <<
codeWord <<
"T.\n"
720 <<
argument <<
"[out] value The " << name <<
" value, as type "
726 if (type !=
"Callback")
730 << qualClass <<
"::Set (const " << type <<
" & value)\n"
731 <<
"Set the value.\n"
732 <<
argument <<
"[in] value The value to adopt.\n"
739 << qualClass <<
"::m_value\n"
740 <<
"The stored " << name <<
" instance.\n"
759 std::string sectAttr =
sectionStart +
"attribute_" + name +
"\n";
760 std::string make =
"ns3::Make" + name +
"Accessor ";
765 <<
functionStart <<
"ns3::Ptr<const ns3::AttributeAccessor> "
766 << make <<
"(T1 a1)\n"
767 <<
copyDoc <<
"ns3::MakeAccessorHelper(T1)\n"
768 <<
seeAlso <<
"AttributeAccessor\n"
774 <<
functionStart <<
"ns3::Ptr<const ns3::AttributeAccessor> "
775 << make <<
"(T1 a1, T2 a2)\n"
776 <<
copyDoc <<
"ns3::MakeAccessorHelper(T1,T2)\n"
777 <<
seeAlso <<
"AttributeAccessor\n"
793 const std::string & name,
794 const std::string & header)
797 std::string sectAttr =
sectionStart +
"attribute_" + name +
"\n";
798 std::string make =
"ns3::Make" + name +
"Checker ";
803 os <<
classStart <<
" ns3::" << name <<
"Checker"
804 <<
" \"" << header <<
"\"" << std::endl;
805 os <<
"AttributeChecker implementation for " << name <<
"Value." << std::endl;
806 os <<
seeAlso <<
"AttributeChecker" << std::endl;
813 << make <<
"(void)\n"
814 <<
returns <<
"The AttributeChecker.\n"
815 <<
seeAlso <<
"AttributeChecker\n"
862 {
"Address",
"Address",
true,
"address.h" },
863 {
"Box",
"Box",
true,
"box.h" },
864 {
"DataRate",
"DataRate",
true,
"data-rate.h" },
865 {
"HtCapabilities",
"HtCapabilities",
true,
"ht-capabilities.h" },
866 {
"IeMeshId",
"IeMeshId",
true,
"id-dot11s-id.h" },
867 {
"Ipv4Address",
"Ipv4Address",
true,
"ipv4-address.h" },
868 {
"Ipv4Mask",
"Ipv4Mask",
true,
"ipv4-address.h" },
869 {
"Ipv6Address",
"Ipv6Address",
true,
"ipv6-address.h" },
870 {
"Ipv6Prefix",
"Ipv6Prefix",
true,
"ipv6-address.h" },
871 {
"Mac16Address",
"Mac16Address",
true,
"mac16-address.h" },
872 {
"Mac48Address",
"Mac48Address",
true,
"mac48-address.h" },
873 {
"Mac64Address",
"Mac64Address",
true,
"mac64-address.h" },
874 {
"ObjectFactory",
"ObjectFactory",
true,
"object-factory.h" },
875 {
"OrganizationIdentifier",
876 "OrganizationIdentifier",
877 true,
"vendor-specific-action.h" },
878 {
"Rectangle",
"Rectangle",
true,
"rectangle.h" },
879 {
"Ssid",
"Ssid",
true,
"ssid.h" },
880 {
"TypeId",
"TypeId",
true,
"type-id.h" },
881 {
"UanModesList",
"UanModesList",
true,
"uan-tx-mode.h" },
882 {
"ValueClassTest",
"ValueClassTest",
false,
"" },
883 {
"Vector2D",
"Vector2D",
true,
"vector.h" },
884 {
"Vector3D",
"Vector3D",
true,
"vector.h" },
885 {
"Waypoint",
"Waypoint",
true,
"waypoint.h" },
886 {
"WifiMode",
"WifiMode",
true,
"wifi-mode.h" },
889 {
"Boolean",
"Boolean",
false,
"boolean.h" },
890 {
"Callback",
"Callback",
true,
"callback.h" },
891 {
"Double",
"double",
false,
"double.h" },
892 {
"Enum",
"int",
false,
"enum.h" },
893 {
"Integer",
"int64_t",
false,
"integer.h" },
894 {
"Pointer",
"Pointer",
false,
"pointer.h" },
895 {
"RandomVariable",
"RandomVariable",
true,
"random-variable.h" },
896 {
"String",
"std::string",
false,
"string.h" },
897 {
"Time",
"Time",
true,
"nstime.h" },
898 {
"Uinteger",
"uint64_t",
false,
"uinteger.h" },
899 {
"",
"",
false,
"last placeholder" }
903 while (attributes[i].m_name !=
"")
945 void RecordAggregationInfo (std::string a, std::string b);
955 void Print (
void)
const;
962 std::vector<std::string> Get (
TypeId tid)
const;
967 std::vector<std::string> GetNoTypeIds (
void)
const;
973 std::string GetCurrentPath (
void)
const;
979 void DoGather (
TypeId tid);
985 void RecordOutput (
TypeId tid);
991 bool HasAlreadyBeenProcessed (
TypeId tid)
const;
995 std::vector<std::pair<TypeId,std::string> >
m_output;
1027 m_noTids.push_back (a);
1034 m_noTids.push_back (b);
1038 m_aggregates.push_back (std::make_pair (aTid, bTid));
1046 for (std::vector<std::pair<TypeId,std::string> >::const_iterator i = m_output.begin (); i != m_output.end (); ++i)
1048 std::pair<TypeId,std::string> item = *i;
1049 std::cout << item.first.GetName () <<
" -> " << item.second << std::endl;
1058 std::ostringstream oss;
1059 for (std::vector<std::string>::const_iterator i = m_currentPath.begin (); i != m_currentPath.end (); ++i)
1061 std::string item = *i;
1072 m_output.push_back (std::make_pair (tid, GetCurrentPath ()));
1080 for (uint32_t i = 0; i < m_alreadyProcessed.size (); ++i)
1082 if (m_alreadyProcessed[i] == tid)
1091 std::vector<std::string>
1095 std::vector<std::string> paths;
1096 for (uint32_t i = 0; i < m_output.size (); ++i)
1098 std::pair<TypeId,std::string> tmp = m_output[i];
1099 if (tmp.first == tid)
1101 paths.push_back (tmp.second);
1122 template <
typename T>
1126 std::sort (t.begin (), t.end ());
1127 t.erase (std::unique (t.begin (), t.end ()), t.end ());
1130 std::vector<std::string>
1152 if (HasAlreadyBeenProcessed (tid))
1161 if (ptrChecker != 0)
1167 TypeId objectTypeId =
object->GetTypeId ();
1168 if (objectTypeId == pointee)
1177 m_currentPath.push_back (info.
name);
1178 m_alreadyProcessed.push_back (tid);
1180 m_alreadyProcessed.pop_back ();
1181 m_currentPath.pop_back ();
1186 if (vectorChecker != 0)
1189 m_currentPath.push_back (info.
name +
"/[i]");
1190 m_alreadyProcessed.push_back (tid);
1192 m_alreadyProcessed.pop_back ();
1193 m_currentPath.pop_back ();
1202 std::string childName =
"$" + child.
GetName ();
1203 m_currentPath.push_back (childName);
1204 m_alreadyProcessed.push_back (tid);
1206 m_alreadyProcessed.pop_back ();
1207 m_currentPath.pop_back ();
1210 for (uint32_t k = 0; k < m_aggregates.size (); ++k)
1212 std::pair<TypeId,TypeId> tmp = m_aggregates[k];
1213 if (tmp.first == tid || tmp.second == tid)
1216 if (tmp.first == tid)
1220 if (tmp.second == tid)
1224 std::string name =
"$" + other.
GetName ();
1225 m_currentPath.push_back (name);
1226 m_alreadyProcessed.push_back (tid);
1228 m_alreadyProcessed.pop_back ();
1229 m_currentPath.pop_back ();
1272 simpleChannel = CreateObject<SimpleChannel> ();
1309 std::string name = tid.
GetName ();
1310 for (uint32_t j = 0; j < name.length (); j++)
1312 name[j] = toupper (name[j]);
1320 std::vector<std::string> noTids = info.
GetNoTypeIds ();
1321 for (std::vector<std::string>::const_iterator i = noTids.begin ();
1337 std::vector<std::string> paths = info.
Get (tid);
1342 os <<
"Introspection did not find any typical Config paths."
1354 <<
" is accessible through the following paths"
1355 <<
" with Config::Set and Config::Connect:"
1358 for (uint32_t k = 0; k < paths.size (); ++k)
1360 std::string path = paths[k];
1362 <<
"\"" << path <<
"\""
1376 int main (
int argc,
char *argv[])
1379 bool outputText =
false;
1382 cmd.
Usage (
"Generate documentation for all ns-3 registered types, "
1383 "trace sources, attributes and global variables.");
1384 cmd.
AddValue (
"output-text",
"format output as plain text", outputText);
1385 cmd.
Parse (argc, argv);
1397 std::cout <<
"/* -*- Mode:C++; c-file-style:\"gnu\"; "
1398 "indent-tabs-mode:nil; -*- */\n"
1410 nameMapIterator != nameMap.end ();
1414 std::string name = nameMapIterator->first;
1415 int32_t i = nameMapIterator->second;
1430 std::cout <<
classStart << name << std::endl;
1431 std::cout << std::endl;
1442 std::cout <<
"Introspection could not find Config paths for " << name
1443 <<
" in this build because the parent module"
1444 <<
" was not included in the waf configuration."
uint32_t GetAttributeN(void) const
std::string classStart
start of a class
NameMap GetNameMap(const StaticInformation &info)
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 Get(void) const
std::string functionStop
end of a method/function
virtual TypeId GetInstanceTypeId(void) const
Implement the GetInstanceTypeId method defined in ObjectBase.
const std::string m_header
The header file name.
std::string headingStop
end of section heading (h3)
Hold variables of type string.
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.
void PrintConfigPaths(std::ostream &os, const StaticInformation &info, const TypeId tid)
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.
TypeId GetParent(void) const
Vector::const_iterator Iterator
std::string boldStart
start of bold span
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)
#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.
Ptr< Object > GetRootNamespaceObject(uint32_t i)
void PrintTraceSources(std::ostream &os, const TypeId tid)
Print the Trace sources block for tid, including Trace sources declared in base classes.
std::string listLineStart
start unordered list item
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.
void Usage(const std::string usage)
Supply the program usage and documentation.
The attribute can be read.
bool MustHideFromDocumentation(void) const
std::map< std::string, int32_t > NameMap
std::string indentHtmlOnly
small indent
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
static uint32_t GetRegisteredN(void)
const std::string m_name
The base name of the resulting AttributeValue type.
static Iterator Begin(void)
std::string subSectionStart
start a new subsection
std::string variable
variable or class member
std::string sectionStart
start of a section or group
AttributeChecker implementation for ObjectPtrContainerValue.
NameMap::const_iterator NameMapIterator
uint32_t GetTraceSourceN(void) const
static TypeId GetRegistered(uint32_t i)
void PrintSize(std::ostream &os, const TypeId tid)
Print the size of the type represented by this tid.
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.
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
std::string GetName(void) const
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.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
std::string classStop
end of a class
StaticInformation GetTypicalAggregations()
AttributeChecker implementation for PointerValue.
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::size_t GetSize(void) const
std::string anchor
hyperlink anchor
void PrintMakeAccessors(std::ostream &os, const std::string &name)
Print the AttributeValue MakeAccessor documentation for a class.
void AddValue(const std::string &name, const std::string &help, T &value)
Add a program argument, assigning to POD.
static Iterator End(void)
std::string copyDoc
copy (or refer) to docs elsewhere
std::string page
start a separate page
std::string seeAlso
Reference to other docs.
void Parse(int argc, char *argv[])
Parse the program arguments.
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.
void PrintAttributeImplementations(std::ostream &os)
Print documentation for Attribute implementations.
struct TypeId::TraceSourceInformation GetTraceSource(uint32_t i) const
std::string functionStart
start of a method/function
struct TypeId::AttributeInformation GetAttribute(uint32_t i) const
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