A Discrete-Event Network Simulator
API
print-introspected-doxygen.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007 INRIA
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18  */
19 
26 #include "ns3/command-line.h"
27 #include "ns3/config.h"
28 #include "ns3/global-value.h"
29 #include "ns3/log.h"
30 #include "ns3/node-container.h"
31 #include "ns3/object-vector.h"
32 #include "ns3/object.h"
33 #include "ns3/pointer.h"
34 #include "ns3/simple-channel.h"
35 #include "ns3/string.h"
36 #include "ns3/system-path.h"
37 
38 #include <algorithm>
39 #include <climits> // CHAR_BIT
40 #include <iomanip>
41 #include <iostream>
42 #include <map>
43 #include <utility> // as_const
44 
45 using namespace ns3;
46 
47 NS_LOG_COMPONENT_DEFINE("PrintIntrospectedDoxygen");
48 
49 namespace
50 {
52 bool outputText = false;
53 
58 std::string anchor;
59 std::string argument;
60 std::string boldStart;
61 std::string boldStop;
62 std::string breakBoth;
63 std::string breakHtmlOnly;
64 std::string breakTextOnly;
65 std::string brief;
66 std::string classStart;
67 std::string classStop;
68 std::string codeWord;
69 std::string commentStart;
70 std::string commentStop;
71 std::string copyDoc;
72 std::string file;
73 std::string flagSpanStart;
74 std::string flagSpanStop;
75 std::string functionStart;
76 std::string functionStop;
77 std::string headingStart;
78 std::string headingStop;
79 // Linking: [The link text displayed](\ref TheTarget)
80 std::string hrefStart;
81 std::string hrefMid;
82 std::string hrefStop;
83 std::string indentHtmlOnly;
84 std::string listLineStart;
85 std::string listLineStop;
86 std::string listStart;
87 std::string listStop;
88 std::string note;
89 std::string page;
90 std::string reference;
91 std::string referenceNo;
92 std::string returns;
93 std::string sectionStart;
94 std::string seeAlso;
95 std::string subSectionStart;
96 std::string templArgDeduced;
97 std::string templArgExplicit;
98 std::string templateArgument;
99 std::string variable;
100 
108 std::map<std::string, ns3::TypeId::AttributeInformation>
110 {
111  std::map<std::string, ns3::TypeId::AttributeInformation> index;
112  for (uint32_t j = 0; j < tid.GetAttributeN(); j++)
113  {
114  struct TypeId::AttributeInformation info = tid.GetAttribute(j);
115  index[info.name] = info;
116  }
117  return index;
118 }
119 
126 std::map<std::string, ns3::TypeId::TraceSourceInformation>
128 {
129  std::map<std::string, ns3::TypeId::TraceSourceInformation> index;
130  for (uint32_t j = 0; j < tid.GetTraceSourceN(); j++)
131  {
132  struct TypeId::TraceSourceInformation info = tid.GetTraceSource(j);
133  index[info.name] = info;
134  }
135  return index;
136 }
137 
138 } // unnamed namespace
139 
143 void
145 {
147  if (outputText)
148  {
149  anchor = "";
150  argument = " Arg: ";
151  boldStart = "";
152  boldStop = "";
153  breakBoth = "\n";
154  breakHtmlOnly = "";
155  breakTextOnly = "\n";
156  brief = "";
157  classStart = "";
158  classStop = "\n\n";
159  codeWord = " ";
160  commentStart = "===============================================================\n";
161  commentStop = "";
162  copyDoc = " See: ";
163  file = "File: introspected-doxygen.txt";
164  flagSpanStart = "";
165  flagSpanStop = "";
166  functionStart = "";
167  functionStop = "\n\n";
168  headingStart = "";
169  headingStop = "";
170  // Linking: The link text displayed (see TheTarget)
171  hrefStart = "";
172  hrefMid = "(see ";
173  hrefStop = ")";
174  indentHtmlOnly = "";
175  listLineStart = " * ";
176  listLineStop = "";
177  listStart = "";
178  listStop = "";
179  note = "Note: ";
180  page = "Page ";
181  reference = " ";
182  referenceNo = " ";
183  returns = " Returns: ";
184  sectionStart = "Section: ";
185  seeAlso = " See: ";
186  subSectionStart = "Subsection ";
187  templArgDeduced = "[deduced] ";
188  templArgExplicit = "[explicit] ";
189  templateArgument = "Template Arg: ";
190  variable = "Variable: ";
191  }
192  else
193  {
194  anchor = "\\anchor ";
195  argument = "\\param ";
196  boldStart = "<b>";
197  boldStop = "</b>";
198  breakBoth = "<br>";
199  breakHtmlOnly = "<br>";
200  breakTextOnly = "";
201  brief = "\\brief ";
202  classStart = "\\class ";
203  classStop = "";
204  codeWord = "\\p ";
205  commentStart = "/*!\n";
206  commentStop = "*/\n";
207  copyDoc = "\\copydoc ";
208  file = "\\file";
209  flagSpanStart = "<span class=\"mlabel\">";
210  flagSpanStop = "</span>";
211  functionStart = "\\fn ";
212  functionStop = "";
213  headingStart = "<h3>";
214  headingStop = "</h3>";
215  // Linking: [The link text displayed](\ref TheTarget)
216  hrefStart = "[";
217  hrefMid = "](\\ref ";
218  hrefStop = ")";
219  indentHtmlOnly = " ";
220  listLineStart = "<li>";
221  listLineStop = "</li>";
222  listStart = "<ul>";
223  listStop = "</ul>";
224  note = "\\note ";
225  page = "\\page ";
226  reference = " \\ref ";
227  referenceNo = " %";
228  returns = "\\returns ";
229  sectionStart = "\\ingroup ";
230  seeAlso = "\\see ";
231  subSectionStart = "\\addtogroup ";
232  templArgDeduced = "\\deduced ";
233  templArgExplicit = "\\explicit ";
234  templateArgument = "\\tparam ";
235  variable = "\\var ";
236  }
237 } // SetMarkup ()
238 
239 /***************************************************************
240  * Aggregation and configuration paths
241  ***************************************************************/
242 
247 {
248  public:
255  void RecordAggregationInfo(std::string a, std::string b);
261  void Gather(TypeId tid);
265  void Print() const;
266 
272  std::vector<std::string> Get(TypeId tid) const;
273 
277  std::vector<std::string> GetNoTypeIds() const;
278 
279  private:
283  std::string GetCurrentPath() const;
289  void DoGather(TypeId tid);
295  void RecordOutput(TypeId tid);
301  bool HasAlreadyBeenProcessed(TypeId tid) const;
305  std::vector<std::pair<TypeId, std::string>> m_output;
309  std::vector<std::string> m_currentPath;
313  std::vector<TypeId> m_alreadyProcessed;
317  std::vector<std::pair<TypeId, TypeId>> m_aggregates;
324  mutable std::vector<std::string> m_noTids;
325 
326 }; // class StaticInformation
327 
328 void
329 StaticInformation::RecordAggregationInfo(std::string a, std::string b)
330 {
331  NS_LOG_FUNCTION(this << a << b);
332  TypeId aTid;
333  bool found = TypeId::LookupByNameFailSafe(a, &aTid);
334  if (!found)
335  {
336  m_noTids.push_back(a);
337  return;
338  }
339  TypeId bTid;
340  found = TypeId::LookupByNameFailSafe(b, &bTid);
341  if (!found)
342  {
343  m_noTids.push_back(b);
344  return;
345  }
346 
347  m_aggregates.emplace_back(aTid, bTid);
348 }
349 
350 void
352 {
353  NS_LOG_FUNCTION(this);
354  for (const auto& item : m_output)
355  {
356  std::cout << item.first.GetName() << " -> " << item.second << std::endl;
357  }
358 }
359 
360 std::string
362 {
363  NS_LOG_FUNCTION(this);
364  std::ostringstream oss;
365  for (const auto& item : m_currentPath)
366  {
367  oss << "/" << item;
368  }
369  return oss.str();
370 }
371 
372 void
374 {
375  NS_LOG_FUNCTION(this << tid);
376  m_output.emplace_back(tid, GetCurrentPath());
377 }
378 
379 bool
381 {
382  NS_LOG_FUNCTION(this << tid);
383  for (const auto& it : m_alreadyProcessed)
384  {
385  if (it == tid)
386  {
387  return true;
388  }
389  }
390  return false;
391 }
392 
393 std::vector<std::string>
395 {
396  NS_LOG_FUNCTION(this << tid);
397  std::vector<std::string> paths;
398  for (const auto& item : m_output)
399  {
400  if (item.first == tid)
401  {
402  paths.push_back(item.second);
403  }
404  }
405  return paths;
406 }
407 
423 template <typename T>
424 void
426 {
427  std::sort(t.begin(), t.end());
428  t.erase(std::unique(t.begin(), t.end()), t.end());
429 }
430 
431 std::vector<std::string>
433 {
434  NS_LOG_FUNCTION(this);
435  Uniquefy(m_noTids);
436  return m_noTids;
437 }
438 
439 void
441 {
442  NS_LOG_FUNCTION(this << tid);
443  DoGather(tid);
444  Uniquefy(m_output);
445 }
446 
447 void
449 {
450  NS_LOG_FUNCTION(this << tid);
451  if (HasAlreadyBeenProcessed(tid))
452  {
453  return;
454  }
455  RecordOutput(tid);
456  for (uint32_t i = 0; i < tid.GetAttributeN(); ++i)
457  {
458  struct TypeId::AttributeInformation info = tid.GetAttribute(i);
459  const auto ptrChecker = dynamic_cast<const PointerChecker*>(PeekPointer(info.checker));
460  if (ptrChecker != nullptr)
461  {
462  TypeId pointee = ptrChecker->GetPointeeTypeId();
463 
464  // See if this is a pointer to an Object.
465  Ptr<Object> object = CreateObject<Object>();
466  TypeId objectTypeId = object->GetTypeId();
467  if (objectTypeId == pointee)
468  {
469  // Stop the recursion at this attribute if it is a
470  // pointer to an Object, which create too many spurious
471  // paths in the list of attribute paths because any
472  // Object can be in that part of the path.
473  continue;
474  }
475 
476  m_currentPath.push_back(info.name);
477  m_alreadyProcessed.push_back(tid);
478  DoGather(pointee);
479  m_alreadyProcessed.pop_back();
480  m_currentPath.pop_back();
481  continue;
482  }
483  // attempt to cast to an object vector.
484  const auto vectorChecker =
485  dynamic_cast<const ObjectPtrContainerChecker*>(PeekPointer(info.checker));
486  if (vectorChecker != nullptr)
487  {
488  TypeId item = vectorChecker->GetItemTypeId();
489  m_currentPath.push_back(info.name + "/[i]");
490  m_alreadyProcessed.push_back(tid);
491  DoGather(item);
492  m_alreadyProcessed.pop_back();
493  m_currentPath.pop_back();
494  continue;
495  }
496  }
497  for (uint32_t j = 0; j < TypeId::GetRegisteredN(); j++)
498  {
499  TypeId child = TypeId::GetRegistered(j);
500  if (child.IsChildOf(tid))
501  {
502  std::string childName = "$" + child.GetName();
503  m_currentPath.push_back(childName);
504  m_alreadyProcessed.push_back(tid);
505  DoGather(child);
506  m_alreadyProcessed.pop_back();
507  m_currentPath.pop_back();
508  }
509  }
510  for (const auto& item : m_aggregates)
511  {
512  if (item.first == tid || item.second == tid)
513  {
514  TypeId other;
515  if (item.first == tid)
516  {
517  other = item.second;
518  }
519  if (item.second == tid)
520  {
521  other = item.first;
522  }
523  std::string name = "$" + other.GetName();
524  m_currentPath.push_back(name);
525  m_alreadyProcessed.push_back(tid);
526  DoGather(other);
527  m_alreadyProcessed.pop_back();
528  m_currentPath.pop_back();
529  }
530  }
531 } // StaticInformation::DoGather ()
532 
539 {
541 
542  static StaticInformation info;
543  static bool mapped = false;
544 
545  if (mapped)
546  {
547  return info;
548  }
549 
550  // Short circuit next call
551  mapped = true;
552 
553  // The below statements register typical aggregation relationships
554  // in ns-3 programs, that otherwise aren't picked up automatically
555  // by the creation of the above node. To manually list other common
556  // aggregation relationships that you would like to see show up in
557  // the list of configuration paths in the doxygen, add additional
558  // statements below.
559  info.RecordAggregationInfo("ns3::Node", "ns3::TcpSocketFactory");
560  info.RecordAggregationInfo("ns3::Node", "ns3::UdpSocketFactory");
561  info.RecordAggregationInfo("ns3::Node", "ns3::PacketSocketFactory");
562  info.RecordAggregationInfo("ns3::Node", "ns3::MobilityModel");
563  info.RecordAggregationInfo("ns3::Node", "ns3::Ipv4L3Protocol");
564  info.RecordAggregationInfo("ns3::Node", "ns3::Ipv4NixVectorRouting");
565  info.RecordAggregationInfo("ns3::Node", "ns3::Icmpv4L4Protocol");
566  info.RecordAggregationInfo("ns3::Node", "ns3::ArpL3Protocol");
567  info.RecordAggregationInfo("ns3::Node", "ns3::Icmpv4L4Protocol");
568  info.RecordAggregationInfo("ns3::Node", "ns3::UdpL4Protocol");
569  info.RecordAggregationInfo("ns3::Node", "ns3::Ipv6L3Protocol");
570  info.RecordAggregationInfo("ns3::Node", "ns3::Icmpv6L4Protocol");
571  info.RecordAggregationInfo("ns3::Node", "ns3::TcpL4Protocol");
572  info.RecordAggregationInfo("ns3::Node", "ns3::RipNg");
573  info.RecordAggregationInfo("ns3::Node", "ns3::GlobalRouter");
574  info.RecordAggregationInfo("ns3::Node", "ns3::aodv::RoutingProtocol");
575  info.RecordAggregationInfo("ns3::Node", "ns3::dsdv::RoutingProtocol");
576  info.RecordAggregationInfo("ns3::Node", "ns3::dsr::DsrRouting");
577  info.RecordAggregationInfo("ns3::Node", "ns3::olsr::RoutingProtocol");
578  info.RecordAggregationInfo("ns3::Node", "ns3::EnergyHarvesterContainer");
579  info.RecordAggregationInfo("ns3::Node", "ns3::EnergySourceContainer");
580 
581  // Create a channel object so that channels appear in the namespace
582  // paths that will be generated here.
583  Ptr<SimpleChannel> simpleChannel;
584  simpleChannel = CreateObject<SimpleChannel>();
585 
586  for (uint32_t i = 0; i < Config::GetRootNamespaceObjectN(); ++i)
587  {
589  info.Gather(object->GetInstanceTypeId());
590  }
591 
592  return info;
593 
594 } // GetTypicalAggregations ()
595 
597 typedef std::map<std::string, int32_t> NameMap;
598 typedef NameMap::const_iterator NameMapIterator;
599 
606 NameMap
608 {
610 
611  static NameMap nameMap;
612  static bool mapped = false;
613 
614  if (mapped)
615  {
616  return nameMap;
617  }
618 
619  // Short circuit next call
620  mapped = true;
621 
622  // Get typical aggregation relationships.
624 
625  // Registered types
626  for (uint32_t i = 0; i < TypeId::GetRegisteredN(); i++)
627  {
628  TypeId tid = TypeId::GetRegistered(i);
629  if (tid.MustHideFromDocumentation())
630  {
631  continue;
632  }
633 
634  // Capitalize all of letters in the name so that it sorts
635  // correctly in the map.
636  std::string name = tid.GetName();
637  std::transform(name.begin(), name.end(), name.begin(), ::toupper);
638 
639  // Save this name's index.
640  nameMap[name] = i;
641  }
642 
643  // Type names without TypeIds
644  std::vector<std::string> noTids = info.GetNoTypeIds();
645  for (const auto& item : noTids)
646  {
647  nameMap[item] = -1;
648  }
649 
650  return nameMap;
651 } // GetNameMap ()
652 
653 /***************************************************************
654  * Docs for a single TypeId
655  ***************************************************************/
656 
662 void
663 PrintConfigPaths(std::ostream& os, const TypeId tid)
664 {
665  NS_LOG_FUNCTION(tid);
666  std::vector<std::string> paths = GetTypicalAggregations().Get(tid);
667 
668  // Config --------------
669  if (paths.empty())
670  {
671  os << "Introspection did not find any typical Config paths." << breakBoth << std::endl;
672  }
673  else
674  {
675  os << headingStart << "Config Paths" << headingStop << std::endl;
676  os << std::endl;
677  os << tid.GetName() << " is accessible through the following paths"
678  << " with Config::Set and Config::Connect:" << std::endl;
679  os << listStart << std::endl;
680  for (const auto& path : paths)
681  {
682  os << listLineStart << "\"" << path << "\"" << listLineStop << breakTextOnly
683  << std::endl;
684  }
685  os << listStop << std::endl;
686  }
687 } // PrintConfigPaths ()
688 
697 void
698 PrintAttributesTid(std::ostream& os, const TypeId tid)
699 {
700  NS_LOG_FUNCTION(tid);
701 
702  auto index = SortedAttributeInfo(tid);
703 
704  os << listStart << std::endl;
705  for (const auto& [name, info] : index)
706  {
707  os << listLineStart << boldStart << name << boldStop << ": " << info.help << std::endl;
708  os << indentHtmlOnly << listStart << std::endl;
709  os << " " << listLineStart << "Set with class: " << reference
710  << info.checker->GetValueTypeName() << listLineStop << std::endl;
711 
712  std::string underType;
713  if (info.checker->HasUnderlyingTypeInformation())
714  {
715  os << " " << listLineStart << "Underlying type: ";
716 
717  std::string valType = info.checker->GetValueTypeName();
718  underType = info.checker->GetUnderlyingTypeInformation();
719  bool handled = false;
720  if ((valType != "ns3::EnumValue") && (underType != "std::string"))
721  {
722  // Indirect cases to handle
723  if (valType == "ns3::PointerValue")
724  {
725  const auto ptrChecker =
726  dynamic_cast<const PointerChecker*>(PeekPointer(info.checker));
727  if (ptrChecker != nullptr)
728  {
729  os << reference << "ns3::Ptr"
730  << "< " << reference << ptrChecker->GetPointeeTypeId().GetName() << ">";
731  handled = true;
732  }
733  }
734  else if (valType == "ns3::ObjectPtrContainerValue")
735  {
736  const auto ptrChecker =
737  dynamic_cast<const ObjectPtrContainerChecker*>(PeekPointer(info.checker));
738  if (ptrChecker != nullptr)
739  {
740  os << reference << "ns3::Ptr"
741  << "< " << reference << ptrChecker->GetItemTypeId().GetName() << ">";
742  handled = true;
743  }
744  }
745 
746  // Helper to match first part of string
747  auto match = [&uType = std::as_const(underType)](const std::string& s) {
748  return uType.rfind(s, 0) == 0; // only checks position 0
749  };
750 
751  if (match("bool") || match("double") || match("int8_t") || match("uint8_t") ||
752  match("int16_t") || match("uint16_t") || match("int32_t") ||
753  match("uint32_t") || match("int64_t") || match("uint64_t"))
754  {
755  os << underType;
756  handled = true;
757  }
758  }
759  if (!handled)
760  {
761  os << codeWord << underType;
762  }
763  os << listLineStop << std::endl;
764  }
765  if (info.flags & TypeId::ATTR_CONSTRUCT && info.accessor->HasSetter())
766  {
767  std::string value = info.initialValue->SerializeToString(info.checker);
768  if (underType == "std::string" && value.empty())
769  {
770  value = "\"\"";
771  }
772  os << " " << listLineStart << "Initial value: " << value << listLineStop
773  << std::endl;
774  }
775  bool moreFlags{false};
776  os << " " << listLineStart << "Flags: ";
777  if (info.flags & TypeId::ATTR_CONSTRUCT && info.accessor->HasSetter())
778  {
779  os << flagSpanStart << "construct" << flagSpanStop;
780  moreFlags = true;
781  }
782  if (info.flags & TypeId::ATTR_SET && info.accessor->HasSetter())
783  {
784  os << (outputText && moreFlags ? ", " : "") << flagSpanStart << "write" << flagSpanStop;
785  moreFlags = true;
786  }
787  if (info.flags & TypeId::ATTR_GET && info.accessor->HasGetter())
788  {
789  os << (outputText && moreFlags ? ", " : "") << flagSpanStart << "read" << flagSpanStop;
790  moreFlags = true;
791  }
792  os << listLineStop << std::endl;
793  os << indentHtmlOnly << listStop << std::endl;
794  }
795  os << listStop << std::endl;
796 } // PrintAttributesTid ()
797 
808 void
809 PrintAttributes(std::ostream& os, const TypeId tid)
810 {
811  NS_LOG_FUNCTION(tid);
812  if (tid.GetAttributeN() == 0)
813  {
814  os << "No Attributes are defined for this type." << breakBoth << std::endl;
815  }
816  else
817  {
818  os << headingStart << "Attributes" << headingStop << std::endl;
819  PrintAttributesTid(os, tid);
820  }
821 
822  // Attributes from base classes
823  TypeId tmp = tid.GetParent();
824  while (tmp.GetParent() != tmp)
825  {
826  if (tmp.GetAttributeN() != 0)
827  {
828  os << headingStart << "Attributes defined in parent class " << tmp.GetName()
829  << headingStop << std::endl;
830  PrintAttributesTid(os, tmp);
831  }
832  tmp = tmp.GetParent();
833 
834  } // Attributes
835 } // PrintAttributes ()
836 
845 void
846 PrintTraceSourcesTid(std::ostream& os, const TypeId tid)
847 {
848  NS_LOG_FUNCTION(tid);
849 
850  auto index = SortedTraceSourceInfo(tid);
851 
852  os << listStart << std::endl;
853  for (const auto& [name, info] : index)
854  {
855  os << listLineStart << boldStart << name << boldStop << ": " << info.help << breakBoth;
856  if (!outputText)
857  {
858  // '%' prevents doxygen from linking to the Callback class...
859  os << "%";
860  }
861  os << "Callback signature: " << info.callback << std::endl;
862  os << listLineStop << std::endl;
863  }
864  os << listStop << std::endl;
865 } // PrintTraceSourcesTid ()
866 
877 void
878 PrintTraceSources(std::ostream& os, const TypeId tid)
879 {
880  NS_LOG_FUNCTION(tid);
881  if (tid.GetTraceSourceN() == 0)
882  {
883  os << "No TraceSources are defined for this type." << breakBoth << std::endl;
884  }
885  else
886  {
887  os << headingStart << "TraceSources" << headingStop << std::endl;
888  PrintTraceSourcesTid(os, tid);
889  }
890 
891  // Trace sources from base classes
892  TypeId tmp = tid.GetParent();
893  while (tmp.GetParent() != tmp)
894  {
895  if (tmp.GetTraceSourceN() != 0)
896  {
897  os << headingStart << "TraceSources defined in parent class " << tmp.GetName()
898  << headingStop << std::endl;
899  PrintTraceSourcesTid(os, tmp);
900  }
901  tmp = tmp.GetParent();
902  }
903 
904 } // PrintTraceSources ()
905 
912 void
913 PrintSize(std::ostream& os, const TypeId tid)
914 {
915  NS_LOG_FUNCTION(tid);
916  NS_ASSERT_MSG(CHAR_BIT != 0, "CHAR_BIT is zero");
917 
918  std::size_t arch = (sizeof(void*) * CHAR_BIT);
919 
920  os << boldStart << "Size" << boldStop << " of this type is " << tid.GetSize() << " bytes (on a "
921  << arch << "-bit architecture)." << std::endl;
922 } // PrintSize ()
923 
929 void
930 PrintTypeIdBlocks(std::ostream& os)
931 {
933 
934  NameMap nameMap = GetNameMap();
935 
936  // Iterate over the map, which will print the class names in
937  // alphabetical order.
938  for (const auto& item : nameMap)
939  {
940  // Handle only real TypeIds
941  if (item.second < 0)
942  {
943  continue;
944  }
945  // Get the class's index out of the map;
946  TypeId tid = TypeId::GetRegistered(item.second);
947  std::string name = tid.GetName();
948 
949  std::cout << commentStart << std::endl;
950 
951  std::cout << classStart << name << std::endl;
952  std::cout << std::endl;
953 
954  PrintConfigPaths(std::cout, tid);
955  PrintAttributes(std::cout, tid);
956  PrintTraceSources(std::cout, tid);
957  PrintSize(std::cout, tid);
958 
959  std::cout << commentStop << std::endl;
960  } // for class documentation
961 
962 } // PrintTypeIdBlocks
963 
964 /***************************************************************
965  * Lists of All things
966  ***************************************************************/
967 
973 void
974 PrintAllTypeIds(std::ostream& os)
975 {
977  os << commentStart << page << "TypeIdList All ns3::TypeId's\n" << std::endl;
978  os << "This is a list of all" << reference << "ns3::TypeId's.\n"
979  << "For more information see the" << reference << "ns3::TypeId "
980  << "section of this API documentation and the" << referenceNo << "TypeId section "
981  << "in the Configuration and " << referenceNo << "Attributes chapter of the Manual.\n"
982  << std::endl;
983 
984  os << listStart << std::endl;
985 
986  NameMap nameMap = GetNameMap();
987  // Iterate over the map, which will print the class names in
988  // alphabetical order.
989  for (const auto& item : nameMap)
990  {
991  // Handle only real TypeIds
992  if (item.second < 0)
993  {
994  continue;
995  }
996  // Get the class's index out of the map;
997  TypeId tid = TypeId::GetRegistered(item.second);
998 
999  os << indentHtmlOnly << listLineStart << boldStart << tid.GetName() << boldStop
1000  << listLineStop << std::endl;
1001  }
1002  os << listStop << std::endl;
1003  os << commentStop << std::endl;
1004 
1005 } // PrintAllTypeIds ()
1006 
1015 void
1016 PrintAllAttributes(std::ostream& os)
1017 {
1019  os << commentStart << page << "AttributeList All Attributes\n" << std::endl;
1020  os << "This is a list of all" << reference << "attributes classes. "
1021  << "For more information see the" << reference << "attributes "
1022  << "section of this API documentation and the Attributes sections "
1023  << "in the Tutorial and Manual.\n"
1024  << std::endl;
1025 
1026  NameMap nameMap = GetNameMap();
1027  // Iterate over the map, which will print the class names in
1028  // alphabetical order.
1029  for (const auto& item : nameMap)
1030  {
1031  // Handle only real TypeIds
1032  if (item.second < 0)
1033  {
1034  continue;
1035  }
1036  // Get the class's index out of the map;
1037  TypeId tid = TypeId::GetRegistered(item.second);
1038 
1039  if (tid.GetAttributeN() == 0)
1040  {
1041  continue;
1042  }
1043 
1044  auto index = SortedAttributeInfo(tid);
1045 
1046  os << boldStart << tid.GetName() << boldStop << breakHtmlOnly << std::endl;
1047  os << listStart << std::endl;
1048  for (const auto& [name, info] : index)
1049  {
1050  os << listLineStart << boldStart << name << boldStop << ": " << info.help
1051  << listLineStop << std::endl;
1052  }
1053  os << listStop << std::endl;
1054  }
1055  os << commentStop << std::endl;
1056 
1057 } // PrintAllAttributes ()
1058 
1064 void
1065 PrintAllGlobals(std::ostream& os)
1066 {
1068  os << commentStart << page << "GlobalValueList All GlobalValues\n" << std::endl;
1069  os << "This is a list of all" << reference << "ns3::GlobalValue instances.\n"
1070  << "See ns3::GlobalValue for how to set these." << std::endl;
1071 
1072  os << listStart << std::endl;
1073  for (auto i = GlobalValue::Begin(); i != GlobalValue::End(); ++i)
1074  {
1075  StringValue val;
1076  (*i)->GetValue(val);
1077  os << indentHtmlOnly << listLineStart << boldStart << hrefStart << (*i)->GetName()
1078  << hrefMid << "GlobalValue" << (*i)->GetName() << hrefStop << boldStop << ": "
1079  << (*i)->GetHelp() << ". Default value: " << val.Get() << "." << listLineStop
1080  << std::endl;
1081  }
1082  os << listStop << std::endl;
1083  os << commentStop << std::endl;
1084 
1085 } // PrintAllGlobals ()
1086 
1092 void
1093 PrintAllLogComponents(std::ostream& os)
1094 {
1096  os << commentStart << page << "LogComponentList All LogComponents\n" << std::endl;
1097  os << "This is a list of all" << reference << "ns3::LogComponent instances.\n" << std::endl;
1098 
1104  // Find longest log name
1105  std::size_t widthL = std::string("Log Component").size();
1106  std::size_t widthR = std::string("file").size();
1107  for (const auto& it : (*logs))
1108  {
1109  widthL = std::max(widthL, it.first.size());
1110  std::string file = it.second->File();
1111  // Strip leading "../" related to depth in build directory
1112  // since doxygen only sees the path starting with "src/", etc.
1113  while (file.find("../") == 0)
1114  {
1115  file = file.substr(3);
1116  }
1117  widthR = std::max(widthR, file.size());
1118  }
1119  const std::string tLeft("| ");
1120  const std::string tMid(" | ");
1121  const std::string tRight(" |");
1122 
1123  // Header line has to be padded to same length as separator line
1124  os << tLeft << std::setw(widthL) << std::left << "Log Component" << tMid << std::setw(widthR)
1125  << std::left << "File" << tRight << std::endl;
1126  os << tLeft << ":" << std::string(widthL - 1, '-') << tMid << ":"
1127  << std::string(widthR - 1, '-') << tRight << std::endl;
1128 
1129  for (const auto& it : (*logs))
1130  {
1131  std::string file = it.second->File();
1132  // Strip leading "../" related to depth in build directory
1133  // since doxygen only sees the path starting with "src/", etc.
1134  while (file.find("../") == 0)
1135  {
1136  file = file.substr(3);
1137  }
1138 
1139  os << tLeft << std::setw(widthL) << std::left << it.first << tMid << std::setw(widthR)
1140  << file << tRight << std::endl;
1141  }
1142  os << std::right << std::endl;
1143  os << commentStop << std::endl;
1144 } // PrintAllLogComponents ()
1145 
1154 void
1155 PrintAllTraceSources(std::ostream& os)
1156 {
1158  os << commentStart << page << "TraceSourceList All TraceSources\n" << std::endl;
1159  os << "This is a list of all" << reference << "tracing sources. "
1160  << "For more information see the " << reference << "tracing "
1161  << "section of this API documentation and the Tracing sections "
1162  << "in the Tutorial and Manual.\n"
1163  << std::endl;
1164 
1165  NameMap nameMap = GetNameMap();
1166 
1167  // Iterate over the map, which will print the class names in
1168  // alphabetical order.
1169  for (const auto& item : nameMap)
1170  {
1171  // Handle only real TypeIds
1172  if (item.second < 0)
1173  {
1174  continue;
1175  }
1176  // Get the class's index out of the map;
1177  TypeId tid = TypeId::GetRegistered(item.second);
1178 
1179  if (tid.GetTraceSourceN() == 0)
1180  {
1181  continue;
1182  }
1183 
1184  auto index = SortedTraceSourceInfo(tid);
1185 
1186  os << boldStart << tid.GetName() << boldStop << breakHtmlOnly << std::endl;
1187 
1188  os << listStart << std::endl;
1189  for (const auto& [name, info] : index)
1190  {
1191  os << listLineStart << boldStart << name << boldStop << ": " << info.help
1192  << listLineStop << std::endl;
1193  }
1194  os << listStop << std::endl;
1195  }
1196  os << commentStop << std::endl;
1197 
1198 } // PrintAllTraceSources ()
1199 
1200 /***************************************************************
1201  * Docs for Attribute classes
1202  ***************************************************************/
1203 
1217 void
1218 PrintAttributeValueSection(std::ostream& os, const std::string& name, const bool seeBase = true)
1219 {
1220  NS_LOG_FUNCTION(name);
1221  std::string section = "attribute_" + name;
1222 
1223  // \ingroup attributes
1224  // \defgroup attribute_<name>Value <name> Attribute
1225  os << commentStart << sectionStart << "attributes\n"
1226  << subSectionStart << "attribute_" << name << " " << name << " Attribute\n"
1227  << "AttributeValue implementation for " << name << "\n";
1228  if (seeBase)
1229  {
1230  // Some classes don't live in ns3::. Yuck
1231  if (name != "IeMeshId")
1232  {
1233  os << seeAlso << "ns3::" << name << "\n";
1234  }
1235  else
1236  {
1237  os << seeAlso << "ns3::dot11s::" << name << "\n";
1238  }
1239  }
1240  os << commentStop;
1241 
1242 } // PrintAttributeValueSection ()
1243 
1254 void
1256  const std::string& name,
1257  const std::string& type,
1258  const std::string& header)
1259 {
1260  NS_LOG_FUNCTION(name << type << header);
1261  std::string sectAttr = sectionStart + "attribute_" + name;
1262 
1263  // \ingroup attribute_<name>Value
1264  // \class ns3::<name>Value "header"
1265  std::string valClass = name + "Value";
1266  std::string qualClass = " ns3::" + valClass;
1267 
1268  os << commentStart << sectAttr << std::endl;
1269  os << classStart << qualClass << " \"" << header << "\"" << std::endl;
1270  os << "AttributeValue implementation for " << name << "." << std::endl;
1271  os << seeAlso << "AttributeValue" << std::endl;
1272  os << commentStop;
1273 
1274  // Copy ctor: <name>Value::<name>Value
1275  os << commentStart << functionStart << name << qualClass << "::" << valClass;
1276  if ((name == "EmptyAttribute") || (name == "ObjectPtrContainer"))
1277  {
1278  // Just default constructors.
1279  os << "()\n";
1280  }
1281  else
1282  {
1283  // Copy constructors
1284  os << "(const " << type << " & value)\n"
1285  << "Copy constructor.\n"
1286  << argument << "[in] value The " << name << " value to copy.\n";
1287  }
1288  os << commentStop;
1289 
1290  // <name>Value::Get () const
1291  os << commentStart << functionStart << type << qualClass << "::Get () const\n"
1292  << returns << "The " << name << " value.\n"
1293  << commentStop;
1294 
1295  // <name>Value::GetAccessor (T & value) const
1296  os << commentStart << functionStart << "bool" << qualClass
1297  << "::GetAccessor (T & value) const\n"
1298  << "Access the " << name << " value as type " << codeWord << "T.\n"
1299  << templateArgument << "T " << templArgExplicit << "The type to cast to.\n"
1300  << argument << "[out] value The " << name << " value, as type " << codeWord << "T.\n"
1301  << returns << "true.\n"
1302  << commentStop;
1303 
1304  // <name>Value::Set (const name & value)
1305  if (type != "Callback") // Yuck
1306  {
1307  os << commentStart << functionStart << "void" << qualClass << "::Set (const " << type
1308  << " & value)\n"
1309  << "Set the value.\n"
1310  << argument << "[in] value The value to adopt.\n"
1311  << commentStop;
1312  }
1313 
1314  // <name>Value::m_value
1315  os << commentStart << variable << type << qualClass << "::m_value\n"
1316  << "The stored " << name << " instance.\n"
1317  << commentStop << std::endl;
1318 
1319 } // PrintAttributeValueWithName ()
1320 
1329 void
1330 PrintMakeAccessors(std::ostream& os, const std::string& name)
1331 {
1332  NS_LOG_FUNCTION(name);
1333  std::string sectAttr = sectionStart + "attribute_" + name + "\n";
1334  std::string make = "ns3::Make" + name + "Accessor ";
1335 
1336  // \ingroup attribute_<name>Value
1337  // Make<name>Accessor (T1 a1)
1338  os << commentStart << sectAttr << functionStart << "ns3::Ptr<const ns3::AttributeAccessor> "
1339  << make << "(T1 a1)\n"
1340  << copyDoc << "ns3::MakeAccessorHelper(T1)\n"
1341  << seeAlso << "AttributeAccessor\n"
1342  << commentStop;
1343 
1344  // \ingroup attribute_<name>Value
1345  // Make<name>Accessor (T1 a1)
1346  os << commentStart << sectAttr << functionStart << "ns3::Ptr<const ns3::AttributeAccessor> "
1347  << make << "(T1 a1, T2 a2)\n"
1348  << copyDoc << "ns3::MakeAccessorHelper(T1,T2)\n"
1349  << seeAlso << "AttributeAccessor\n"
1350  << commentStop;
1351 } // PrintMakeAccessors ()
1352 
1362 void
1363 PrintMakeChecker(std::ostream& os, const std::string& name, const std::string& header)
1364 {
1365  NS_LOG_FUNCTION(name << header);
1366  std::string sectAttr = sectionStart + "attribute_" + name + "\n";
1367  std::string make = "ns3::Make" + name + "Checker ";
1368 
1369  // \ingroup attribute_<name>Value
1370  // class <name>Checker
1371  os << commentStart << sectAttr << std::endl;
1372  os << classStart << " ns3::" << name << "Checker"
1373  << " \"" << header << "\"" << std::endl;
1374  os << "AttributeChecker implementation for " << name << "Value." << std::endl;
1375  os << seeAlso << "AttributeChecker" << std::endl;
1376  os << commentStop;
1377 
1378  // \ingroup attribute_<name>Value
1379  // Make<name>Checker ()
1380  os << commentStart << sectAttr << functionStart << "ns3::Ptr<const ns3::AttributeChecker> "
1381  << make << "()\n"
1382  << returns << "The AttributeChecker.\n"
1383  << seeAlso << "AttributeChecker\n"
1384  << commentStop;
1385 } // PrintMakeChecker ()
1386 
1389 {
1390  const std::string m_name;
1391  const std::string m_type;
1392  const bool m_seeBase;
1393  const std::string m_header;
1394 };
1395 
1404 void
1405 PrintAttributeHelper(std::ostream& os, const AttributeDescriptor& attr)
1406 {
1407  NS_LOG_FUNCTION(attr.m_name << attr.m_type << attr.m_seeBase << attr.m_header);
1409  PrintAttributeValueWithName(os, attr.m_name, attr.m_type, attr.m_header);
1410  PrintMakeAccessors(os, attr.m_name);
1411  PrintMakeChecker(os, attr.m_name, attr.m_header);
1412 } // PrintAttributeHelper ()
1413 
1418 void
1420 {
1422 
1423  // clang-format off
1424  const AttributeDescriptor attributes [] =
1425  {
1426  // Name Type see Base header-file
1427  // Users of ATTRIBUTE_HELPER_HEADER
1428  //
1429  { "Address", "Address", true, "address.h" },
1430  { "Box", "Box", true, "box.h" },
1431  { "DataRate", "DataRate", true, "data-rate.h" },
1432  { "Length", "Length", true, "length.h" },
1433  { "IeMeshId", "IeMeshId", true, "ie-dot11s-id.h" },
1434  { "Ipv4Address", "Ipv4Address", true, "ipv4-address.h" },
1435  { "Ipv4Mask", "Ipv4Mask", true, "ipv4-address.h" },
1436  { "Ipv6Address", "Ipv6Address", true, "ipv6-address.h" },
1437  { "Ipv6Prefix", "Ipv6Prefix", true, "ipv6-address.h" },
1438  { "Mac16Address", "Mac16Address", true, "mac16-address.h" },
1439  { "Mac48Address", "Mac48Address", true, "mac48-address.h" },
1440  { "Mac64Address", "Mac64Address", true, "mac64-address.h" },
1441  { "ObjectFactory", "ObjectFactory", true, "object-factory.h" },
1442  { "OrganizationIdentifier",
1443  "OrganizationIdentifier",
1444  true, "vendor-specific-action.h" },
1445  { "Priomap", "Priomap", true, "prio-queue-disc.h" },
1446  { "QueueSize", "QueueSize", true, "queue-size.h" },
1447  { "Rectangle", "Rectangle", true, "rectangle.h" },
1448  { "Ssid", "Ssid", true, "ssid.h" },
1449  { "TypeId", "TypeId", true, "type-id.h" },
1450  { "UanModesList", "UanModesList", true, "uan-tx-mode.h" },
1451  { "ValueClassTest", "ValueClassTest", false, "attribute-test-suite.cc" /* core/test/ */ },
1452  { "Vector", "Vector", true, "vector.h" },
1453  { "Vector2D", "Vector2D", true, "vector.h" },
1454  { "Vector3D", "Vector3D", true, "vector.h" },
1455  { "Waypoint", "Waypoint", true, "waypoint.h" },
1456  { "WifiMode", "WifiMode", true, "wifi-mode.h" },
1457 
1458  // All three (Value, Access and Checkers) defined, but custom
1459  { "Boolean", "bool", false, "boolean.h" },
1460  { "Callback", "Callback", true, "callback.h" },
1461  { "Double", "double", false, "double.h" },
1462  { "Enum", "int", false, "enum.h" },
1463  { "Integer", "int64_t", false, "integer.h" },
1464  { "Pointer", "Pointer", false, "pointer.h" },
1465  { "String", "std::string", false, "string.h" },
1466  { "Time", "Time", true, "nstime.h" },
1467  { "Uinteger", "uint64_t", false, "uinteger.h" },
1468  { "", "", false, "last placeholder" }
1469  };
1470  // clang-format on
1471 
1472  int i = 0;
1473  while (!attributes[i].m_name.empty())
1474  {
1475  PrintAttributeHelper(os, attributes[i]);
1476  ++i;
1477  }
1478 
1479  // Special cases
1480  PrintAttributeValueSection(os, "EmptyAttribute", false);
1481  PrintAttributeValueWithName(os, "EmptyAttribute", "EmptyAttribute", "attribute.h");
1482 
1483  PrintAttributeValueSection(os, "ObjectPtrContainer", false);
1485  "ObjectPtrContainer",
1486  "ObjectPtrContainer",
1487  "object-ptr-container.h");
1488  PrintMakeChecker(os, "ObjectPtrContainer", "object-ptr-container.h");
1489 
1490  PrintAttributeValueSection(os, "ObjectVector", false);
1491  PrintMakeAccessors(os, "ObjectVector");
1492  PrintMakeChecker(os, "ObjectVector", "object-vector.h");
1493 
1494  PrintAttributeValueSection(os, "ObjectMap", false);
1495  PrintMakeAccessors(os, "ObjectMap");
1496  PrintMakeChecker(os, "ObjectMap", "object-map.h");
1497 
1498  PrintAttributeValueSection(os, "Pair", false);
1499  PrintAttributeValueWithName(os, "Pair", "std::pair<A, B>", "pair.h");
1500  PrintMakeChecker(os, "Pair", "pair.h");
1501 
1502  PrintAttributeValueSection(os, "Tuple", false);
1503  PrintAttributeValueWithName(os, "Tuple", "std::tuple<Args...>", "tuple.h");
1504  PrintMakeChecker(os, "Tuple", "tuple.h");
1505 
1506  // AttributeContainer is already documented.
1507  // PrintAttributeValueSection (os, "AttributeContainer", false);
1508  // PrintAttributeValueWithName (os, "AttributeContainer", "AttributeContainer",
1509  // "attribute-container.h");
1510  PrintMakeChecker(os, "AttributeContainer", "attribute-container.h");
1511 } // PrintAttributeImplementations ()
1512 
1513 /***************************************************************
1514  * Main
1515  ***************************************************************/
1516 
1517 int
1518 main(int argc, char* argv[])
1519 {
1521 
1522  CommandLine cmd(__FILE__);
1523  cmd.Usage("Generate documentation for all ns-3 registered types, "
1524  "trace sources, attributes and global variables.");
1525  cmd.AddValue("output-text", "format output as plain text", outputText);
1526  cmd.Parse(argc, argv);
1527 
1528  SetMarkup();
1529 
1530  // Create a Node, to force linking and instantiation of our TypeIds
1531  NodeContainer c;
1532  c.Create(1);
1533 
1534  std::cout << std::endl;
1535  std::cout << commentStart << file << "\n"
1536  << sectionStart << "utils\n"
1537  << "Doxygen docs generated from the TypeId database.\n"
1538  << note << "This file is automatically generated by " << codeWord
1539  << "print-introspected-doxygen.cc. Do not edit this file! "
1540  << "Edit that file instead.\n"
1541  << commentStop << std::endl;
1542 
1543  PrintTypeIdBlocks(std::cout);
1544 
1545  PrintAllTypeIds(std::cout);
1546  PrintAllAttributes(std::cout);
1547  PrintAllGlobals(std::cout);
1548  PrintAllLogComponents(std::cout);
1549  PrintAllTraceSources(std::cout);
1550  PrintAttributeImplementations(std::cout);
1551 
1552  return 0;
1553 }
#define max(a, b)
Definition: 80211b.c:42
Gather aggregation and configuration path information from registered types.
void DoGather(TypeId tid)
Gather attribute, configuration path information for tid.
std::vector< std::pair< TypeId, std::string > > m_output
Configuration path for each TypeId.
std::vector< TypeId > m_alreadyProcessed
List of TypeIds we've already processed.
std::vector< std::string > m_noTids
List of type names without TypeIds, because those modules aren't enabled.
std::vector< std::string > m_currentPath
Current configuration path.
std::vector< std::string > GetNoTypeIds() const
bool HasAlreadyBeenProcessed(TypeId tid) const
void RecordAggregationInfo(std::string a, std::string b)
Record the a -> b aggregation relation.
std::vector< std::pair< TypeId, TypeId > > m_aggregates
List of aggregation relationships.
std::string GetCurrentPath() const
void Print() const
Print output in "a -> b" form on std::cout.
void Gather(TypeId tid)
Gather aggregation and configuration path information for tid.
std::vector< std::string > Get(TypeId tid) const
void RecordOutput(TypeId tid)
Record the current config path for tid.
Parse command-line arguments.
Definition: command-line.h:232
static Iterator Begin()
The Begin iterator.
static Iterator End()
The End iterator.
static ComponentList * GetComponentList()
Get the list of LogComponents.
Definition: log.cc:143
std::unordered_map< std::string, LogComponent * > ComponentList
LogComponent name map.
Definition: log.h:398
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Hold variables of type string.
Definition: string.h:56
std::string Get() const
Definition: string.cc:31
a unique identifier for an interface.
Definition: type-id.h:59
bool IsChildOf(TypeId other) const
Check if this TypeId is a child of another.
Definition: type-id.cc:971
std::size_t GetTraceSourceN() const
Get the number of Trace sources.
Definition: type-id.cc:1123
bool MustHideFromDocumentation() const
Check if this TypeId should not be listed in documentation.
Definition: type-id.cc:1092
@ ATTR_GET
The attribute can be read.
Definition: type-id.h:64
@ ATTR_SET
The attribute can be written.
Definition: type-id.h:65
@ ATTR_CONSTRUCT
The attribute can be written at construction-time.
Definition: type-id.h:66
TypeId::TraceSourceInformation GetTraceSource(std::size_t i) const
Get the trace source by index.
Definition: type-id.cc:1130
static uint16_t GetRegisteredN()
Get the number of registered TypeIds.
Definition: type-id.cc:879
std::size_t GetAttributeN() const
Get the number of attributes.
Definition: type-id.cc:1100
TypeId GetParent() const
Get the parent of this TypeId.
Definition: type-id.cc:955
static TypeId GetRegistered(uint16_t i)
Get a TypeId by index.
Definition: type-id.cc:886
std::size_t GetSize() const
Get the size of this object.
Definition: type-id.cc:1006
TypeId::AttributeInformation GetAttribute(std::size_t i) const
Get Attribute information by index.
Definition: type-id.cc:1108
static bool LookupByNameFailSafe(std::string name, TypeId *tid)
Get a TypeId by name.
Definition: type-id.cc:844
std::string GetName() const
Get the name.
Definition: type-id.cc:991
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:86
Ptr< Object > GetRootNamespaceObject(uint32_t i)
Definition: config.cc:1026
std::size_t GetRootNamespaceObjectN()
Definition: config.cc:1019
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
void Print(ComponentCarrier cc)
std::string headingStart
start of section heading (h3)
std::string copyDoc
copy (or refer) to docs elsewhere
std::string breakHtmlOnly
linebreak for html output only
std::string codeWord
format next word as source code
std::map< std::string, ns3::TypeId::AttributeInformation > SortedAttributeInfo(const TypeId tid)
Alphabetize the AttributeInformation for a TypeId by the Attribute name.
std::string breakTextOnly
linebreak for text output only
std::string flagSpanStart
start of Attribute flag value
std::string templArgDeduced
template argument deduced from function
std::map< std::string, ns3::TypeId::TraceSourceInformation > SortedTraceSourceInfo(const TypeId tid)
Alphabetize the TraceSourceInformation for a TypeId by the TraceSource name.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
U * PeekPointer(const Ptr< U > &p)
Definition: ptr.h:449
value
Definition: second.py:48
cmd
Definition: second.py:40
StaticInformation GetTypicalAggregations()
Register aggregation relationships that are not automatically detected by this introspection program.
void PrintTraceSourcesTid(std::ostream &os, const TypeId tid)
Print direct Trace sources for this TypeId.
std::map< std::string, int32_t > NameMap
Map from TypeId name to tid.
void PrintMakeAccessors(std::ostream &os, const std::string &name)
Print the AttributeValue MakeAccessor documentation for a class.
void PrintAllTraceSources(std::ostream &os)
Print the list of all Trace sources.
void PrintAllLogComponents(std::ostream &os)
Print the list of all LogComponents.
void PrintAttributeHelper(std::ostream &os, const AttributeDescriptor &attr)
Print documentation corresponding to use of the ATTRIBUTE_HELPER_HEADER macro or ATTRIBUTE_VALUE_DEFI...
void PrintTypeIdBlocks(std::ostream &os)
Print the doxy block for each TypeId.
void PrintAllAttributes(std::ostream &os)
Print the list of all Attributes.
void PrintAttributeValueWithName(std::ostream &os, const std::string &name, const std::string &type, const std::string &header)
Print the AttributeValue documentation for a class.
void PrintSize(std::ostream &os, const TypeId tid)
Print the size of the type represented by this tid.
void Uniquefy(T t)
Helper to keep only the unique items in a container.
void PrintAttributeImplementations(std::ostream &os)
Print documentation for Attribute implementations.
NameMap GetNameMap()
Create a map from the class names to their index in the vector of TypeId's so that the names will end...
void PrintTraceSources(std::ostream &os, const TypeId tid)
Print the Trace sources block for tid, including Trace sources declared in base classes.
void SetMarkup()
Initialize the markup strings, for either doxygen or text.
NameMap::const_iterator NameMapIterator
NameMap iterator.
void PrintConfigPaths(std::ostream &os, const TypeId tid)
Print config paths.
void PrintAllTypeIds(std::ostream &os)
Print the list of all TypeIds.
void PrintAttributes(std::ostream &os, const TypeId tid)
Print the Attributes block for tid, including Attributes declared in base classes.
void PrintAllGlobals(std::ostream &os)
Print the list of all global variables.
void PrintMakeChecker(std::ostream &os, const std::string &name, const std::string &header)
Print the AttributeValue MakeChecker documentation for a class.
void PrintAttributeValueSection(std::ostream &os, const std::string &name, const bool seeBase=true)
Print the section definition for an AttributeValue.
void PrintAttributesTid(std::ostream &os, const TypeId tid)
Print direct Attributes for this TypeId.
Descriptor for an AttributeValue.
const std::string m_header
The header file name.
const std::string m_type
The name of the underlying type.
const std::string m_name
The base name of the resulting AttributeValue type.
const bool m_seeBase
Print a "see also" pointing to the base class.
Attribute implementation.
Definition: type-id.h:81
std::string name
Attribute name.
Definition: type-id.h:83
Ptr< const AttributeChecker > checker
Checker object.
Definition: type-id.h:95
TraceSource implementation.
Definition: type-id.h:104
std::string name
Trace name.
Definition: type-id.h:106