Bug 2636 - Add to doxygen a list of all registered TypeIds
Add to doxygen a list of all registered TypeIds
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: documentation
unspecified
All All
: P3 normal
Assigned To: Peter Barnes
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-01-26 13:36 UTC by Peter Barnes
Modified: 2020-02-03 18:53 UTC (History)
3 users (show)

See Also:


Attachments
A patch after creating the function and changing other entities after editing the code of print-introspected-doxygen.cc (1.26 KB, patch)
2020-01-09 14:07 UTC, Parth Pandya
Details | Diff
A patch for the output generated by manipulating the required changes. (27.66 KB, patch)
2020-01-09 14:09 UTC, Parth Pandya
Details | Diff
Added screenshot some of the entities which the code yielded me as an output. (42.56 KB, image/png)
2020-01-09 14:12 UTC, Parth Pandya
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Barnes 2017-01-26 13:36:35 UTC
It would be helpful to add an index page, similar to the "All Attributes" page, containing the list of all registered TypeIds.
Comment 1 Parth Pandya 2019-12-30 07:48:13 UTC
Hello there, where I can Find the list of all registered TypeIds?
Comment 2 Tom Henderson 2019-12-30 14:22:06 UTC
(In reply to Parth Pandya from comment #1)
> Hello there, where I can Find the list of all registered TypeIds?

There is no centralized list.  Searching the code for instances of the macro NS_OBJECT_ENSURE_REGISTERED() is one way to create such a list.

The doxygen introspection program will need to fetch the list that is created by all of those calls to ENSURE_REGISTERED, so I recommend to follow what happens by those macro calls and it should lead you to the internal data structure where those are stored.
Comment 3 Parth Pandya 2019-12-31 08:48:02 UTC
Hello! I've installed Doxygen and I've also found the following in a file named object-base.h : 

#define NS_OBJECT_ENSURE_REGISTERED(type)               
   static struct Object ## type ## RegistrationClass     
   {                                                     
     Object ## type ## RegistrationClass () {            
       ns3::TypeId tid = type::GetTypeId ();             
       tid.SetSize (sizeof (type));                      
       tid.GetParent ();                                 
     }                                                   
   } Object ## type ## RegistrationVariable

Now, is this the stuff I was supposed to find and if yes, then what should I have to do with this ? Also, I've read documentation of searching a function or anything else on Doxygen manual but I found it difficult to understand so, I would need some help there too if possible!
Comment 4 Tom Henderson 2020-01-01 16:22:02 UTC
I'd like to suggest a more straightforward way to approach this patch.

The file utils/print-introspected-doxygen.cc already has a function PrintAllAttributes() that will print out the attributes for each registered TypeId.

To print the attributes, the function iterates already on the list of registered TypeIds.  Therefore, it should be straightforward to clone this and rename it to something like PrintAllTypeIds() and have the new function instead output the TypeIds (using the TypeId::GetName() method).

Once this is done, the output needs to be linked to the main Doxygen page; studying how this is done for all attributes will help to follow the same approach.
Comment 5 Parth Pandya 2020-01-03 08:16:56 UTC
Hello sir, I've runned print-introspected-doxygen.cc and the output I got was previewed in markdown too, which gave me a list of various entities. After that I just understood to rename the function name but I just got a mess with TypeId::GetName() method. Although I found that thing in the code of print-introspected-doxygen.cc but not quite sure about how to deal with it! Can I please get some more help here?
Comment 6 Tom Henderson 2020-01-03 21:40:22 UTC
We do not use the tracker for debugging sessions, just to review and comment on patches and proposed approach.  I can't tell for sure what is the problem because your description is not specific.  If you need help, please use the ns-3-users group or Zulip to post more specific requests for help (for instance, providing your sample code so that someone could reproduce your error).
Comment 7 Peter Barnes 2020-01-06 14:26:25 UTC
The patch should create a new function, PrintAllTypeIds(std::ostream & os).  The body of this function should be similar to PrintAllAttributes, but omit the list section (lines 491-501).  This new function should be called in main just before PrintAllAttributes at line 1517.
Comment 8 Parth Pandya 2020-01-09 14:07:13 UTC
Created attachment 3248 [details]
A patch after creating the function and changing other entities after editing the code of print-introspected-doxygen.cc

Here's the patch :
Comment 9 Parth Pandya 2020-01-09 14:09:56 UTC
Created attachment 3249 [details]
A patch for the output generated by manipulating the required changes.
Comment 10 Parth Pandya 2020-01-09 14:12:05 UTC
Created attachment 3250 [details]
Added screenshot some of the entities which the code yielded me as an output.
Comment 11 Peter Barnes 2020-02-03 18:53:48 UTC
Pushed to Gitlab commit 741fd9fe